【中间件】通过 docker-compose 快速部署 Zookeeper 保姆级教程
version: '3'
services:
zookeeper:
image: zookeeper:3.5
container_name: zookeeper
ports:
- "2181:2181"
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=zookeeper:2888:3888
restart: always
这段代码使用了Docker Compose来定义和启动一个Zookeeper服务。它设置了Zookeeper的端口,环境变量,以及容器名称。ZOO_MY_ID
环境变量用于设置Zookeeper节点的ID,ZOO_SERVERS
环境变量定义了Zookeeper集群的配置。restart: always
确保容器在停止后自动重启。
评论已关闭