大数据开发环境搭载9--安装kafka集群

9、安装kafka集群

  • 下载
https://www.apache.org/dyn/closer.cgi?path=/kafka/0.10.2.1/kafka_2.12-0.10.2.1.tgz
  • 将kafka安装到/usr/local/kafka
tar -xvzf kafka_2.12-0.10.2.1.tgz -C /usr/local
mv /usr/local/kafka_2.12-0.10.2.0 /usr/local/kafka
  • 修改/etc/profile,末尾添加以下内容:
# kafka
export KAFKA_HOME=/usr/local/kafka
export PATH=$PATH:$KAFKA_HOME/bin
  • 修改server.properties
broker.id=0 #整个集群内唯一id号,整数,一般从0开始,每台机器需要单独设置
zookeeper.connect=node1:2181,node2:2181,node3:2181
  • 复制到其他节点上去
scp -r /usr/local/kafka/ root@node2:/usr/local/
scp -r /usr/local/kafka/ root@node3:/usr/local/
scp -r /usr/local/kafka/ root@node4:/usr/local/
scp -r /usr/local/kafka/ root@node5:/usr/local/
scp -r /usr/local/kafka/ root@node6:/usr/local/
  • 启动
kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
  • 检查启动是否成功
[root@node1 config]# ps -ef | grep config/server
root      20313   2132  0 10:14 pts/0    00:00:00 grep --color=auto config/server

你可能感兴趣的:(大数据开发环境搭载9--安装kafka集群)