kafka常用命令
启动Zookeeper
/opt/kafka/kafka_2.10-0.10.2.1/bin/zookeeper-server-start.sh /opt/kafka/kafka_2.10-0.10.2.1/config/zookeeper.properties &
启动kafka
/opt/kafka/kafka_2.10-0.10.2.1/bin//kafka-server-start.sh -daemon /opt/kafka/kafka_2.10-0.10.2.1/config/server.properties &
创建topic
./bin/kafka-topics.sh --create --zookeeper 10.xxx.xxx.149:2181, 10.xxx.xxx.182:2181, 10:xxx.xxx.190:2181 --replication-factor 3 --partitions 3 --topic test
查询当前的topic列表
/opt/kafka/kafka_2.10-0.10.2.1/bin/kafka-topics.sh --list --zookeeper localhost:2181
发送数据
./bin/kafka-console-producer.sh --broker-list 10.xxx.xxx.149:9092, 10.xxx.xxx.182:9092, 10:xxx.xxx.190:9092 --topic test
消费数据
./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic test
./bin/kafka-console-consumer.sh --bootstrap-server 10.xxx.xxx.149:9092, 10.xxx.xxx.182:9092, 10:xxx.xxx.190:9092 --from-beginning --topic test