Mysql Synchronous Slave_io_running:no or slave_sql_running:no solution [measured]_mysql

Source: Internet
Author: User
Today, when testing MySQL sync, check the database to find a MySQL slave not synchronized with the host to view the status of slave:
Mysql> Show Slave Status\g
Slave_io_running:yes
Slave_sql_running:no
last_errno:1062
....
Seconds_behind_master:null
Reason:
1. The program may be written on the slave
2. It may also be the slave machine after the transaction rollback caused.

Solution I:
1. First stop slave service: Slave stop

2. View host status on the primary server:
Record the values for file and position.
Mysql> Show master status;
+------------------+-----------+--------------+------------------+
| File | Position | binlog_do_db | binlog_ignore_db |
+------------------+-----------+--------------+------------------+
| mysql-bin.000020 | 135617781 | | |
+------------------+-----------+--------------+------------------+
1 row in Set (0.00 sec)

3. Perform a manual synchronization on the slave server:
Copy Code code as follows:

Mysql> Change Master to
> master_host= ' master_ip ',
> master_user= ' user ',
> master_password= ' pwd ',
> master_port=3307,
> master_log_file= ' mysql-bin.000020 ',
> master_log_pos=135617781;

1 row in Set (0.00 sec)
mysql> slave start;
1 row in Set (0.00 sec)
View slave status Discovery again:
Slave_io_running:yes
Slave_sql_running:yes
...
seconds_behind_master:0

Solution II:
mysql> slave stop;
Mysql> set GLOBAL sql_slave_skip_counter=1;
mysql> slave start;

Own experience: Method one is mandatory from a certain point of synchronization, there will be a part of the data loss is not synchronized, subsequent primary server delete record synchronization will also have some error messages, will not affect the use. Method two does not necessarily have an effect.
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.