MariaDB 10.3 Primary Master synchronous replication

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.