Creating a MySQL cluster, using mysql-server docker containers, on multiple servers

I’m trying to create an MySQL cluster of 3 nodes using mysql-server docker containers.

I have 3 separate cloud instances and docker is setup on all 3 of them. Each server will have only 1 container running on it – to achieve High Availability when in cluster.

I start the containers on all 3 servers, individually, with the command

docker run --name=db -p 3301:3306 -v db:/var/lib/mysql -d mysql/mysql-server 

I’m mapping the port 3306 of container to my server’s 3301 port. I’ve also created a new user ‘clusteradmin’ for remote access.

Next, from mysql-shell, I ran following command – for all 3 servers


I get similar message for all- enter image description here

Note that it says ‘This instance reports its own address as 39xxxxxxxxxx:3306’.

Next I create a cluster in one of the server successfully. But, when adding the other 2 servers to this cluster, I’m getting the following error

enter image description here

On checking the logs for that particular server, I see the following lines

enter image description here

It says ‘peer address a9yyyyyyyyyy:33061 is not valid’. This is because, since the containers are running on different servers, the container-id is not recognised by other containers on other server.

I tried many options but to no avail. One method was to use report-host and report-port options when starting the container, like so

docker run --name=db2 -p 3301:3306 -v db2:/var/lib/mysql -d mysql/mysql-server --report-host= --report-port=3301 

But, the issue with this approch is that, during dba.configureInstance(), it wants to update the port to default value and throws error like so

enter image description here

Anybody who has managed to create such a cluster of mysql-server containers running on different servers, I would really appreciate pointers in this regard.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.