MariaDB 10.3 Master-slave replication

Source: Internet
Author: User

Basic information

Server 1:mariadb01 192.168.10.178

Server 2:MARIADB02 192.168.10.179

Operating system: CentOS 6.4

Database version: MariaDB-10.3.7

Master-Slave Relationship: MariaDB01-based, MariaDB02 from


MariaDB01

1. Modify the configuration file

Vi/etc/my.cnf.d/server.cnf

Under [Mysqld], add the following

Server-id = 1

Log-bin = Mysql-bin


2. Restart the MySQL service

Service MySQL Restart


3. View Master Status

4. Create a master-slave connection account and authorization

CREATE USER ' repl ' @ ' 192.168.10.% ' identified by ' 123456 ';

GRANT REPLICATION SLAVE on * * to ' repl ' @ ' 192.168.10.% ';


5. Turn off the firewall

Service Iptables Stop

Chkconfig iptables off


MariaDB02

1. Modify the configuration file

Vi/etc/my.cnf.d/server.cnf

Under [Mysqld], add the following

Server-id = 2

Log-bin = Mysql-bin


2. Restart the MySQL service

Service MySQL Restart


3. Create a master-slave connection account and authorization

CREATE USER ' repl ' @ ' 192.168.10.% ' identified by ' 123456 ';

GRANT REPLICATION SLAVE on * * to ' repl ' @ ' 192.168.10.% ';


4. Turn off the firewall

Service Iptables Stop

Chkconfig iptables off


5. Establish a master-slave connection

Change MASTER to master_host= ' 192.168.10.178 ', master_user= ' repl ', master_password= ' 123456 ', master_log_file= ' Mysql-bin.000001 ', master_log_pos=328;

Start slave;


Test Master-slave replication

1. Master and slave service all normal, create database

MARIADB01, Main:

MariaDB02, from:


2. Main normal, from close, create table

MARIADB01, Master


After the master has finished creating the table, start from the library

MariaDB02, from:



MariaDB 10.3 Master-slave 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.