Troubleshooting of abnormal shutdown of MySQLSlave (pt-slave-restart)

Source: Internet
Author: User
Tags install perl percona
Troubleshooting of abnormal shutdown of MySQLSlave (pt-slave-restart)

Troubleshooting of abnormal shutdown of MySQL Slave (pt-slave-restart)

The following three methods are used to handle abnormal shutdown of MySQL Slave.
You can also use the pt-slave-restart command of percona-toolkit.

The percona-toolkit-2.2.8-1.noarch.rpm needs to install some dependency packages.

  • Yum install perl-DBI perl-DBD-MySQL perl-IO-Socket-SSL perl-Time-HiRes
  • Handle abnormal shutdown Simulation
    1. JAVA programs are constantly written to the Master

    2. Disable the Slave VM.
    In the JAVA program running, the Server Load balancer virtual machine is forcibly disabled. Then restart Slave.

    In addition to the auto-increment ID, this table is the name field. The default value is test.
    Now, on slave, change the name field to 'mysql'
    Update test set;

    3. Use the pt-slave-restart command to fix the error.

    1594 errors found


    Reconnect to the Master
    Refer:



    Finally, check the replication status, and it is running properly.

    The names entered on the Master node are all test, and the names are changed to mysql after the Slave fault.
    Generally, there are two methods (I can think of) to process primary key duplication)
    1. Ignore repeated binlog events sent from the Master
    2. Use the binlog event of the Master node to update the slave Data.
    For the first method, the slave name should be mysql
    For the second method, the first part is mysql, And the last part is test.

    The test results are as follows. It can be preliminarily indicated that the second method is used.
    The following 302 records with the name 'test' are all part of the data that has been executed but has not been written to the file when the system shuts down abnormally.
    Pt-slave-restart re-executes the binlog of this part of data, so their name is 'test '.

    -------------------------------------- Split line --------------------------------------

    Install MySQL in Ubuntu 14.04

    MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

    Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

    Build a MySQL Master/Slave server in Ubuntu 14.04

    Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

    Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

    -------------------------------------- Split line --------------------------------------

    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.