使用Clustershell搭建Kafka和Zookeeper集群(3)

4、 建立kafaka集群
修改第一台主机中kafka目录的config子目录中的server.properties配置文件

zookeeper.connect=router1:2181,router2:2181,router3:2181/kafka

将server.properties配置文件分发到其他两台主机中

-bash-4.1# clush-g kafka -c /opt/kafka/kafka_2.11-0.8.2.1/config/server.properties

分别修改三台主机的server.properties配置文件,配置不同的broker.id

第一台主机的broker.id设置为broker.id=1 第二台主机的broker.id设置为broker.id=2 第三台主机的broker.id设置为broker.id=3

启动kafka集群

-bash-4.1# clush-g kafka /opt/kafka/kafka_2.11-0.8.2.1/bin/kafka-server-start.sh -daemon/opt/kafka/kafka_2.11-0.8.2.1/config/server.properties

验证9092端口

-bash-4.1# clush-g kafka lsof -i:9092 router3:COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME router3:java 15742 root 55u IPv6 120391 0t0 TCP *:XmlIpcRegSvc (LISTEN) router3:java 15742 root 56u IPv6 120394 0t0 TCP router3:38028->router1:XmlIpcRegSvc(ESTABLISHED) router3:java 15742 root 57u IPv6 120395 0t0 TCP router3:51440->router3:XmlIpcRegSvc(ESTABLISHED) router3:java 15742 root 58u IPv6 120396 0t0 TCP router3:XmlIpcRegSvc->router3:51440(ESTABLISHED) router3:java 15742 root 59u IPv6 120397 0t0 TCP router3:46242->router2:XmlIpcRegSvc(ESTABLISHED) router1:COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME router1:java 18531 root 55u IPv6 151926 0t0 TCP *:XmlIpcRegSvc (LISTEN) router1:java 18531 root 56u IPv6 151929 0t0 TCP router1:XmlIpcRegSvc->router3:38028(ESTABLISHED) router2:COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME router2:java 17538 root 55u IPv6 129254 0t0 TCP *:XmlIpcRegSvc (LISTEN) router2:java 17538 root 56u IPv6 129257 0t0 TCP router2:XmlIpcRegSvc->router3:46242 (ESTABLISHED)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/96d91513aa917e8225e62c7a08bfdd81.html