kafka官网:
http://kafka.apache.org/documentation.html#producerconfigs
修改配置文件server.properties
# Hostname the broker will bind to. If not set, the server will bind to all interfaces
host.name=192.168.56.120
创建topic
[root@ELk kafka_2.10-0.8.2.2]# bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
Created topic "test"
显示topic
[root@ELk kafka_2.10-0.8.2.2]# bin/kafka-topics.sh --list --zookeeper localhost:2181
test
显示topic详细信息
[root@ELk kafka_2.10-0.8.2.2]# bin/kafka-topics.sh --describe --zookeeper 192.168.56.120:2181
Topic:test PartitionCount:1 ReplicationFactor:1 Configs:
Topic: test Partition: 0 Leader: 0 Replicas: 0 Isr: 0
启动zooper
[root@ELk bin]#./kafka-console-producer.sh --broker-list 192.168.56.120:9092 --top test
启动kafka
[root@ELk bin]# ./zookeeper-server-start.sh ../config/zookeeper.properties
发送消息
[root@ELk bin]# ./kafka-console-producer.sh --broker-list 192.168.56.120:9092 --topic test
[2015-10-27 18:07:01,747] WARN Property topic is not valid (kafka.utils.VerifiableProperties)
1111111
2222222
接受消息
[root@ELk bin]# ./kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
1111111
2222222
阅读(1984) | 评论(0) | 转发(0) |