Reprint please specify source: MySQL database read and write separate data synchronization
MySQL database read/write separate data synchronization I was tested successfully with two XP (one master, one from) system, Linux system I also did the test, did not succeed, but I think I encountered the problem is the same problem, XP can be successful under Linux should also be successful , test later, and then update the results! ps: Just tested under Linux can be synchronized successfully, the primary server is XP, from the server is CentOS, can be successful. Example: a machine 192.168.0.2   B machine 192.168.0.3 Two machines can ping through, mutual access First configure the primary server to first configure a sync account sql code 1grant FILE on * * to ' backup ' @ ' 192.168.0.3 ' identified by ' 1234 '; 2GRANT REPLICATION SLAVE on * * to ' backup ' @ ' 193.168.0.3 ' identified by ' 1234 '; account name is backup, password 1234,ip for IP from server This time we add a synchronous database to the server sql code 1create database Test 2use test 3create table MyTest (username varchar (), password varchar) Open My.ini in [mysqld] Enter the following content log-bin=c:\master.log//log file address, In the Linux system, this item does not add, I added, do not know why the error, mysqld start not up, I give the comment is good, also did not affect the other binlog-do-db=test//to synchronize the database, Here the difference between the main server synchronization database command and the client is not the same the main service side is binlog-do-db, from the server is replicate-do-db #replicate-ignore-db = MySQL This is a non-synchronous database server_id=1//This number cannot be the same as the ID from the server Then restart the MySQL service, you can enter sql code 1show master status to see the relevant information, this command is more important, later when the configuration from the server to use Next is to configure from the server Follow the above steps, first build a database identical to the primary server and then the configuration of the master server some information, this place needs to be noted, I look on the internet most of the tutorials are such ini code 1server-id=2 2master-host=192.168.0.2 3master-user=backup #同步用户帐号 4master-password=1234 5master-port=3306 6master-connect-retry=60 #预设重试间隔60秒 7replicate-do-db= Test #告诉slave只做backup数据库的更新 Put the above code into the My.ini, but I try, add this code, MySQL service start not up, read the log file, found hint: 111121 21:11:56 [ERROR] Wampmysqld:unknown variable ' master-host=192.168.0.2 ' later found it on the Internet, in MySQL version from 5.1.7 is not supported after the "master-host" similar parameter; so this is the way to configure it at this time Using the MySQL tool sql code 1mysql-uroot-p 2 3change Master to master_host= ' 192.168.0.2 ', Master_user= ' backup ', master_password= ' 1234 ', master_log_file= ' mysql-bin.000010 ', master_log_pos=16860; Here also special need to note, I think I did not configure the Linux under the success, may be the reason for this place, the last two master_log_file= master_log_pos= The value of these two items, to be viewed on the main server using the Show Master Status Command, file is the value of master_log_file in the results of the view. Position is the value of Master_log_pos I was the two configurations were wrong, causing the synchronization to fail, both of which are important. Then open the My.ini file on the mysqld node, add the ini code 1replicate-ignore-db = mysql//disable synchronization of the database 2REPLICATE-DO-DB = test//database to be synchronized 3replicate-ignore-db = information_schema//The database is not synchronized and the database is not required to disable synchronization , but the database to be synchronized is required configured, restart under MySQL service at this time, the client is configured we use INSERT INTO statement on the main server, insert two records then select from the server Check it out., Finally, you can use the show slave status command in the MySQL command line tool to view the associated status slave_io_state:waiting for master to send event When you use show slave status to check out the first line, the state is the state above, then it is successful, the other State seems to be unable to synchronize
Reprint please specify source: MySQL database read and write separate data synchronization
Http://www.php1.cn/Content/mysql_ShuJuKuDuXieFenLiShuJuTongBu.html
Attached: Salve add read-only user
GRANT SELECT on * * to ' reader ' @ ' localhost ' identified by ' 123456 ';
Reprint Please specify source:MySQL database read and write separate data synchronization
MySQL database read/write separate data synchronization I was tested successfully with two XP (one master, one from) system, Linux system I also did the test, did not succeed, but I think I encountered the problem is the same problem, XP can be successful under Linux should also be successful , test later, and then update the results! ps: Just tested under Linux can be synchronized successfully, the primary server is XP, from the server is CentOS, can be successful. Example: a machine 192.168.0.2   B machine 192.168.0.3 Two machines can ping through, mutual access First configure the primary server to first configure a sync account sql code 1grant FILE on * * to ' backup ' @ ' 192.168.0.3 ' identified by ' 1234 '; 2GRANT REPLICATION SLAVE on * * to ' backup ' @ ' 193.168.0.3 ' identified by ' 1234 '; account name is backup, password 1234,ip for IP from server This time we add a synchronous database to the server sql code 1create database Test 2use test 3create table MyTest (username varchar (), password varchar) Open My.ini in [mysqld] Enter the following content log-bin=c:\master.log//log file address, In the Linux system, this item does not add, I added, do not know why the error, mysqld start not up, I give the comment is good, also did not affect the other binlog-do-db=test//to synchronize the database, Here the difference between the main server synchronization database command and the client is not the same the main service side is binlog-do-db, from the server is replicate-do-db #replicate-ignore-db = MySQL This is a non-synchronous database server_id=1//This number cannot be the same as the ID from the server Then restart the MySQL service, you can enter sql code 1show master status to see the relevant information, this command is more important, later when the configuration from the server to use Next is to configure from the server Follow the above steps, first build a database identical to the primary server and then the configuration of the master server some information, this place needs to be noted, I look on the internet most of the tutorials are such ini code 1server-id=2 2master-host=192.168.0.2 3master-user=backup #同步用户帐号 4master-password=1234 5master-port=3306 6master-connect-retry=60 #预设重试间隔60秒 7replicate-do-db= Test #告诉slave只做backup数据库的更新 Put the above code into the My.ini, but I try, add this code, MySQL service start not up, read the log file, found hint: 111121 21:11:56 [ERROR] Wampmysqld:unknown variable ' master-host=192.168.0.2 ' later found it on the Internet, in MySQL version from 5.1.7 is not supported after the "master-host" similar parameter; so this is the way to configure it at this time Using the MySQL tool sql code 1mysql-uroot-p 2 3change Master to master_host= ' 192.168.0.2 ', Master_user= ' backup ', master_password= ' 1234 ', master_log_file= ' mysql-bin.000010 ', master_log_pos=16860; Here also special need to note, I think I did not configure the Linux under the success, may be the reason for this place, the last two master_log_file= master_log_pos= The value of these two items, to be viewed on the main server using the Show Master Status Command, file is the value of master_log_file in the results of the view. Position is the value of Master_log_pos I was the two configurations were wrong, causing the synchronization to fail, both of which are important. Then open the My.ini file on the mysqld node, add the ini code 1replicate-ignore-db = mysql//disable synchronization of the database 2REPLICATE-DO-DB = test//database to be synchronized 3replicate-ignore-db = information_schema//The database is not synchronized and the database is not required to disable synchronization , but the database to be synchronized is required configured, restart under MySQL service at this time, the client is configured we use INSERT INTO statement on the main server, insert two records then select from the server Check it out., Finally, you can use the show slave status command in the MySQL command line tool to view the associated status slave_io_state:waiting for master to send event When you use show slave status to check out the first line, the state is the state above, then it is successful, the other State seems to be unable to synchronize
Reprint Please specify source:MySQL database read and write separate data synchronization
Http://www.php1.cn/Content/mysql_ShuJuKuDuXieFenLiShuJuTongBu.html
"Go" MySQL database read/write separate data synchronization