Installed database client and server:
yum install mariadb mariadb-server -y
Mysql modify database configuration file (/etc/my.cnf), add the following two lines in the [mysqld] below:
log-bin=jfedu-bin
server-id=1
Start the database service:
systemctl start mariadb
Check whether the configuration take effect:
End log in directly through the mysql client:
MariaDB [(none)]> show variables like "%log_bin";
For authorization from the library:
grant replication slave on . to "jfedu"@"192.168.75.135" identified by "123456";
flush privileges;
View master status:
show master status;
slave-side configuration:
Installation mysql yum install mariadb mariadb-server -y
modify the configuration file (/etc/my.cnf), add [mysqld] following lines: server-id = 2
Start the service:
systemctl start mariadb
Specifies the master database:
change master to master_host="192.168.75.128", master_user="jfedu", master_password="123456", master_log_file="jfedu- bin.000002", master_log_pos=476;
View slave status:
slave start;
show slave status\G
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Verify data synchronization:
create database cylin charset=utf8;
Check database in Slave:
MariaDB [(none)]> Show Databases;