
Fabian Tech Tips

Firewall rules for MariaDB replication.
Oct 13, 2024
1 min read
0
5
0
For mariadb replication to work, firewall ports need to be open on the primary
and secondary server.
Three required steps
Configuration
Testing ports are open
Testing communication between servers
Configuring Ports on Primary and Secondary Servers
Open Ports on Primary Server:
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --zone=public --add-port=4567/tcp --permanent
sudo firewall-cmd --reload
Open Ports on Secondary Server:
sudo firewall-cmd --zone=public --add-port=3306/tcp --permanent
sudo firewall-cmd --zone=public --add-port=4567/tcp --permanent
sudo firewall-cmd --reload
Testing if Ports are Open
Check Port 3306:
nc -zv <server-ip> 3306
Check Port 4567:
nc -zv <server-ip> 4567
Replace <server-ip> with the actual IP address of your primary or secondary server. You should see a message indicating a successful connection if the ports are open.
Testing Communication Between Primary and Secondary Servers
From Primary Server to Secondary Server:
nc -zv <secondary-server-ip> 3306
nc -zv <secondary-server-ip> 4567
From Secondary Server to Primary Server:
nc -zv <primary-server-ip> 3306
nc -zv <primary-server-ip> 4567
Ensure that both servers can communicate with each other on the specified ports. If the connection is successful, it indicates that the ports are correctly configured and open for replication.