docker-mysql-master-slave
docker-mysql-master-slave copied to clipboard
mysql5.7
Hi, I had a situation. Printf Error logs when run build.sh.
Creating mysql_master ... done Creating mysql_slave ... done ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Waiting for mysql_master database connection... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Thanks for your help.
Hi, @andyge2014. Just wanted to know if you waited for a while, as it takes some time for the master node to start and the slave node to connect to the master node.
While the master is starting it could be possible the slave node has started and tries connecting to the master node, printing the above error.
I strongly suggest you wait for a while as it may take some time for the containers to get started based on the system configuration. As from the below screenshot, it took me around 1-2 min for the service to start on an Intel I5 - 5th Gen with HDD.
I have added a health check in PR #7 for the master node and updated the slave to start only after the master node is healthy, which would eliminate the above error.