赞
踩
- # -daemon 表示后台进行
- # config/server.properties 指定配置文件
- kafka-server-start.sh -daemon config/server.properties
- # replication-factor 2 表示复制两份
- # partitions 3 topic 的分区三个
- kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2 --partitions 3 --topic kafka-action
kafka-topics.sh --alter --zookeeper localhost:2181 --topic kafka-action --partitions 5
- # property key.separator=' ' 属性配置
- kafka-console-producer.sh --broker-list localhost:9092 --topic kafka-action --property parse.key=true --property key.separator=' '
- # -time -1 最大的偏移量
- kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic kafka-action -time -1
DumpLogSegment 这个类是可以读取 Kafka Log 的二进制的内容
- kafka-run-class.sh kafka.tools.DumpLogSegments --files /tmp/kafka-logs/kafka-action-2/00000000000000000000.log
- # 结果
- Dumping /tmp/kafka-logs/kafka-action-2/00000000000000000000.log
- Starting offset: 6
- # num-records 消息记录数
- # record-size 消息大小
- # throughput 每秒消息数
- kafka-producer-perf-test.sh --num-records 100000 --record-size 1000 --topic kafka-action --throughput 100000 --producer-props bootstrap.servers=localhost:9092 acks=all
- # 结果
- 100000 records sent, 37243.947858 records/sec (35.52 MB/sec), 527.35 ms avg latency, 914.00 ms max latency, 465 ms 50th, 896 ms 95th, 904 ms 99th, 913 ms 99.9th.
kafka-console-consumer.sh --bootstrap-server localhost:9092 --new-consumer --consumer-property group.id=new-consumer-test --consumer-property client.id=new-consumer-c1 --topic kafka-action
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。