我想在Apache Kafka和Apache Zookeeper进程停止时收到邮件提醒,当它停止时会自动重新启动这两个进程。Apache Kafka和Apache Zookeeper都不创建任何pid文件,也不属于init脚本。
我的Apache Zookeeper和Apache Kafka的monit控制文件定义如下
check process zookeeper match "config/zookeeper.properties"
if not exist then exec "/Users/xxxx/kafka_2.10-0.9.0.1/bin/zookeeper-server-start.sh -c -d config/zookeeper.properties" and alert xxxx@gmail.com with reminder on 500 cycles
check process kafka match "config/server.properties"
if not exist then exec "/Users/xxxx/kafka_2.10-0.9.0.1/bin/kafka-server-start.sh -c -d config/server.properties" and alert xxxx@gmail.com with reminder on 500 cycles
当我重新加载并启动monit时,它给出了一个错误:'kafka‘进程没有运行,'zookeeper’进程没有运行。
请告诉我如何重启Kafka和Zookeeper进程并收到邮件提醒
发布于 2017-03-17 05:24:49
首先,它是“匹配”,而不是“匹配”。
其次,您的正则表达式模式将不起作用。可以使用以下命令测试该模式
monit procmatch "regex-pattern"
这将告诉您匹配是否有效。
第三,使用“启动程序”,“停止程序”来启动/停止kafka。
下面是我的monit的一个例子:
check process kafka matching "java -Xmx1G.*kafka" start program "/bin/bash -c 'cd /usr/local/xxx/kafka_2.10-0.8.2.1/; bin/kafka-server-start.sh config/server.properties &'" stop program "/bin/bash -c 'cd /usr/local/xxx/kafka_2.10-0.8.2.1/; bin/kafka-server-stop.sh'" alert xxxx@gmail.com with reminder on 500 cycles
https://stackoverflow.com/questions/37651552
复制相似问题