Kafka的新贵剧本

nqwrtyyt  于 2021-06-08  发布在  Kafka
关注(0)|答案(1)|浏览(287)

我用新贵脚本做开始Kafka和zookeeper。我的步骤是:(1)kafka-zk.conf(放入/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
(3) 运行“sudo service kafka zk start | stop”启动或停止kafka和zookeeper
我的问题是:在运行“sudo service kafka zk stop”时,我不确定脚本zookeeper-server-stop.sh(http://kafka.apache.org/documentation.html#quickstart)有没有打过电话。如何使upstart脚本使用zookeeper-server-stop.sh?
另外,我应该使用exec$kafka\u home/bin/zookeeper-server-start.sh-daemon$kafka\u home/config/zookeeper.properties吗?

pvcm50d1

pvcm50d11#

(1) 下面是zookeeper-server-stop.sh。看到了吗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) upstart可以使作业在后台运行。所以“-daemon”是没有必要的

相关问题