开启Kafka
指定配置文件
/opt/modules/kafka_2.11-0.10.0.0/bin/kafka-server-start.sh /opt/modules/kafka_2.11-0.10.0.0/config/server.properties
测试用控制台消费者
[kfk@bigdata-pro01 bin]$ ./kafka-console-consumer.sh --zookeeper bigdata-pro01.kfk.com:2181 --topic test --from-beginning
测试用控制台生产者
[kfk@bigdata-pro03 bin]$ ./kafka-console-producer.sh --broker-list bigdata-pro01.kfk.com:9092 --topic test
–broker-list后接可接多个broker,用,分隔
查看集群中有的topic:
bin/kafka-topics.sh --zookeeper bigdata-pro01.kfk.com:2181 --list
创建一个topic:
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partitions 3 --topic test111