Galera - why can't I use port 4567 for replication?
Question
I have two Galera
clusters in two different datacenters.
I want to replicate cluster c1
(using c1-1
node as replication master) to cluster c2
(using c2-1
node as replication slave). Everything works well if I use port 3306
on c2-1
for MASTER_PORT
instead of the default port for replication 4567
.
If I switch from port 3306
to 4567
for MASTER_PORT
I get this error when I run SHOW SLAVE STATUS\G
on c2-1
:
Last_IO_Errno: 2013
Last_IO_Error: error connecting to master 'repl@x.x.x.x:4567' - retry-time: 60 maximum-retries: 86400 message: Lost connection to server at 'reading initial communication packet', system error: 0 "Internal error/check (Not system error)"
This is what I get when I run lsof -i:3306
on c1-1
:
root@c1-1:~# lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mariadbd 1402 mysql 31u IPv4 25689 0t0 TCP *:mysql (LISTEN)
And this is what i get when i run lsof -i:4567
on c1-1
(same node):
root@c1-1:~# lsof -i:4567
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mariadbd 1402 mysql 8u IPv4 25683 0t0 TCP *:4567 (LISTEN)
Also I allowed all traffic (using ufw
) on all those ports.
If I run netcat x.x.x.x 3306
(x.x.x.x
being c1-1
's ip) on c2-1
I get this:
root@c2-1:~# netcat x.x.x.x 3306
q
5.5.5-10.5.9-MariaDB-1:10.5.9+maria~focal-log,)XbbFt8Z��-��:Srf(
And if I run netcat x.x.x.x 4567
(x.x.x.x
being c1-1
's ip) on `c2-1 I get this:
root@c2-1:~# netcat x.x.x.x 4567
$�-��\�цI�-Vk8�$
Why can't I use port 4567
? Is it not using the right socket? If so what can be done?
Thank you!
Solution
4567
is the default Galera Replication Port for replication between nodes within a Galera cluster. That is not what you want to use here - you are doing primary-secondary replication (master-slave).
3306
is the default TCP/IP port you want to use for primary-secondary (master-slave) replication.