• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue Docker with MySQL blocks communication

L. Hagen

Basic Pleskian
Server operating system version
Ubuntu 22.04
Plesk version and microupdate number
Obsidian v18
For a few days I’ve been struggling with a MySQL + Docker + ClusterIP (floating IP or virtual IP) 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 (latest image from the hub) in a Docker container. These databases are synchronized with a replication (master->slave or master-master). That’s the idea…

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 1.1.1.1 (which is the primary server in the cluster) it works well this way.

Setup​

The docker is simply configured with this on IP 1.1.1.1 and host with IP 2.2.2.2
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
Now user `replication` is created via
CREATE USER 'replicator'@'%' IDENTIFIED BY 'replsecrep';
ALTER USER 'replicator'@'%' IDENTIFIED WITH mysql_native_password BY 'replsecrep';
GRANT REPLICATION SLAVE ON *.* TO 'replicator'@'%';
FLUSH PRIVILEGES;
Then I start the replication with
CHANGE MASTER TO
MASTER_HOST = '1.1.1.1',
MASTER_PORT = 33060,
MASTER_USER = 'replicator',
MASTER_PASSWORD = REPLPW;
START SLAVE;
The databases run and work wonderfully and can also be used with
mysql --host=1.1.1.1 --port=33060 -u replicator --password=REPLPW
mysql --host=2.2.2.2 --port=33060 -u replicator --password=REPLPW
from the other server. With
SHOW SLAVE STATUS\G;
I can see that the replication is started and running.

Problem​

Now I assign the ClusterIP to Plesk and restart my Docker containers. But as soon as I start the replication and display the status after 60sec always the error message
Last_IO_Error: error connecting to master '[email protected]:33060' - retry-time: 60 retries: 5 message: Can't connect to MySQL server on '1.1.1.1:33060' (110)
This only happens if both computers are running in the IP cluster. Unfortunately, I do not understand the cause and am urgently looking for a solution.

I’m really guessing that it has something to do with the Docker/Plesk, because a replication with the default installed MariaDB, which is also running on the servers, but outside the docker works fine.

There is also a thread in https://forums.docker.com/t/docker-mysql-replication-fails-with-connection-error-when-server-has-second-ip-address/132395 and a nice guy tried to help me. He has setup the configuration on Docker but not with Plesk and it was working. So it looks like that there is any communication problem with the Docker/Plesk. But what and how to resolve?

BTW: I have also tried to use other ports and have turned of my firewalls for testing purposes.
 
Back
Top