Mysql5 Masterslave Data Synchronous Configuration
Test environment.Basically the data is synchronized instantaneously, I hope it will be helpful to everyone
RedHat ES 3 update 3
MYSQL 5.0.15
MYSQL data synchronization backup
A server: 192.168.1.2 master server
B server: 192.168.1.3 secondary server slave
A server settings
#mysql –u root –p
mysql>GRANT FILE ON *.* TO [email protected] IDENTIFIED BY '1234';
mysql>exit
The above is Master opening an account backup password 1234 to IP: 192.168.1.3 with file processing authority
mysqladmin –u root –p shutdown
Export the master's database to the slave machine, you can choose to export the database that needs to be synchronized
Modify/etc/my.cnf on machine A
Add parameters to the [mysqld] section
log-bin=mysql-bin
server-id=1
binlog_do_db= gbbbs (database to sync)
binlog_ignore_db= mysql,test,information_schema (libraries that do not need synchronization, 5.0 has the library information_schema)
sql-bin-update-same
Restart A server mysql
B server settings
Configure/etc/my.cnf
Add in the [mysqld] section
server-id= 2 (if there are slave users, their IDs will also increase, such as server-id=3)
master-host=192.168.112.71
master-user=backup
master-password= 1234
replicate-do-db=gbbbs
#replicate-do-db=database2
log-warnings
master-port=3306
master-connect-retry= 60
Restart MYSQL of server B
There is a master.info file in the database folder for viewing synchronization information
It's actually MYSQL Replication
0 Comments