Already installed CENTOS7 and MySQL, the system is installed by default more than MARIADB
Two virtual machine IP
192.168.0.103
192.168.0.106
Firewall Open port
Permanent parameter means permanent modification
Firewall-cmd--zone=public--add-port=3306/tcp--permanent
Firewall-cmd--reload
Main Library Settings
Mysql-u root-p Password
Go to the MySQL console, add a new account, set only 192.168.0-Segment Multi-IP to access
Create Test account password 123456
Create user ' test ' @ ' 192.168.0.% ' identified ' 123456 ';
Give master-Slave synchronization permissions
Grant Replication Slave on * * to ' test ' @ ' 192.168.0.% ';
Configuration file
/etc/my.cnf
Mariadb/etc/my.cnf.d/server.cnf
Open Binary Log
Log-bin=master-bin,master-bin is the log file name
Server-id MySQL ID, the value must be unique, cannot be 0, otherwise all from the library can not connect
#binlog-do-db=master the database to be synchronized is typically set from the library
Restart MySQL
Systemctl Restart MySQL
Enter the MySQL console to view the status of the primary server
Mysql> Show master status;
Record file and position, set from library
Configure from Library
server-id=2 value Unique
Relay-log=relay-bin Recording master-slave synchronization data multi-log files
Read-only = On set read-only permission from library
REPLICATE-DO-DB = test developed to synchronize multiple databases
Configure information for connecting to the master server
mysql> stop Slave;
Mysql> Change Master to
Master_host= ' 192.168.0.103 ',
->master_user= ' Test ',
->master_password= ' 123456 ',
->master_log_file= ' master-bin.000001 ',
->master_log_pos=1317;
mysql> start slave;
ok~
Centos7 MySQL master and slave settings