企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## hue on swarm 定稿人 | 定稿日期 | 系统环境 | :--------: | :-----: | :----: | 黄镇游 | 2017.12.19 | centos7 + docker1.13 + docker-compose1.16 #### docker-compose.yml文件 ```yaml version: '3.1' services: zoo1: image: zookeeper restart: always hostname: zoo1 networks: - frontend ports: - 2181:2181 environment: ZOO_MY_ID: 1 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 zoo2: image: zookeeper restart: always hostname: zoo2 networks: - frontend ports: - 2182:2181 environment: ZOO_MY_ID: 2 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 zoo3: image: zookeeper restart: always hostname: zoo3 networks: - frontend ports: - 2183:2181 environment: ZOO_MY_ID: 3 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 networks: frontend: ``` #### 部署在swarm > hue部署在多机swarm(所有关联的容器服务需要用同一个voerlay网络,才能利用服务发现机制) 1. 启动服务 ```powershell # 前期准备工作-swarm集群创建参考【Swarm入门】 # 启动Zookeeper集群 $ docker stack deploy -c docker-compose.yml lyc Ignoring unsupported options: restart Creating service lyc_zoo1 Creating service lyc_zoo2 Creating service lyc_zoo3 # 查看服务 $ docker service ls ID NAME MODE REPLICAS IMAGE PORTS l4wvm7ykxi81 lyc_zoo2 replicated 1/1 zookeeper:latest *:2182->2181/tcp n2a9ysh35i7p lyc_zoo1 replicated 1/1 zookeeper:latest *:2181->2181/tcp qw9jx0o72x4w lyc_zoo3 replicated 1/1 zookeeper:latest *:2183->2181/tcp ```