Mac使用brew搭建kafka集群
brew
🍺 The missing package manager for macOS (or Linux)
项目地址:https://gitcode.com/gh_mirrors/br/brew
免费下载资源
·
1. 第一步:单机搭建
单机搭建:
安装完后,默认自动安装对应版本zookeeper
brew install kafka
2.第二步:修改配置文件:
配置3个Kafka
第一个(使用默认配置)
vi /opt/homebrew/etc/kafka/server.properties
第二个
cp /opt/homebrew/etc/kafka/server.properties /opt/homebrew/etc/kafka/server-1.properties
第三个
cp /opt/homebrew/etc/kafka/server.properties /opt/homebrew/etc/kafka/server-2.properties
第二个和第三个修改配置文件
vi /opt/homebrew/etc/kafka/server-1.properties
broker.id=1
listeners=PLAINTEXT://:9093
log.dir=/tmp/kafka-logs-1
vi /opt/homebrew/etc/kafka/server-1.properties
broker.id=2
listeners=PLAINTEXT://:9094
log.dir=/tmp/kafka-logs-2
3.第三步:查看启动服务位置
brew list kafka
4.第四步:服务启动/关闭
启动kafka之前必须启动zookeeper,上面已查出👆(步骤3)。
先启动zookeeper
/opt/homebrew/Cellar/kafka/3.3.1_1/bin/zookeeper-server-start /opt/homebrew/etc/kafka/zookeeper.properties &
再启动kafka
/opt/homebrew/Cellar/kafka/3.3.1_1/bin/kafka-server-start /opt/homebrew/etc/kafka/server.properties &
/opt/homebrew/Cellar/kafka/3.3.1_1/bin/kafka-server-start /opt/homebrew/etc/kafka/server-1.properties &
/opt/homebrew/Cellar/kafka/3.3.1_1/bin/kafka-server-start /opt/homebrew/etc/kafka/server-2.properties &
关闭kafka
/opt/homebrew/Cellar/kafka/3.3.1_1bin/kafka-server-stop
关闭zookeeper
/opt/homebrew/Cellar/kafka/3.3.1_1/bin/zookeeper-server-stop
5.最后:查看启动
查看端口命令
lsof -i :9092
根据进程名查看进程信息
ps aux | grep zookeeper
不过有个问题,需要一直挂着终端,不然9093、9094端口自己会断掉。
GitHub 加速计划 / br / brew
19
1
下载
🍺 The missing package manager for macOS (or Linux)
最近提交(Master分支:2 个月前 )
90a90b30
4 个月前
47b1cab7
4 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)