Code in this video: How to Configure MariaDB Replication Master-Master on Ubuntu

Code in this video: How to Configure MariaDB Replication Master-Master on Ubuntu

📌 Note: Replace the orange-highlighted information with your own details.

✳️ on Master Server 1

bind-address 	= IP-of-Master-Server-1
server-id	= 101
report_host	= Hostname-of-Master-Server-1
log_bin		= /var/log/mysql/mariadb-bin
log_bin_index	= /var/log/mysql/mariadb-bin.index
relay_log	= /var/log/mysql/relay-bin
relay_log_index	= /var/log/mysql/relay-bin.index


	CREATE USER 'rep_user'@'%' IDENTIFIED BY 'Your-Passwd';


	GRANT REPLICATION SLAVE ON *.* TO 'rep_user'@'%';

        FLUSH PRIVILEGES;

CHANGE MASTER TO 
MASTER_HOST='IP-of-Master-Server-2', 
MASTER_USER='rep_user', 
MASTER_PASSWORD='Your-Passwd', 
MASTER_LOG_FILE='Log_file_of_Master-Server-2', 
MASTER_LOG_POS=Log_position_of_Master-Server-2;

✳️ on Master Server 2

bind-address 	= IP-of-Master-Server-2
server-id	= 102
report_host	= Hostname-of-Master-Server-2
log_bin		= /var/log/mysql/mariadb-bin
log_bin_index	= /var/log/mysql/mariadb-bin.index
relay_log	= /var/log/mysql/relay-bin
relay_log_index	= /var/log/mysql/relay-bin.index

	CREATE USER 'rep_user'@'%' IDENTIFIED BY 'Your-Passwd';

	GRANT REPLICATION SLAVE ON *.* TO 'rep_user'@'%';

        FLUSH PRIVILEGES;

CHANGE MASTER TO 
MASTER_HOST='IP-of-Master-Server-1', 
MASTER_USER='rep_user', 
MASTER_PASSWORD='Your-Passwd', 
MASTER_LOG_FILE='Log_file_of_Master-Server-1', 
MASTER_LOG_POS=Log_position_of_Master-Server-1;

Leave a Reply

Your email address will not be published. Required fields are marked *