kafka安装部署
2.2.1 集群安装
安装zk
下载kafka 版本0.11
复制到linux,解压
修改 server.properties
broker.id=0 (每个broker整数唯一)
delete.topic.enable=true(topic是否可以删除)
listeners=PLAINTEXT://:9092(端口号)
log.dirs=/opt/module/kafka/logs(/opt/module/kafka/logs 数据存储位置)
zookeeper.connect=192.168.0.1:2181,192.168.0.2:2181 (zk服务IP地址)
启动zk
启动kafka
kafka-server-start.sh
kafka-server-stop.sh
kafka-topics.sh
启动命令(单节点启动,非后台启动):kafka-server-start.sh config/server.properties
启动命令(后台启动):kafka-server-start.sh -daemon config/server.properties
启动kafka脚本(批量启动):
编写脚本
#!/bin/bash
case $1 in
"start") {
for i in hadoop102 hadoop103 hadoop104
do
echo "*****$i*****"
ssh $i "/opt/module/kafka/bin/kafka-server-start.sh -deamon /opt/module/kafka/config/server.properties"
done
};;
"stop") {
for i in hadoop102 hadoop103 hadoop104
do
echo "*****$i*****"
ssh $i "/opt/module/kafka/bin/kafka-server-stop.sh -deamon /opt/module/kafka/config/server.properties"
done
};;
esac
授权:chmod 777 kk.sh
运行:kk.sh start/stop
网友评论