Hi,
I am trying to create mysql cluster using docker swarm. I have 3 host servers and I want on each one of them to run only one docker mysql container. I was following the guide from here:
I followed the steps from the tutorial above and I have done this so far:
-
Installed and configured etcd on each host and its cluster health is ok
-
Installed docker on each servers and service is started
-
On one of the nodes initiated swarm mode and joined the other 2 nodes to the swarm. docker node ls shows all nodes and their state is ok
-
Created overlay network
-
Created 2 directories on each node that will be mounted to docker containers for permanent storage solution:
/etc/docker-configs/mysql-config
/var/lib/mysql -
I try to create a service
docker service create
–detach=false
–name mysql-cluster
–replicas 3
–network my-net
–mount type=bind,src=/var/lib/mysql,dst=/var/lib/mysql
–mount type=bind,src=/etc/docker-configs/mysql-config,dst=/etc/my.cnf.d
–secret mysql_root_password
–env MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
–env DISCOVERY_SERVICE=xxx.xxx.xxx.xxx:2379,xxx.xxx.xxx.xxx:2379,xxx.xxx.xxx.xxx:2379
–env XTRABACKUP_PASSWORD_FILE=/run/secrets/mysql_root_password
–env CLUSTER_NAME=pxc
perconalab/percona-xtradb-cluster:5.7
Now here problems happen. When i run the service create command all 3 containers never start and I get following errors in logs:
Jul 19 10:12:37 bs1 dockerd[15147]: time=“2017-07-19T10:12:37.740949992+02:00” level=error msg=“fatal task error” error=“task: non-zero exit (1)” module=“node/agent/taskmanager” node.id=pg5nwd5ws0eq38te3f0t1o27a service.id=ib6osl3b8k8hsh59p8i7irk77 task.id=ygee5jvdqtwq6sx20rt2rkgif
This problem happens even if i don’t use mount options and use ephemeral storage.
Can you give me some advice how to solve this problem? I need to have permanent storage for each container on each host to have a healthy and good working cluster.
Thank you in advance!
Best regards,
Ali Nebi