kafka_example_01

1 安装 brew

https://www.jianshu.com/p/2b209d74139c

安装目录:

/usr/local/Cellar/kafka/1.1.0

2 运行

修改:1.app登录成功返回ErrorCode,2.不需要返回用户权限菜单

3.启动zookeeper

执行命令: zkServer start

4. 以server.properties的配置,启动kafka

在kafka的bin目录下:

执行命令:./kafka-server-start /usr/local/etc/kafka/server.properties

kafka命令:

https://blog.csdn.net/isea533/article/details/73720066

1 启动produce并输入:

./kafka-console-producer --broker-list localhost:9092 --topic pos_topic

./kafka-console-producer --broker-list localhost:9092 --topic voucher

输入: {"posCode":"84568498","posStatus":1,"lastLoginDate":"2018-06-01 15:30:17","lastLoginUser":"082713700","updateUser":"082713700","updateDate":"2018-06-01 15:30:17"}

注意: --bootstrap-server 必须指定,通常--topic也要指定查看的主题。如果想要从头查看消息,还可以指定--from-beginning参数。一般使用的命令如下。

2 启动cosumer显示所有producer的输入:

./kafka-console-consumer --bootstrap-server localhost:9092 --topic pos_topic

./kafka-console-consumer --bootstrap-server localhost:9092 --topic voucher

注意:其中 --broker-list 和 --topic 是两个必须提供的参数。

3 主题的配置

kafka-configs --zookeeper localhost:2181 --describe --entity-type topics --entity-name pos_topic

4 列出所有主题

kafka-topics --list --zookeeper localhost:2181

5 主题配置

kafka-topics --describe --zookeeper localhost:2181 --topic pos_topic

你可能感兴趣的:(kafka_example_01)