The system database needs to be backed up in real time. However, the webservice data backup method previously considered has a great impact on the program running efficiency. After checking the data, mysql can set the master-slave server to back up data. All data backup tasks are handed over to the mysql server, which has little impact on the running of the group buying system and can achieve real-time backup. The following are some steps for configuring the mysql Master/Slave server (test environment: the master server is win2003, mysql version is 5.1.51, the slave server is win7, and mysql version is 5.1.51 ).
1. Add a backup user to the master server. Set the global permissions to RELOAD, SUPER, and replication slave. All permissions of the database to be backed up are assigned to the change user, and the user can remotely log on to the master server.
2. Add the following content under [mysqld] In my. ini of the master server:
Server-id = 1 # master server id
Log-bin = D: mysqllogmysql. log # backup
Binlog-do-db = tg # back up the database
3. Restart the master server.
4. Set the slave server and add it under [mysqld] In my. ini of the slave server:
Server-id = 2 # It must be different from the master server id
Master-host = ***. *** # master server ip Address
Log-bin = D: mysqllogmysql. log
Master-user = slave # New user Name on the master server
Master-password = 123 # password
Master-port = 3306 # master server port
Master-connect-retry = 60 # synchronization interval: 60 seconds
5. Restart the slave server mysql. Run show master status on the MASTER server mysql to record the File and Position values. Start the slave server mysql and run the following command:
Change master to master_host = ***.***.***.***;
Change master to master_user = 'slave ';
Change master to master_password = 123;
Change master to master_log_file = mysql.000001 # File value recorded just now
Change master to master_log_pos = 38392; # position value recorded just now,
Run start slave; show slave status. If the status is successful, a data record related to the master server is returned,
Return to the master server and run show processlist to check the connection status of the slave server. The Master/Slave server settings have been completed.