kafka安装

下载:http://kafka.apache.org/

 

关闭防火墙

service iptables stop

 

关闭SElinux

setenforce 0

 

tar -xvf kafka_2.9.1-0.8.2.2.tgz

cd kafka_2.9.1-0.8.2.2

vim config/server.properties

 

######################################################

broker.id=2

host.name=192.168.147.77

port=9092

zookeeper.connect=192.168.147.75:2181,192.168.147.76:2181,192.168.147.77:2181

log.dirs=/tmp/kafka-logs

######################################################

 

启动

./bin/kafka-server-start.sh -daemon config/server.properties

 

创建topic

bin/kafka-topics.sh --create --zookeeper 192.168.147.75:2181,192.168.147.76:2181,192.168.147.77:2181 --replication-factor 1 --partitions 1 --topic mykafka

 

查看topic列表

bin/kafka-topics.sh --list --zookeeper 192.168.147.75:2181,192.168.147.76:2181,192.168.147.77:2181

 

生产消息

bin/kafka-console-producer.sh --broker-list 192.168.147.75:9092 --topic mykafkaww

 

消费消息

bin/kafka-console-consumer.sh --zookeeper 192.168.147.75:2181,192.168.147.76:2181,192.168.147.77:2181 --topic mykafkaww --from-beginning

 

 

你可能感兴趣的:(kafka安装)