服务和组件 Kafka 1.0.0、Zookeeper 3.4.8
解压:
tar -zxvf kafka1.0.0.tgz
重命名:
mv kafka_2.11-1.0.0 kafka
切换目录:
cd /usr/local/src/kafka/config
配置文档:
vim server.properties(21、123)
broker.id=0
zookeeper.connect=master,slave1,slave2
分发:
scp -r /usr/local/src/kafka slave1:/usr/local/src/
scp -r /usr/local/src/kafka slave2:/usr/local/src/
配置文档(slave1、slave2):
vim /usr/local/src/kafka/config/server.properties(21)
broker.id=1
broker.id=2
启动Kafka:
cd /usr/local/src/kafka
bin/kafka-server-start.sh config/server.properties
/usr/local/src/kafka/bin/kafka-topics.sh --create --zookeeper master:2181,slave1:2181,slave2:2181 --replication-factor 2 --topic test --partitions 1
/usr/local/src/kafka/bin/kafka-topics.sh --list --zookeeper master:2181,slave1:2181,slave2:2181
/usr/local/src/kafka/bin/kafka-console-producer.sh --broker-list master:9092,slave1:9092,slave2:9092 --topic test
/usr/local/src/kafka/bin/kafka-console-consumer.sh --zookeeper master:2181,slave1:2181,slave2:2181 --topic test --from-beginning