MySQL one master multiple from copy data

Source: Internet
Author: User

Scenario: The external only accesses the primary database (Mysql_master), and multiple database hot backups are made from the database (Mysql_slave). Once the primary database is down, the data is processed from the server


Experimental extension Map:

Lab Environment:

Operating system version: CentOS7

mysql_master:192.168.199.17

mysql_slave01:192.168.199.18

mysql_slave02:192.168.199.19


Experimental steps:

01. According to the above environment, log in to Mysql_master, MYSQL_SLAVE01, mysql_slave02 three servers, turn off FIREWALLD and SELinux firewall, and configure IP, DNS, hostname, etc.

Mysql_master:

MYSQL_SLAVE01:

MYSQL_SLAVE02:

02. Log in to Mysql_master, MYSQL_SLAVE01, mysql_slave02 three servers, and perform the following actions.

#安装Mariadb

Yum Install Mariadb-server mariadb-y

#设置Mariadb开机自动启动服务

Systemctl Enable MARIADB

#启动Mariadb服务

Systemctl Start mariadb

#查看Mariadb服务是否正常运行

Systemctl Status mariadb


03. Configure the/etc/my.cnf files for Mysql_master, MYSQL_SLAVE01, mysql_slave02 three servers respectively

                mysql_ Master:

[Mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# disabling symbolic-links is  recommended to prevent assorted security riskssymbolic-links=0# settings  user and group are ignored when systemd is used.# If  you need to run mysqld under a different user or group,#  customize your systemd unit file for mariadb according to  The# instructions in http://fedoraproject.org/wiki/systemdserver-id=3log-bin=mysql-binrelay-log =mysql-relay-binreplicate-wild-ignore-table=mysql.%replicate-wild-ignore-table=test.% replicate-wild-ignore-table=information_schema.%[mysqld_safe]log-error=/var/log/mariadb/mariadb.logpid-file=/ var/run/mariadb/mariadb.pid## include all files from the config directory#! Includedir /etc/my.cnf.d

                mysql_ SLAVE01:

[Mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# disabling symbolic-links is  recommended to prevent assorted security riskssymbolic-links=0# settings  user and group are ignored when systemd is used.# If  you need to run mysqld under a different user or group,#  customize your systemd unit file for mariadb according to  The# instructions in http://fedoraproject.org/wiki/systemdserver-id=2log-bin=mysql-binrelay-log =mysql-relay-binreplicate-wild-ignore-table=mysql.%replicate-wild-ignore-table=test.% replicate-wild-ignore-table=information_schema.%[mysqld_safe]log-error=/var/log/mariadb/mariadb.logpid-file=/ var/run/mariadb/mariadb.pid## include all files from the config directory#! Includedir /etc/my.cnf.d

                mysql_ SLAVE02:

[Mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# disabling symbolic-links is  recommended to prevent assorted security riskssymbolic-links=0# settings  user and group are ignored when systemd is used.# If  you need to run mysqld under a different user or group,#  customize your systemd unit file for mariadb according to  The# instructions in http://fedoraproject.org/wiki/systemdserver-id=3log-bin=mysql-binrelay-log =mysql-relay-binreplicate-wild-ignore-table=mysql.%replicate-wild-ignore-table=test.% replicate-wild-ignore-table=information_schema.%[mysqld_safe]log-error=/var/log/mariadb/mariadb.logpid-file=/ var/run/mariadb/mariadb.pid## include all files from the config directory#! Includedir /etc/my.cnf.d





MySQL one master multiple from copy data

Related Article

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.