Files
docker/kafka/Demo/MultiNodes/README.md
2025-11-01 21:18:29 +08:00

32 lines
1011 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 部署 kafka 集群
- 根据实际环境修改 docker-compose.yml
* CONF: 这里启动三个 controller 节点和两个 brocker 节点,可用于线上
* CLUSTER_ID: 这里要替换成完全一样的 uuid生成命令
```
docker run --rm harbor.boyachain.cn:20443/general/kafka:4.0 kafka-storage.sh random-uuid
```
* LEAD_CONTROLLER: 指定 bootstrap kraft 集群的节点 **controller 地址**bootstrap kraft 集群的**第一个节点不能设置该变量**broker 节点无需设置该变量
- 创建目录
```
grep '\<source:' docker-compose.yml | cut -d: -f2 | xargs mkdir -p
```
- 启动
```
docker-compose up -d
```
- 查看集群状态
```
docker exec kafka-controller2 kafka-metadata-quorum.sh \
--bootstrap-controller 127.10.11.3:9093 \
describe --status
docker exec kafka-broker2 kafka-metadata-quorum.sh \
--bootstrap-controller 127.10.11.2:9093 \
describe --replication
```