环境设计:两台服务器demo1,demo2 通过docker-swarm 实现分布式部署。
| meta | storag | graph
demo1 | meta0 | storag0 | graph
demo2 | meta1 | storage1 | ----
demo2 | meta2 | storage2 | ----
yml 文件
version: '3.6'
services:
metad0:
image: vesoft/nebula-metad:nightly
env_file:
- ./nebula.env
command:
- --meta_server_addrs=120.46.147.1:9559,120.46.219.2:9559,120.46.219.2:9558
- --local_ip=120.46.147.1
- --ws_ip=120.46.147.1
- --port=9559
- --data_path=/data/meta
- --log_dir=/logs
- --v=0
- --minloglevel=2
healthcheck:
test: ["CMD", "curl", "-f", "http://120.46.147.1:19559/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
ports:
- "19559:19559"
- "19560:19560"
- "9559:9559"
volumes:
- /data/nebula/meta0:/usr/local/nebula/data
- /data/nebula/meta0/logs:/usr/local/nebula/logs
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.hostname == demo1
networks:
- nebula-net
metad1:
image: vesoft/nebula-metad:nightly
env_file:
- ./nebula.env
command:
- --meta_server_addrs=120.46.147.1:9559,120.46.219.2:9559,120.46.219.2:9558
- --local_ip=120.46.219.2
- --ws_ip=120.46.219.2
- --port=9559
- --data_path=/data/meta
- --log_dir=/logs
- --v=0
- --minloglevel=2
healthcheck:
test: ["CMD", "curl", "-f", "http://120.46.219.2:19559/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
ports:
- "19559:19559"
- "19560:19560"
- "9559:9559"
volumes:
- /data/nebula/meta1:/usr/local/nebula/data
- /data/nebula/meta1/logs:/usr/local/nebula/logs
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.hostname == demo2
networks:
- nebula-net
metad2:
image: vesoft/nebula-metad:nightly
env_file:
- ./nebula.env
command:
- --meta_server_addrs=120.46.147.1:9559,120.46.219.2:9559,120.46.219.2:9558
- --local_ip=120.46.219.2
- --ws_ip=120.46.219.2
- --port=9558
- --data_path=/data/meta
- --log_dir=/logs
- --v=0
- --minloglevel=2
healthcheck:
test: ["CMD", "curl", "-f", "http://120.46.219.2:19558/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
ports:
- "19558:19559"
- "19561:19560"
- "9558:9559"
volumes:
- /data/nebula/meta2:/usr/local/nebula/data
- /data/nebula/meta2/logs:/usr/local/nebula/logs
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.hostname == demo2
networks:
- nebula-net
storaged0:
image: vesoft/nebula-storaged:nightly
env_file:
- ./nebula.env
command:
- --meta_server_addrs=120.46.147.1:9559,120.46.219.2:9559,120.46.219.2:9558
- --local_ip=120.46.147.1
- --ws_ip=120.46.147.1
- --port=9779
- --data_path=/data/storage
- --log_dir=/logs
- --v=0
- --minloglevel=2
healthcheck:
test: ["CMD", "curl", "-f", "http://120.46.147.1:19779/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
ports:
- "9779:9779"
- "19779:19779"
- "19780:19780"
volumes:
- data-storaged0:/data/storage
- logs-storaged0:/logs
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.hostname == demo1
depends_on:
- metad0
- metad1
- metad2
networks:
- nebula-net
storaged1:
image: vesoft/nebula-storaged:nightly
env_file:
- ./nebula.env
command:
- --meta_server_addrs=120.46.147.1:9559,120.46.219.2:9559,120.46.219.2:9558
- --local_ip=120.46.219.2
- --ws_ip=120.46.219.2
- --port=9779
- --data_path=/data/storage
- --log_dir=/logs
- --v=0
- --minloglevel=2
healthcheck:
test: ["CMD", "curl", "-f", "http://120.46.219.2:19779/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
ports:
- "9779:9779"
- "19779:19779"
- "19780:19780"
volumes:
- data-storaged1:/data/storage
- logs-storaged1:/logs
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.hostname == demo2
depends_on:
- metad0
- metad1
- metad2
networks:
- nebula-net
storaged2:
image: vesoft/nebula-storaged:nightly
env_file:
- ./nebula.env
command:
- --meta_server_addrs=120.46.147.1:9559,120.46.219.2:9559,120.46.219.2:9558
- --local_ip=120.46.219.2
- --ws_ip=120.46.219.2
- --port=9778
- --data_path=/data/storage
- --log_dir=/logs
- --v=0
- --minloglevel=2
healthcheck:
test: ["CMD", "curl", "-f", "http://120.46.219.2:19778/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
ports:
- "9778:9779"
- "19778:19779"
- "19781:19780"
volumes:
- data-storaged2:/data/storage
- logs-storaged2:/logs
depends_on:
- metad0
- metad1
- metad2
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.hostname == demo2
networks:
- nebula-net
graphd:
image: vesoft/nebula-graphd:nightly
env_file:
- ./nebula.env
command:
- --meta_server_addrs=120.46.147.1:9559,120.46.219.2:9559,120.46.219.2:9558
- --port=9669
- --ws_ip=120.46.147.1
- --log_dir=/logs
- --v=0
- --minloglevel=2
healthcheck:
test: ["CMD", "curl", "-f", "http://120.46.147.1:19669/status"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
ports:
- "9669:9669"
- "19669:19669"
- "19670:19670"
volumes:
- logs-graphd:/logs
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.hostname == demo1
depends_on:
- metad0
- metad1
- metad2
networks:
- nebula-net
networks:
nebula-net:
external: true
attachable: true
name: host
执行完后报错:
meta0 和meta1 的端口冲突
yml 保留 meta0 ,graphd ,storaged0改为单个服务器启动时,容器一直处于创建中——失败——创建的状态
用swarm实现分布式不同服务器部署, yml文件有什么问题吗?