You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by xingcan <xi...@gmail.com> on 2012/10/11 15:30:21 UTC

Can't stop Kafka as a service

Hi all,

I'm a beginner to Kafka and Linux. Recently, I want to add Kafka as a Linux
service, there's a very very simple script in /etc/init.d/kafka

export KAFKA_HOME="/home/user/program/kafka-0.7.1"
case "$1" in
start)
echo -n "Kafka start"
bash ${KAFKA_HOME}/bin/kafka-run-class.sh kafka.Kafka
${KAFKA_HOME}/config/server.properties >> ${KAFKA_HOME}/log/kafka.log
;;
stop)
echo -n "Kakfa stop"
${KAFKA_HOME}/bin/kafka-server-stop.sh
;;
esac
exit 0

It can start well. However, the kafka.Kafka process can't be stopped by
SIGINT signal. It seems that the SIGINT signal is ignored or even not sent
to the process.And I can only use  -9 to force kill it. How can this be? Is
there other way to stop kafka process? Thanks for help.

Re: Can't stop Kafka as a service

Posted by Neha Narkhede <ne...@gmail.com>.
Yes, since SIGTERM is more general, I believe we can change
kafka-server-stop.sh to use SIGTERM instead of SIGINT

Thanks,
Neha

On Thu, Oct 11, 2012 at 6:39 PM, xingcan <xi...@gmail.com> wrote:
> Neha,
>
> Thanks for your answer.
>
> It seems that the SIGINT signal can't be sent to a background service
> process. I use SIGTERM instead and the problem has been solved. I'm not
> sure if the 'SIGINT' should be changed to 'SIGTERM' in
> bin/kafka-server-stop.sh.
>
> xingcan
>
> 2012/10/11 Neha Narkhede <ne...@gmail.com>
>
>> Hi,
>>
>> We have a script in the bin directory for stopping a Kafka server
>> (bin/kafka-server-stop.sh) and that uses SIGINT to stop a Kafka
>> process.
>>
>> Thanks,
>> Neha
>>
>> On Thu, Oct 11, 2012 at 6:30 AM, xingcan <xi...@gmail.com> wrote:
>> > Hi all,
>> >
>> > I'm a beginner to Kafka and Linux. Recently, I want to add Kafka as a
>> Linux
>> > service, there's a very very simple script in /etc/init.d/kafka
>> >
>> > export KAFKA_HOME="/home/user/program/kafka-0.7.1"
>> > case "$1" in
>> > start)
>> > echo -n "Kafka start"
>> > bash ${KAFKA_HOME}/bin/kafka-run-class.sh kafka.Kafka
>> > ${KAFKA_HOME}/config/server.properties >> ${KAFKA_HOME}/log/kafka.log
>> > ;;
>> > stop)
>> > echo -n "Kakfa stop"
>> > ${KAFKA_HOME}/bin/kafka-server-stop.sh
>> > ;;
>> > esac
>> > exit 0
>> >
>> > It can start well. However, the kafka.Kafka process can't be stopped by
>> > SIGINT signal. It seems that the SIGINT signal is ignored or even not
>> sent
>> > to the process.And I can only use  -9 to force kill it. How can this be?
>> Is
>> > there other way to stop kafka process? Thanks for help.
>>

Re: Can't stop Kafka as a service

Posted by xingcan <xi...@gmail.com>.
Neha,

Thanks for your answer.

It seems that the SIGINT signal can't be sent to a background service
process. I use SIGTERM instead and the problem has been solved. I'm not
sure if the 'SIGINT' should be changed to 'SIGTERM' in
bin/kafka-server-stop.sh.

xingcan

2012/10/11 Neha Narkhede <ne...@gmail.com>

> Hi,
>
> We have a script in the bin directory for stopping a Kafka server
> (bin/kafka-server-stop.sh) and that uses SIGINT to stop a Kafka
> process.
>
> Thanks,
> Neha
>
> On Thu, Oct 11, 2012 at 6:30 AM, xingcan <xi...@gmail.com> wrote:
> > Hi all,
> >
> > I'm a beginner to Kafka and Linux. Recently, I want to add Kafka as a
> Linux
> > service, there's a very very simple script in /etc/init.d/kafka
> >
> > export KAFKA_HOME="/home/user/program/kafka-0.7.1"
> > case "$1" in
> > start)
> > echo -n "Kafka start"
> > bash ${KAFKA_HOME}/bin/kafka-run-class.sh kafka.Kafka
> > ${KAFKA_HOME}/config/server.properties >> ${KAFKA_HOME}/log/kafka.log
> > ;;
> > stop)
> > echo -n "Kakfa stop"
> > ${KAFKA_HOME}/bin/kafka-server-stop.sh
> > ;;
> > esac
> > exit 0
> >
> > It can start well. However, the kafka.Kafka process can't be stopped by
> > SIGINT signal. It seems that the SIGINT signal is ignored or even not
> sent
> > to the process.And I can only use  -9 to force kill it. How can this be?
> Is
> > there other way to stop kafka process? Thanks for help.
>

Re: Can't stop Kafka as a service

Posted by Neha Narkhede <ne...@gmail.com>.
Hi,

We have a script in the bin directory for stopping a Kafka server
(bin/kafka-server-stop.sh) and that uses SIGINT to stop a Kafka
process.

Thanks,
Neha

On Thu, Oct 11, 2012 at 6:30 AM, xingcan <xi...@gmail.com> wrote:
> Hi all,
>
> I'm a beginner to Kafka and Linux. Recently, I want to add Kafka as a Linux
> service, there's a very very simple script in /etc/init.d/kafka
>
> export KAFKA_HOME="/home/user/program/kafka-0.7.1"
> case "$1" in
> start)
> echo -n "Kafka start"
> bash ${KAFKA_HOME}/bin/kafka-run-class.sh kafka.Kafka
> ${KAFKA_HOME}/config/server.properties >> ${KAFKA_HOME}/log/kafka.log
> ;;
> stop)
> echo -n "Kakfa stop"
> ${KAFKA_HOME}/bin/kafka-server-stop.sh
> ;;
> esac
> exit 0
>
> It can start well. However, the kafka.Kafka process can't be stopped by
> SIGINT signal. It seems that the SIGINT signal is ignored or even not sent
> to the process.And I can only use  -9 to force kill it. How can this be? Is
> there other way to stop kafka process? Thanks for help.