Kafka 部分参数说明
(1)max.in.flight.requests.per.connection
Kafka 可以保证同一个分区里的消息是有序的。也就是说,如果生产者按照一定的顺序发送消息,broker 就会按照这个顺序把它们写入分区,消费者也会按照同样的顺序读取它们。
参考链接:https://blog.csdn.net/u011669700/article/details/80000744
一、 mac kafka安装简单使用
原文链接:https://blog.csdn.net/weixin_42357472/article/details/105044441
1.采用homebrew的方式
终端执行命令:brew install kafka
2.修改Kafka服务配置文件server.properties
执行命令: vi /usr/local/etc/kafka/server.properties
解除注释:listeners=PLAINTEXT://localhost:9092(如无该内容则增加,ip地址需要注意以后可能也需要外部访问进行更改)
3.启动zookeeper 服务
执行命令:zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties &
4.启动Kafka服务
执行命令:kafka-server-start /usr/local/etc/kafka/server.properties &
可参考此博客安装homebrew:https://blog.csdn.net/txl910514/article/details/105880125
==> zookeeper
To have launchd start zookeeper now and restart at login:
brew services start zookeeper
Or, if you don't want/need a background service you can just run:
zkServer start
==> kafka
To have launchd start kafka now and restart at login:
brew services start kafka
Or, if you don't want/need a background service you can just run:
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties & kafka-server-start /usr/local/etc/kafka/server.properties
5.创建topic
执行命令(新开终端):kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic hello
查看已有主题list: kafka-topics --list --bootstrap-server localhost:9092
6.创建生产者(输入内容生产消息由消费者获取)
执行命令(新开终端):kafka-console-producer --topic hello --broker-list localhost:9092
7.创建消费者(读取生产者生产的消息内容)
执行命令(新开终端):kafka-console-consumer --bootstrap-server localhost:9092 -topic hello
MAC搭建kafka客户端遇见的问题
(1) kafka列举所有topic抛异常:解决Exception in thread “main“ joptsimple.UnrecognizedOptionException