MARIADB Master-slave replication

Source: Internet
Author: User
Tags unique id

MARIADB Master-slave replication:
Replication: Each node has the same data set
From node:
I/O Thread: Requests binary log events from Master and remains in the trunk log
SQL Thread: Reads log events from the trunk log and completes the replay locally
Master node:
Dump thread: Launches a dump for each slave I/O thread that is used to send binary log events
Characteristics:
1. Asynchronous replication
2. master-Slave data inconsistency is more common
3. A master more from
4. From the server can also have from the service
Configuration process:
Master node:
1. Start the binary log
2. Set a globally unique ID number for the current node
3. Create a user account with copy permissions
Replication Slave,replication Client
From node:
1. Start the relay log
2. Bit the current node set a globally unique ID number
3. Connect to the primary server with a user account with replication privileges and start the replication thread

        Master node: Vi/etc/my.cnf added in [mysqld]: Log-bin=mysql_bin_log #启动二进制日志 server-id=1 #主节点和从节点一定要不通 innodb_file_per_table=on skip_name_resolve=on Restart Mariadb:systemctl restart Mariad b Create a replication user and authorize: MariaDB [(None)]> grant replication slave,replication slave on * * to ' repluser ' @ ' 172.16.%.%        ' Identified by ' 123456 ' MariaDB [(none)]> show master logs; +----------------------+-----------+        | Log_name |        File_size | +----------------------+-----------+        |     mysql_bin_log.000001 |        30379 | |   mysql_bin_log.000002 |        1038814 | |       mysql_bin_log.000003 |        264 | |       mysql_bin_log.000004 |        264 | |       mysql_bin_log.000005 |        245 | #记住这个二进制文件名和对应的序号 +----------------------+-----------+ 5 rows in Set (0.00 sec) from node: vi/e Tc/my.cnf added in [mysqld]: Relay-log=relay-log Server-id=2 innodb_file_per_table=on skip_name_resolve=on Restart mariadb:systemctl restart Mar IADB Connection master server: MariaDB [(none)]> change master to master_host= ' 172.16.6.12 ', master_user= ' Repluser ', master        _password= ' 123456 ', master_log_file= ' mysql_bin_log.000005 ', master_log_pos=245;        Start copying: MariaDB [(none)]> start slave; View replication Status: MariaDB [(none)]> show Slave status\g;

Mariadb 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.