kafka集群安装
1. 下载
wget http://mirror.bit.edu.cn/apache/kafka/0.10.2.1/kafka_2.12-0.10.2.1.tgz
2. 解压
3. 修改配置文件
vim kafka_2.12-0.10.2.1/config/server.properties
#broker.id=0 每台服务器的broker.id都不能相同 port=9092 #hostname host.name=10.112.29.4 #在log.retention.hours=168 下面新增下面三项 message.max.byte=5242880 default.replication.factor=2 replica.fetch.max.bytes=5242880 #设置zookeeper的连接端口 zookeeper.connect=10.112.28.245:2181,10.112.28.229:2181,10.112.28.241:2181
4. 启动
./bin/kafka-server-start.sh -daemon config/server.properties
监控搭建:http://www.cnblogs.com/kisf/p/7364321.html
kafka测试:
创建Topic
cd kafka_2.12-0.10.2.1/bin/ ./kafka-topics.sh --create --zookeeper 10.112.28.245:2181 --replication-factor 2 --partitions 1 --topic jenkin
创建broker,发布者
./kafka-console-producer.sh --broker-list 10.112.29.6:9092 --topic jenkin
创建订阅者
./kafka-console-consumer.sh --zookeeper 10.112.28.241:2181 --topic jenkin --from-beginning
查看Topic
./kafka-topics.sh --list --zookeeper 10.112.28.245:2181
查看Topic状态
./kafka-topics.sh --describe --zookeeper 10.112.28.245:2181 --topic jenkin
zk命令查看
./zkCli.sh -server 10.112.28.245:2181 ls / ls /brokers get /brokers get /brokers/topics