I'm having difficulty setting up a Docker Swarm with two workers and one manager. Everything works fine until I add the second worker. After adding the second worker, the first worker's daemon enters some sort of error state where a simple docker version
yields
Also, I am using a Stack YAML to start three Redis services.
Stack.yaml
version: '3.4'
services:
redis-master:
image: 'bitnami/redis:5.0.2'
ports:
- '6379:6379'
environment:
- REDIS_REPLICATION_MODE=master
- REDIS_PASSWORD=f7paul12-d571-4701-9c55-64vanacecDyK
deploy:
mode: global
restart_policy:
condition: any
volumes:
- 'redis:/opt/bitnami/redis/etc/'
redis-replica:
image: 'bitnami/redis:5.0.2'
ports:
- '6379'
depends_on:
- redis-master
environment:
- REDIS_REPLICATION_MODE=slave
- REDIS_MASTER_HOST=redis-master
- REDIS_MASTER_PORT_NUMBER=6379
- REDIS_MASTER_PASSWORD=f7paul12-d571-4701-9c55-64vanacecDyK
- REDIS_PASSWORD=f7paul12-d571-4701-9c55-64vanacecDyK
deploy:
mode: replicated
replicas: 6
update_config:
parallelism: 1
delay: 20s
restart_policy:
condition: any
redis-sentinel:
image: 'bitnami/redis:5.0.2'
ports:
- '16379'
depends_on:
- redis-master
- redis-replica
entrypoint: |
bash -c 'bash -s <<EOF
"/bin/bash" -c "cat <<EOF > /opt/bitnami/redis/etc/sentinel.conf
port 16379
dir /tmp
sentinel monitor master-node redis-master 6379 2
sentinel down-after-milliseconds master-node 5000
sentinel parallel-syncs master-node 1
sentinel failover-timeout master-node 5000
sentinel auth-pass master-node f7paul12-d571-4701-9c55-64vanacecDyK
sentinel announce-ip redis-sentinel
sentinel announce-port 16379
EOF"
"/bin/bash" -c "redis-sentinel /opt/bitnami/redis/etc/sentinel.conf"
EOF'
deploy:
mode: global
restart_policy:
condition: any
volumes:
redis:
driver: external
driver_opts:
type: 'none'
o: 'bind'
device: '/c/redis/'
I am running Docker CE 18.09.0 on Windows Server 2016 (the EE had the same problem) Also, all of my worker nodes are on the Windows platform, using Linux containers. (My manager node is the same, but uses Windows containers because of issue #3031)
Is setting up a mutinode swarm even supported in exclusive Windows environments? How can this cluster be set up using the environment listed above?
To promote a node or set of nodes, run docker node promote from a manager node: $ docker node promote node-3 node-2 Node node-3 promoted to a manager in the swarm.
Join as a worker node Run the command from the output on the worker to join the swarm: $ docker swarm join \ --token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \ 192.168. 99.100:2377 This node joined a swarm as a worker.
Manager nodes elect a single leader to conduct orchestration tasks. Worker nodes receive and execute tasks dispatched from manager nodes. By default manager nodes also run services as worker nodes, but you can configure them to run manager tasks exclusively and be manager-only nodes.
Docker recommends a maximum of seven manager nodes for a swarm. Important Note: Adding more managers does NOT mean increased scalability or higher performance.
Swarm is supported on windows but you shouldn't be using docker ce and linux containers on windows server. Docker ce for windows uses hyperv linux virtual machine and win server 2016 had a lot of issuses with hyperv networking.
I was also trying win server 2016 with docker ee in swarm but due to multiple limitations I abandoned that idea until newer version of windows server come along.
You should try either windows server that is abover 1803 where Microsoft finally allowed exposing ports to host. Therefore I'd recommend for you using windows server core 1803 or 1809, or using windows server 2019 (which is 1809)
And switch to windows containers on windows. For linux containers use linux host. Will save you a lot of headaches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With