Kafka试用记录



为了初步了解Kafka功能和性能,通过实验简单试用。

(1)kafka_2.9.1-0.8.2.1演示:
zookeeper server:
192.168.1.66:2181

kafka server:
192.168.1.66:9092

kafka consumer:
192.168.1.55


wget  http://mirror.bit.edu.cn/apache/kafka/0.8.2.1/kafka_2.9.1-0.8.2.1.tgz
tar xzvf kafka_2.9.1-0.8.2.1.tgz
cd kafka_2.9.1-0.8.2.1



前提zookeeper已经启动:
	在zookeeper的路径下执行:bin/zkServer.sh start

启动Kafka server:
$ bin/kafka-server-start.sh config/server.properties 


$ bin/kafka-topics.sh --create --zookeeper 192.168.1.66:2181 --replication-factor 1 --partitions 1 --topic test 
Created topic "test". 

$ bin/kafka-topics.sh --list --zookeeper 192.168.1.66:2181 
test




-------kafka producer:
host:192.168.1.66 

#consle演示
bin/kafka-console-producer.sh --broker-list 192.168.1.66:9092 --topic test 

#性能测试

bin/kafka-producer-perf-test.sh --topic test --batch-size=1000   --broker-list=192.168.1.66:9092  --message-size 100  --messages=1000000
start.time, end.time, compression, message.size, batch.size, total.data.sent.in.MB, MB.sec, total.data.sent.in.nMsg, nMsg.sec
2016-01-22 13:11:02:308, 2016-01-22 13:11:13:177, 0, 100, 1000, 95.37, 8.7743, 1000000, 92004.7842



-------kafka consumer:
host:192.168.1.55

#console演示
bin/kafka-console-consumer.sh --zookeeper 192.168.1.66:2181 --topic test --from-beginning

#性能测试
bin/kafka-consumer-perf-test.sh --topic test --message-size 100 --messages 1000000 --zookeeper 192.168.1.66:2181 --threads 1
start.time, end.time, fetch.size, data.consumed.in.MB, MB.sec, data.consumed.in.nMsg, nMsg.sec
2016-01-22 13:13:37:857, 2016-01-22 13:13:44:046, 1048576, 122.0698, 102.6660, 1000000, 841042.8932





(2)kafka_2.11-0.9.0.0演示
全部在localhost进行演示

wget http://mirror.bit.edu.cn/apache/kafka/0.9.0.0/kafka_2.11-0.9.0.0.tgz
tar xzvf kafka_2.11-0.9.0.0.tgz
cd kafka_2.11-0.9.0.0 
 
前提zookeeper已经启动:
	在zookeeper的路径下执行:bin/zkServer.sh start

启动Kafka server:
bin/kafka-server-start.sh config/server.properties 

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test 


#console演示
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 



#性能测试
bin/kafka-producer-perf-test.sh --topic test --num-records=400000 --record-size 128 --throughput 200000 --producer-props bootstrap.servers=localhost:9092

bin/kafka-producer-perf-test.sh --topic test --num-records=4000000 --record-size 128 --throughput 400000 --producer-props bootstrap.servers=localhost:9092 producer.type=sync compression.codec=none serializer.class=kafka.serializer.DefaultEncoder




#console演示
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

#性能测试(default: 10 threads)
bin/kafka-consumer-perf-test.sh --broker-list localhost:9092 --topic test --message-size 128 --messages 400000 --zookeeper localhost:2181

#性能测试(1 thread)
bin/kafka-consumer-perf-test.sh --broker-list localhost:9092 --topic test --message-size 128 --messages 4000000 --zookeeper localhost:2181 --threads 1

(3)参考
http://kafka.apache.org/documentation.html#quickstart



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值