mariadb Main Master synchronization, that is, two mariadb between the main from, each mariadb are dominated, from the dual role.
1. MARIADB01 Configuration
Vi/etc/my.cnf.d/server.cnf
[Mysqld]
Server-id = 1
Log-bin = Master-log
Relay-log = Slave-log
Auto_increment_offset = 1
Auto_increment_increment = 2
2. MARIADB02 Configuration
Vi/etc/my.cnf.d/server.cnf
[Mysqld]
Server-id = 2
Log-bin = Master-log
Relay-log = Slave-log
Auto_increment_offset = 2
Auto_increment_increment = 2
3. Restart the MARIADB service
Root User: sudo-u mysql service mysql restart
MySQL User: Service MySQL restart
4. MariaDB01 master, MariaDB02 from configuration
MariaDB01 Execution:
CREATE USER ' repl ' @ ' 192.168.10.% ' identified by ' 123456 ';
GRANT REPLICATION SLAVE on * * to ' repl ' @ ' 192.168.10.% ';
Show master status;
MariaDB02 Execution:
Change MASTER to master_host= ' 192.168.10.178 ', master_user= ' repl ', master_password= ' 123456 ', master_log_file= ' Master-log.000002 ', master_log_pos=329;
Start slave;
Show Slave Status\g
5. MariaDB02 Master, MariaDB01 from configuration
MariaDB02 Execution:
CREATE USER ' repl ' @ ' 192.168.10.% ' identified by ' 123456 ';
GRANT REPLICATION SLAVE on * * to ' repl ' @ ' 192.168.10.% ';
Show master status;
MariaDB01 Execution:
Change MASTER to master_host= ' 192.168.10.179 ', master_user= ' repl ', master_password= ' 123456 ', master_log_file= ' Master-log.000002 ', master_log_pos=329;
Start slave;
Show Slave Status\g
At this point, the primary master synchronous replication configuration is complete.
MariaDB 10.3 Primary Master synchronous replication