I have 3 node in docker swarm mode where.
1 Manager and 2 Worker nodes
I got a 2 doubts here ?
What will be the effect if I scale the service to number greater than nodes we have. (Suppose scaling one service to 5 or 6)
What will happen to the scale if the service has a constraint that it must be running on the manager nodes only and we scale the number higher than number of manager nodes .(For example scaling to 3)
I have mysql service running in manager node which have a constraint placement defined in docker-compose to run in manager node. This is the effect I see when I try to scale it to 6 though I have only 3 nodes. The docker service logs
shows 4/6 running and is even fluctuation sometime showing 6/6 and sometime 5/6
Here the docker-compose.yml
version: '3.4'
networks:
smstake:
ipam:
config:
- subnet: 10.0.10.0/24
services:
db:
image: mysql:5.7
networks:
- smstake
ports:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: mydb
MYSQL_USER: myuser
MYSQL_PASSWORD: password
volumes:
- mysql_data_2:/var/lib/mysql
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
app:
image: SMSTAKE_VERSION
ports:
- 8000:80
networks:
- smstake
depends_on:
- db
# - migration
deploy:
mode: replicated
replicas: 3
migration:
# build: .
image: SMSTAKE_VERSION
command: sh -xc "sleep 10 && pwd && php artisan migrate:fresh --seed 2>&1"
networks:
- smstake
depends_on:
- app
- db
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.role == manager
volumes:
mysql_data_2: