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 10.0.0.8 -p 5432:5432 -p 28080:28080 gp

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

and then only need to initialize GP

./start.sh

# in the mdw container! /bin/sh Gpssh-exkeys -f ./all_segs Gpinitsystem -c gpconfigs/gpinitsystem_config -h ./all_segs -a Echo "host all all 172.18.0.1/24 md5">>/gpmaster/gpseg-1/pg_hba.conf #ip address is the gateway address of the current container Echo "host all all 10.0.75.1/24 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.sh > 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

nodeavailability

  • 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]

键名

Service 

  • 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 ()