1.启动zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties
2.启动kafka
bin/kafka-server-start.sh config/server.properties
3.创建topic
bin/kafka-topics.sh \
--create \
--zookeeper localhost:2181 \
--replication-factor 1 \
--partitions 1 \
--topic gang_gang_topic
4.查看所有topic
bin/kafka-topics.sh \
--list \
--zookeeper localhost:2181
5.启动生产者
bin/kafka-console-producer.sh \
--broker-list localhost:9092 \
--topic gang_gang_topic
6.启动消费者
bin/kafka-console-consumer.sh \
--zookeeper localhost:2181 \
--topic gang_gang_topic
7.partition
bin/kafka-topics.sh \
--zookeeper localhost:2181 \
--alter \
--topic gang_gang_topic \
--partitions 3
8.test
bin/kafka-producer-perf-test.sh \
--producer.config config/producer-test.properties \
--topic gnus-test \
--throughput 2000000 \
--num-records 6000000 \
--payload-file message.txt
bin/kafka-producer-perf-test.sh
--producer.config config/producer-test2.properties \
--topic gnus-test \
--throughput 2000000 \
--num-records 6000000 \
--payload-file message.txt