Docker swarm

cross-machine cluster requires docker version higher than 1.12 integrated docker swarm.

First enter the docker swarm mode: docker swarm init

and then create the overlay network: docker network create -d overlay --attachable mynet

join the swarm cluster from the node (the main section init swarm) Instructions)

Next we need to start a mdw master node on one machine, start a seg slave node on another machine

docker run -tid --name mdw--hostname mdw --network mynet --ip -p 5432:5432 -p 28080:28080 gp

docker run -tid --name seg --hostname seg --network mynet --ip  gp

and then only need to initialize GP


# in the mdw container! /bin/sh Gpssh-exkeys -f ./all_segs Gpinitsystem -c gpconfigs/gpinitsystem_config -h ./all_segs -a Echo "host all all md5">>/gpmaster/gpseg-1/pg_hba.conf #ip address is the gateway address of the current container Echo "host all all md5">>/gpmaster/gpseg-1/pg_hba.conf #ip is the ip gateway address of the host being accessed, #sed -i '/local all gpadmin ident/d' /gpmaster/gpseg-1/pg_hba.conf Sed -i '/local replication gpadmin ident/d' /gpmaster/gpseg-1/pg_hba.conf Echo "host gpperfmon gpmon ::1/128 md5">>/gpmaster/gpseg-1/pg_hba.conf Echo "gp_enable_gpperfmon=on">>/gpmaster/gpseg-1/postgresql.conf Echo "gpperfmon_port=8888">>/gpmaster/gpseg-1/postgresql.conf Echo "gp_external_enable_exec=on">>/gpmaster/gpseg-1/postgresql.conf Echo "gpperfmon_log_alert_level=warning">>/gpmaster/gpseg-1/postgresql.conf Gpperfmon_install --enable --password gpmon --port 5432 Psql -f 1.sql #Modify gpadmin password Gpstop -ar

nohup ./ > ex.log 2>&1 & #Initialize human-computer interaction during gpcc monitoring Wait Echo "Done"

gpcmdr --start gpcc #Start gpcc monitoring

### This file is used to start GP and gpcc monitoring


swarm Node:

  • Manager Node —— Responsible for scheduling Task
  • Worker Node —— Accept Manager NodeScheduled and assigned Task


  • Activetask
  • Pausetasktask
  • Draintasktask

# Manager node

docker swarm init --advertise-addr Managerip(ip)

# @@@ Accept join token, have

docker swarm join-token worker|manager

# worker node still run

docker swarm join --token : do not accept Manager, have ip:2377manager交交

# 团队建设

docker node ls

# Create a cluster @@@ @ node

docker node inspect self|NODE

# This machine only has one

docker node update --availability drain manager # , then you don't need to write Manager Node管理

# (decentralized design)

docker node update --label-add Join the cluster and become a working copy =token

# Node/ The node will list the commands after initialization, see screenshot above)

docker node promote View cluster node # Check the specified node manager node

docker node demote Node status change # 设置@@ @@只有管理功能worker node

# Node打标签

docker swarm node leave [--force]



  • replicatedNode提权
  • global降权

# service

docker service create --replicas --name @ @@ Node command

# 降级为

docker service update --update-parallelism Node Exit Cluster --update-delay 服务管理 --image contains two modes: : can specify the number of service resident nodes (default)

: The service resides on all nodes

# Deployed in the cluster

docker service ls

# Copy number

docker service ps 服务名称@@@ @镜名称

# 滚动更新更新

docker service inspect --pretty

# @update interval limit

docker service scale =


docker service rm


docker network create --driver overlay


docker service create --network --replicas --name command

docker service create  --help ()