MySQL hot standby and query MySQL operation log

Source: Internet
Author: User
Tags mysql version

MySQL Hot spare
1 View the MySQL version to ensure that the main library is below equals from the library
2 Main Library configuration:
A need to open the support log function: Log-bin=mysql-bin
B provide server-id:server-id=1
C restart MySQL, after entering, assign copy the account from the library
GRANT REPLICATION SLAVE on * * to ' repuser ' @ ' Backip ' identified by ' repuser ';
D show master status; You can see the current position of the binary log file
E mysqldump--all-databases--single-transaction--master-data > All
Back up the database content, plus the Master-data parameter to see which log file the current backed up data corresponds to in the backed up file position
3 Configuration from the server
A server-id=2//Set database ID The default master server is 1 and can be set casually but cannot be duplicated if there are multiple slave servers.
IP address or domain name of the Master-host=masterip//master server
master-port=3306//port number of the primary database
Master-user=repuser//Synchronizing the database user
Master-password=repuser//Synchronizing the password of the database
MASTER-CONNECT-RETRY=60//If the primary server is found to be disconnected from the server, the time lag for reconnection
B start from the server, and stop Slave:slave stop first;
C Import the Master library data
D mysql> Change MASTER to
Master_host= ' Masterip ',//IP address of the primary server
-master_user= ' repuser ',//users synchronizing the database
-master_password= ' repuser ',//password for synchronizing the database
Master_log_file= ' recorded_log_file_name ',//file name of the primary server binary log
Master_log_pos=recorded_log_position; Where to start the log file

Where the log file name and start location can be found in the first few lines of the file
E slave start; end



Querying the MySQL operations log
1 show binary logs; You can see the position in each Binlog
2 mysqlbinlog binlog_file--no-defaults--start-datetime= ' 2009-12-15 00:00:00 ' |more

MySQL hot standby and query MySQL operation log

Related Article

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.