1. Install MySQL source (default in Centos7 does not include MySQL source)wgethttp//repo.mysql.com/mysql-community-release-el7-5.noarch.rpmRPM-IVH mysql-community-release-el7-5. noarch.rpmYum Installmysql-Server2. Configuring mysql-Master added in my.cnf: Prot=3306Log-bin=master-Binlog-bin-index=master-Bin.indexserver-ID=13new Replication User repl_user;grant replication Slave on after restarting MySQL*. * to Repl_user identified by'Xyzzy';4. Configure the standby MySQL add the following lines in the MY.CNF relay-log=slave-Binrelay-log-index=slave-Bin.indexserver-ID=25discover that the standby machine cannot connect to the master server Nmap-v Materip Discovery does not open SSH port 22 so open: Firewall-cmd--zone=public--add-port= A/TCP--Permanent6. Slave database error message: MySQL> Change MASTER to Master_host='192.168.52.129',Master_user='Repl',master_password='repl_1234',master_log_file='mysql-bin.000141',master_log_pos= -; ERROR1794(HY000): Slave is not Configuredor failed to initialize properly. Must at least set--server-IDTo Enableeither a master or a slave. Additional error messages can be foundinchThe mysqlerror log.mysql>show VARIABLES like'server_id';+---------------+-------+| variable_name | Value |+---------------+-------+| server_id |0|+---------------+-------+1RowinchSet (0.00sec) ID does not have an effective configuration inside there are [mysqld] and [Mysqld_safe], the new configuration file placement is not the same, add the new configuration to mysqld under the test, OK success. MySQL> Show variables like'server_id';+---------------+-------+| variable_name | Value |+---------------+-------+| server_id |2|+---------------+-------+1RowinchSet (0.00sec) MySQL>Change Master tomaster_host='192.168.122.1', master_port=3306, Master_user='Repl_user', master_password='Xyzzy'; Query OK,0Rows affected,2Warnings (0.05sec) MySQL>start slave; Query OK,0Rows Affected (0.01sec) to test the success of replication: Create a database on master: MySQL>CREATE DATABASE Cydb; Query OK,1Row affected (0.00sec) on slave to see if this database is available: MySQL>show databases;+--------------------+| Database |+--------------------+| Information_schema | | Cydb | | MySQL | | Performance_schema |+--------------------+4RowsinchSet (0.00sec) To this point, the simple replication environment has been successfully paired.
MySQL Simple Replication Service Build