Contents

Kafka Notes

Contents
# 创建topic
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

# 查看topic列表
bin/kafka-topics.sh --list --zookeeper zookeeper:2181

# 测试
# 5000000条消息
# 每秒发送的消息数,-1 不限流
# 消息的大小1000字节
bin/kafka-producer-perf-test.sh --topic test --num-records 5000000 --throughput -1 --record-size 1000 --producer-props bootstrap.servers=node1:9092,node2:9093,node3:9094 acks=1 batch.size=16384 linger.ms=0

# 每次拉取数据的大小 1048576 字节
# 消费的消息总数 5000000
bin/kafka-consumer-perf-test.sh --broker-list node1:9092,node2:9093,node3:9094 --topic test --fetch-size 1048576 --messages 5000000