Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An easy way to achieve high availability of MySQL using MHA

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces you to use MHA to achieve high availability of MySQL easy method, the contents of the article are carefully selected and edited by the author, with a certain pertinence, for everyone's reference significance or greater, the following with the author to understand the use of MHA to achieve high availability of MySQL easy method bar.

Because MHA does not automatically create a master-slave environment, you need to deploy the master-slave environment manually, or you can deploy MHA in an existing master-slave environment. Do not set all slave to read-only, and also open binlog. If you want to switch to the specified slave after master failure, the specified slave opens binlog and sets read / write, while others do not need to set to open binlog or set read-only. It is based on its own structure.

Architecture

System environment

# cat / etc/redhat-release

CentOSrelease 6.6 (Final)

# uname-rm

2.6.32-504.el6.x86_64x86_64

Create a MHA user

Execute on the master of the master-slave environment

Mysql > grant all privileges on *. * to 'mha'@'192.168.56.%' identified by' 123456'

Create a soft connection

If the MySQL service is not installed by yum, execute the following two commands on all MySQLServer, both master and slave.

# ln-s / application/mysql/bin/mysqlbinlog / usr/bin/mysqlbinlog

# ln-s / application/mysql/bin/mysql / usr/bin/mysql

Configure SSH public key authentication

Several CVMs perform the same operation, but only the different services are distributed. Only one is listed here.

# # #

Add Unified user

The use of root users in a production environment is unsafe and unregulated. And the unified environment is also more convenient to manage, so we can create a unified ordinary users to carry out.

#

Create a key pair

[root@mha-manager] # ssh-keygen-t dsa

Distribute the public key to each host

After reading the above easy ways to achieve high availability of MySQL with MHA, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report