卡夫卡的暴发户脚本 [英] upstart script for kafka

查看:44
本文介绍了卡夫卡的暴发户脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用upstart脚本来启动kafka和zookeeper.我的步骤是:(1)以下是kafka-zk.conf(将其放在/etc/init/中):

I am using upstart script to do start kafka and zookeeper. My steps are: (1)The following is kafka-zk.conf (Put it in /etc/init/):

kill timeout 300

start on runlevel [2345]
stop on runlevel [06]

pre-start script
end script

script
    KAFKA_HOME=/home/My/kafka/kafka_<version>
    exec $KAFKA_HOME/bin/zookeeper-server-start.sh $KAFKA_HOME/config/zookeeper.properties
end script

(2)创建符号链接:ln -s/lib/init/upstart-job/etc/init.d/kafka-zk

(2) Create symbol link: ln -s /lib/init/upstart-job /etc/init.d/kafka-zk

(3)运行"sudo服务kafka-zk start | stop"以启动或停止kafka和zookeeper

(3) Run "sudo service kafka-zk start|stop" to start or stop kafka and zookeeper

我的问题是:运行"sudo服务kafka-zk停止"时,我不确定脚本 zookeeper-server-stop.sh (

My question is: when running "sudo service kafka-zk stop", I am not sure whether the script zookeeper-server-stop.sh (http://kafka.apache.org/documentation.html#quickstart) was called or not. How to make the upstart script to use zookeeper-server-stop.sh?

此外,我应该使用exec $ KAFKA_HOME/bin/zookeeper-server-start.sh -daemon $ KAFKA_HOME/config/zookeeper.properties吗?

Also, should I use exec $KAFKA_HOME/bin/zookeeper-server-start.sh -daemon $KAFKA_HOME/config/zookeeper.properties?

推荐答案

(1)以下是zookeeper-server-stop.sh.参见 https://github.com/kafka-dev/kafka/blob/master/bin/zookeeper-server-stop.sh

(1) The following is zookeeper-server-stop.sh. See https://github.com/kafka-dev/kafka/blob/master/bin/zookeeper-server-stop.sh

   #!/bin/sh
    ps ax | grep -i 'zookeeper' | grep -v grep | awk '{print $1}' | xargs kill -SIGINT

(2)新贵可以使作业在后台运行.因此"-daemon"不是必需的

(2) upstart can make the job run in background. So "-daemon" is not necessary

这篇关于卡夫卡的暴发户脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆