启动zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties启动kafka server
bin/kafka-server-start.sh config/server.properties创建topic
bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 1 --partition 1 --topic testlist
bin/kafka-list-topic.sh --zookeeper localhost:2181producer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testcomsumer
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning多个brocker 整目录拷贝多份就可以了
cp config/server.properties config/server-1.properties cp config/server.properties config/server-1.properties新的配置
config/server-1.properties: broker.id=1 port=9093 log.dir=/tmp/kafka-logs-1 config/server-2.properties: broker.id=2 port=9094 log.dir=/tmp/kafka-logs-2启动
JMX_PORT=9997 bin/kafka-server-start.sh config/server-1.properties & JMX_PORT=9998 bin/kafka-server-start.sh config/server-2.properties &创建topic
bin/kafka-create-topic.sh --zookeeper localhost:2181 --replica 3 --partition 1 --topic my-replicated-topiclist
bin/kafka-list-topic.sh --zookeeper localhost:2181publish
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my-replicated-topiccomsumer
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic my-replicated-topic pkill -9 -f server-1.properties