swarm 学习记录

一、manager节点 初始化swarm

docker@debian:~$ sudo docker swarm init --advertise-addr 22.48.3.151
Swarm initialized: current node (x5yd6w392ybu5ovd5kxrh4yqm) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-5wq10756jcte4us6l44lorjdqk3el8enzz64ggfu7qgzp7pmxh-7td4egknzpsmsleabzv8680v9 22.48.3.151:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

docker@debian:~$ 

二、manager节点 查看token

docker@debian:~$ sudo docker swarm join-token worker
To add a worker to this swarm, run the following command:

    docker swarm join --token SWMTKN-1-5wq10756jcte4us6l44lorjdqk3el8enzz64ggfu7qgzp7pmxh-7td4egknzpsmsleabzv8680v9 22.48.3.151:2377

docker@debian:~$ 

三、node节点 加入swarm

docker@debian:~$ sudo docker swarm join --token SWMTKN-1-5wq10756jcte4us6l44lorjdqk3el8enzz64ggfu7qgzp7pmxh-7td4egknzpsmsleabzv8680v9 22.48.3.151:2377
This node joined a swarm as a worker.
docker@debian:~$ docker info
Client:
 Debug Mode: false

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 19.03.13
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: k270nph1bi0akzn2az5yp6lrb
  Is Manager: false
  Node Address: 22.48.3.152
  Manager Addresses:
   22.48.3.151:2377
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.19.0-11-amd64
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 5.46GiB
 Name: debian
 ID: V7H3:GVPY:AJBT:KGFJ:ODZT:XO67:SNYK:WRAJ:N3DW:PJNR:JSJN:6QNT
 Docker Root Dir: /home/dockerdata
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.1:5000
  127.0.0.0/8
 Registry Mirrors:
  http://hub-mirror.c.163.com/
 Live Restore Enabled: false
 Product License: Community Engine

WARNING: No swap limit support

四、manager节点查看状态

docker@debian:~$ docker info
Client:
 Debug Mode: false

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 19.03.13
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: x5yd6w392ybu5ovd5kxrh4yqm
  Is Manager: true
  ClusterID: rnr28qthc010xo5khhzk2i3n3
  Managers: 1
  Nodes: 2
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 22.48.3.151
  Manager Addresses:
   22.48.3.151:2377
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.19.0-11-amd64
 Operating System: Debian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 5.46GiB
 Name: debian
 ID: V7H3:GVPY:AJBT:KGFJ:ODZT:XO67:SNYK:WRAJ:N3DW:PJNR:JSJN:6QNT
 Docker Root Dir: /home/dockerdata
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.1:5000
  127.0.0.0/8
 Registry Mirrors:
  http://hub-mirror.c.163.com/
 Live Restore Enabled: false
 Product License: Community Engine

WARNING: No swap limit support
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。