**Kafka + Zookeeper clustering failed on both clustering node
#systemctl status kafka
● kafka.service - High-available, distributed message broker
Loaded: loaded (/etc/systemd/system/kafka.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2018-05-28 12:25:23 +07; 1s ago
Process: 2059 ExecStart=/opt/kafka/bin/kafka-server-start.sh /opt/kafka/config/server.properties (code=exited, status=1/FAILURE)
Main PID: 2059 (code=exited, status=1/FAILURE)
May 28 12:25:23 kafka2 kafka-server-start.sh[2059]: at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
May 28 12:25:23 kafka2 kafka-server-start.sh[2059]: at kafka.Kafka$.main(Kafka.scala:92)
May 28 12:25:23 kafka2 kafka-server-start.sh[2059]: at kafka.Kafka.main(Kafka.scala)
May 28 12:25:23 kafka2 kafka-server-start.sh[2059]: [2018-05-28 12:25:23,260] INFO shutting down (kafka.server.KafkaServer)
May 28 12:25:23 kafka2 kafka-server-start.sh[2059]: [2018-05-28 12:25:23,276] INFO shut down completed (kafka.server.KafkaServer)
May 28 12:25:23 kafka2 kafka-server-start.sh[2059]: [2018-05-28 12:25:23,278] FATAL Exiting Kafka. (kafka.server.KafkaServerStartable)
May 28 12:25:23 kafka2 kafka-server-start.sh[2059]: [2018-05-28 12:25:23,283] INFO shutting down (kafka.server.KafkaServer)
May 28 12:25:23 kafka2 systemd[1]: kafka.service: Main process exited, code=exited, status=1/FAILURE
May 28 12:25:23 kafka2 systemd[1]: kafka.service: Unit entered failed state.
May 28 12:25:23 kafka2 systemd[1]: kafka.service: Failed with result 'exit-code'.
สาเหตุของ error นี้เกิดจาก การ configure ผิดในส่วนของ zoo.cfg จนทำให้ไม่สามารถ start zookeeper service ได้ปกติ
ทำการแก้ไขโดย
#vi /etc/zookeeper/conf/zoo.cfg
server.2=kafka2:2888:3888
#systemctl restart zookeeper
แล้วจะทำให้ port 2181 เปิดขึ้นมา
ทำการปรับแก้ไข kafka configuration
#vi /opt/kafka/config/server.properties
log.dirs=/var/lib/kafka/data
log.retention.hours=168 #other accepted keys are(log.retention.ms, log.retention.minutes)
log.retention.bytes=104857600
broker.id=0 #0=kafka1 , 1=kafka2
zookeeper.connect=kafka1:2181,kafka2:2181
หลังจากนั้นทำการ start service kafka อีกครั้งหนึ่ง
systemctl restart kafka
ก็จะทำให้สามารถทำงานได้ปกติครับผม
#systemctl status zookeeper
● zookeeper.service - LSB: centralized coordination service
Loaded: loaded (/etc/init.d/zookeeper; bad; vendor preset: enabled)
Active: active (running) since Mon 2018-05-28 17:15:12 +07; 8min ago
Docs: man:systemd-sysv-generator(
Process: 9865 ExecStop=/etc/init.d/zookeeper stop (code=exited, status=0/SUCCESS)
Process: 9875 ExecStart=/etc/init.d/zookeeper start (code=exited, status=0/SUCCESS)
Tasks: 18
Memory: 39.5M
CPU: 2.506s
CGroup: /system.slice/zookeeper.service
└─9888 /usr/bin/java -cp /etc/zookeeper/conf:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/