Score:0

MySQL replication fails with connection error when server has second IP address

de flag

For a few days I've been struggling with a MySQL + Docker + ClusterIP problem. I'm trying to create a failover for my servers. If Server1 fails, Server2 should take over automatically. Both servers are running MySQL 8.0.31 in a Docker container. These databases are synchronized with a replication (master->slave or master-master).

That works quite well so far. The problem now comes when I assign the cluster IP address as the second IP address to the second server. On server1 it works well this way.

The databases run and work wonderfully and can also be used with

mysql --host=SERVER_IP_1 --port=33060 -u replicator --password=REPLPW
mysql --host=SERVER_IP_2 --port=33060 -u replicator --password=REPLPW

from the other server. But as soon as I start the replication and display the status with

SHOW SLAVE STATUS\G;

comes after 60sec always the error message

Last_IO_Error: error connecting to master 'replicator@SERVER2:33060' - 
retry-time: 60 retries: 5 message: Can't connect to MySQL server on 'SERVER2:33060' (110)

This only happens if both computers are running with the same cluster IP. Unfortunately, I do not understand the cause and am urgently looking for a solution.

I'm guessing that it has something to do with the docker, because a replication with MariaDB with is also running on the servers but outside the docker works fine.

The docker config looks like this:

docker run \
    --name dbname \
    -v /root/server-mgmt/mysql/mysql.cnf:/etc/my.cnf \
    -e MYSQL_ROOT_PASSWORD=ROOTPW \
    -e restart=unless-stopped \
    -p 33060:3306 \
    -p 33061:33060  \
    -d mysql:latest
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.