2016-06-06 3 views
0

Apache Kafka 및 Apache Zookeeper 프로세스가 중지 될 때 메일로 알려주고 중지되면 자동으로 다시 시작합니다. Apache Kafka와 Apache Zookeeper는 pid 파일을 만들지 않으며 init 스크립트에도 포함되지 않습니다. 내가 다시로드 MONIT을 시작하면 Monit with 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 [email protected] 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 [email protected] with reminder on 500 cycles 

아래 정의, 그것은 '사육사'과정이 아닌 실행되지 않고 '카프카'과정의 오류를 제공 달리는.

가 어떻게 카프카와 사육사 프로세스를 다시 시작하는 데 도움이 메일 모두의

+0

무엇 당신이 MONIT의 로그 파일에 얻을 오류? –

답변

0

최초의 경고 메일을 보내 주시기 바랍니다, 그것은 "일치"가 아닌 "일치"입니다.

둘째, 정규식 패턴이 작동하지 않습니다. 당신이이 일치 일 경우 당신에게 말할 것이다

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 [email protected] with reminder on 500 cycles