MySQL Master-slave replication

Source: Internet
Author: User

Primary server (192.168.1.111) configuration:

1. To set up authorized users from the server 2, modify the master server Profile MY.COF, open the Bin-log log, and set the Server-id value (each server-id is not the same) 3, set the read lock on the primary server is valid, ensure that there is no database operation, in order to obtain a one-time snapshot 4. View the current binary log name and offset on the primary server 5, the current primary database server has stopped the update operation, to generate a backup of the primary database, Backup has two methods:(1), CP all data(2), mysqldump Backup Data method 6. After the primary database has been backed up, the primary database can resume the write operation 7, the primary database to restore the consistent backup from the database, put the above test2.sql to the corresponding directory can be  from server Configuration (192.168.1.112):1. Modify the configuration file from the server vim/etc/my.cnf  

2. Restart Mysqld service 3. See the corresponding list of master and slave replication processes in two ways:(1), Processlist  (2), status Slave_io_running This process is responsible for reading the Bin-log log from the server from the primary server and writing it to the trunk log from the serverSlave_sql_running This process is responsible for reading and executing the Binlog log in the trunk log configuration Complete Test success!!

MySQL Master-slave replication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.