Kafka(新版本)安装超简单 | 您所在的位置:网站首页 › kafka下载安装 › Kafka(新版本)安装超简单 |
此文章你会获得什么? 1.安装kafka(新版本不依赖zookeeper) 2.配置kafka 3.使用kafka发消息 这是知乎1、下载mac 直接brew下载就可以了, 新版的kafka,不需要依赖keep brew install kafka下载遇到的坑1.无法下载,切换brew 国内源 清华源: # 替换brew.git cd "$(brew --repo)" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git # 替换homebrew-core.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git # 刷新源 brew update2、无法下载,切换brew 国内源 2、配置打开配置文件sudo vim /opt/homebrew/opt/kafka/bin/kafka-server-start /opt/homebrew/etc/kafka/server.properties 配置监听端口本地使用: listeners=PLAINTEXT://:9092 指定IP: listeners=PLAINTEXT://xx.xx.xx.xx:9092 简单的消息测试启动服务brew services start kafkakafka可以理解为一个公众号的功能,服务端发布消息,订阅者可以收到发布的最新消息。 发布主题新版本启动器: --bootstrap-server 发送的端口: localhost:9092 发布主题: test1 kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test1重复上面命令,修改发布主题,就可以发布不同的主题了。 查看发布主题❯ kafka-topics --list --bootstrap-server localhost:9092 __consumer_offsets ning test这里发布了两个主题: ning test 订阅绑定的端口: localhost:9092 主题: test1 kafka-console-consumer --bootstrap-server localhost:9092 --topic test1 --from-beginning 测试图 |
CopyRight 2018-2019 实验室设备网 版权所有 |