• notice
  • Congratulations on the launch of the Sought Tech site

Mysql cross-server synchronization data experience sharing

For project needs, after finding some information and configuring it by hand, share the experience gained.

(1) Main server
Modify the configuration file/etc/my.cnf (my.ini)
[mysqld]
# mysql-bin is the prefix of the log file, Other names can also be used, such as server name
# If there is no path, the log file will be written under `/var/lib/mysql`
log-bin=mysql-bin
# serverid is in Must be unique in a synchronization system, an integer greater than or equal to 1 and less than 2^32-1
server-id=1

binlog-do-db=database name (the database you want to back up)
binlog-ignore-db=database name (the database you don’t need to back up)
#None of the above two, backup all

#If you use InnoDb, in order to ensure stability, you should also set The following two lines:
innodb_flush_log_at_trx_commit=1
sync_binlog=1
# And make sure that skip-networking is not set, the disabled network naturally cannot be synchronized.However,
#innodb_flush_log_at_trx_commit=1 will cause a sharp drop in data writing speed on some servers,
# can try to adjust to 2.

#Manually add it yourself and restart the mysql server

[optional operation to add an account]
#Set account steps:
#Log in to the mysql main server,
[root @localhost ~]# mysql-uroot

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+