#Kafka相关操作说明
bin/kafka-server-start.sh config/server-1.properties &
netstat -anp | grep 8088
kill -9 pid
本地测试发现无法生效:
/bin/kafka-server-stop.sh config/server.properties
bin/kafka-topics.sh --list --zookeeper 192.168.0.239:2181
bin/kafka-topics.sh --describe --zookeeper 192.168.0.239:2181 --topic test2
bin/kafka-topics.sh --create --zookeeper 192.168.0.239:2181 --replication-factor 1 --partitions 1 --topic test
bin/kafka-topics.sh --delete --topic test --zookeeper 192.168.0.239:2181
bin/kafka-console-producer.sh --broker-list 192.168.0.239:9092 --topic test
方式1:
bin/kafka-console-consumer.sh --bootstrap-server 192.168.0.239:9092 --topic test --from-beginning
方式2:
bin/kafka-console-consumer.sh --zookeeper 192.168.0.239:2181 --topic test2 --from-beginning
注意:方式1无法被kafka监控KafkaOffsetMonitor工具管理,方式2则可以
cp config/server.properties config/server-1.properties
cp config/server.properties config/server-2.properties
修改下面几个配置:
config/server.properties:
listeners=PLAINTEXT://192.168.0.239:9092
advertised.listeners=PLAINTEXT://192.168.0.239:9092
config/server-1.properties:
broker.id=1
listeners=PLAINTEXT://192.168.0.239:9093
advertised.listeners=PLAINTEXT://192.168.0.239:9093
log.dirs=/tmp/kafka-logs-1
config/server-2.properties:
broker.id=2
listeners=PLAINTEXT://192.168.0.239:9094
advertised.listeners=PLAINTEXT://192.168.0.239:9092
log.dirs=/tmp/kafka-logs-2
bin/kafka-topics.sh --create --zookeeper 192.168.0.239:2181 --replication-factor 3 --partitions 16 --topic my-replicated-topic
相关参考资料: