Master-slave replication: generally used for real-time backup.
The next steps are as follows: master master database configuration synchronization, slave database configuration synchronization, master lock table / backup, slave data recovery, slave synchronization enabled, master unlocking, and completion.
##################### mysql5.7 bin-log Log open, Must set server-id ################### ############### master host vim /etc/my.cnf # Add the following configuration to [mysqld]
server-id=1 #Server id (master and slave must be different) log-bin=mysql-bin # Open the log (the host needs to open it). This MySQL bin can be customized or added with the path binlog-do-db=monitor_db #Library to synchronize with slave binlog-ignore-db=mysql #Libraries that do not synchronize with slaves (write multiple lines) binlog-ignore-db=mysqlslap binlog-ignore-db=information_schema binlog-ignore-db=performance_schema binlog-ignore-db=sys expire_logs_days=3 # Automatically clean up the log files 3 days ago, which can be modified as needed
#Save exit, restart mysql service