MySQL MHA Online Manual switching-small pits

Source: Internet
Author: User
Tags percona server

Today, we tested MySQL's highly available architecture--mha, and performed automatic switching, manual failover, and manual online switching, where manual online switching found pits: When the old Master switched to a new slave, the READ_ONLY was not automatically set to ON, as illustrated below:

Environment Description:

Os:centos Release 6.5

Mysql:5.6.22-71.0-log Percona Server


slave1:172.16.52.130

Mysql> Show variables like ' read_only ';

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Read_Only | On |

+---------------+-------


slave2:172.16.52.132


Mysql> Show variables like ' read_only ';

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Read_Only | On |

+---------------+-------+


master:172.16.52.131

Mysql> Show variables like ' read_only ';

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Read_Only | OFF |

+---------------+-------+

Manual online Switching on the Mha-manager:

Masterha_master_switch--conf=/etc/masterha/app1.cnf--master_state=alive--orig_master_is_new_slave--interactive =0 &>/masterha/app1/manager.log

Some information:

[INFO] Switching master to 172.16.52.130 (172.16.52.130:3306) completed successfully.

You can find the 172.16.52.130 Tangent main library (you can specify a new main library:--new_master_host=ip,--new_master_port=port)

Mysql> show Slave hosts;

+-----------+------+------+-----------+--------------------------------------+

| server_id | Host | Port | master_id | Slave_uuid |

+-----------+------+------+-----------+--------------------------------------+

|      132 | |       3306 | 130 | E173b5bf-e286-11e4-8d56-000c29c78a39 |

|      131 | |       3306 | 130 | 18f4bdc7-e285-11e4-8d4a-000c298dfc24 |

+-----------+------+------+-----------+--------------------------------------+

View the original library-new from library parameters: 172.16.52.131

Mysql> Show variables like ' read_only ';

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Read_Only | OFF |

+---------------+-------+

Slave 2:172.16.52.132

Mysql> Show variables like ' read_only ';

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Read_Only | On |

+---------------+-------+

master:172.16.52.130

Mysql> Show variables like ' read_only ';

+---------------+-------+

| variable_name | Value |

+---------------+-------+

| Read_Only | OFF |

+---------------+-------+

Summarize:

Discover switch from library to main library, close read_only, Main library switch to from library, open read_only, so after switch, need to manually modify new from library parameter

Set global read_only=on;

This article is from the "Floating Phoenix Year" blog, please be sure to keep this source http://liuzhanbin.blog.51cto.com/10060150/1641823

MySQL MHA Online Manual switching-small pits

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.