docker swarm mysql service, when scaled not working

taragrg6 profile image taragurung ・1 min read

I simply created one swarm node (master). Wrote a docker-compose with multiple service one of them is mysql. Now, when I scale mysql container I get connection issue. The mysql has a volume defines as

  - ./mysql:/var/lib/mysql


Editor guide
bluma profile image
Roman Diviš

Mysql is not a nosql db with their “easy” scaling out... You cannot run multiple instances on one data folder, this wound’t work - locking, caching and data consistency cannot be maintaned that way. Mysql uses classic master/slave replication process and it is not that simple. You need to explicitly configure this and then writes to master are automatically mirrored to slaves. There are currently more modes of replications. Use google and look for terms like mysql replication