Kafka-相关命令总结

 kafka:

--------------------------------kafka----------------------------

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

./bin/kafka-topics.sh --create --zookeeper 10.170.130.183:2181 --topic test --partitions 3 --replication-factor 1
./bin/kafka-topics.sh --zookeeper kafka-0:2181 --list

zookeeper:

--------------------------------zookeeper------------------------
./apache-zookeeper-3.7.0-bin/bin/zkServer.sh start
./apache-zookeeper-3.7.0-bin//bin/zkServer.sh status
tail -f zookeeper_audit.log
bin/kafka-topics.sh --zookeeper 10.82.22.174:2181 --list
bin/kafka-topics.sh --describe --zookeeper 10.82.22.174:2181 --topic tc_msg_news

topic:

查看topic:
bin/kafka-topics.sh --zookeeper kafka-0:2181 --list

生产topic数据:
bin/kafka-console-producer.sh --broker-list kafka-0:9092 --topic mysql-test_to_kafka

消费topic数据:
bin/kafka-console-consumer.sh --bootstrap-server kafka-0:9092 --topic source_t1 --from-beginning

删除topic数据:
bin/kafka-topics.sh --zookeeper kafka-0:2181 --delete --topic sink_t1

其他:

#解压缩
tar -xvzf

#修改hosts
vi /etc/hosts

IP kafka-0

#查询端口是否占用
netstat -tunlp | grep 8083

你可能感兴趣的:(#,Kafka,经验总结,kafka,java,大数据)