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

Example Analysis of basic configuration and Annotation of MHA in MySQL

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the basic configuration of MHA in MySQL and the example analysis of annotations, which is very detailed and has certain reference value. Friends who are interested must read it!

# * app scope***#

[server default] # work_directory##

# the path to save manager logs

Manager_log=/var/log/masterha/app1/app1.log

# manager working directory, which mainly stores the binlog pulled from the main library, the log information of switching, whether the switching trace file has occurred, and the startup information of manager

Manager_workdir=/var/log/masterha/app1

# the working directory of the Node node, which stores the binlog pulled by the binlog,lastest slave pulled by the main library and the log of the application

Remote_workdir=/var/log/masterha/nodeapp1

# the directory of multiple server nodes binlog (my node location is the same, so I put it into the scope of app). It should be noted here that if each server is a different directory, it needs to be configured on different server nodes.

# if the user of ssh is an ordinary user, make sure that you have read permission to change the directory at the same time

Master_binlog_dir=/usr/local/mysql5721/data

# scripts for vip and double check as well as shutdown_script#

# failure vip switchover script. The script here needs to be modified.

# failover vip change

Master_ip_failover_script=/root/perl5/bin/master_ip_failover

# switch manually

Master_ip_online_change_script=/root/perl5/bin/master_ip_online_change

# reconfirm the faulty master through other machines, and manually perform discovery. Only the connectivity of the tcp port is performed. When connecting, ssh_user is used by default. Of course, you can also specify it yourself.

Secondary_check_script=/root/perl5/bin/masterha_secondary_check-s 192.168.2.165

# to avoid cerebral fissure, you can drop the mysql kill

# shutdown_script=/root/perl5/bin/power_manager

# accounts for system and mysql#

# the management account of MySQL, which is required to perform some management operations such as start slave, stop slave and reset slave

User=root

Password=123456

# the account password used for MySQL replication. Here, the account password of each database machine is the same, so I put it into the app scope.

Repl_user=repl

Repl_password=123456

# the account of the operating system interconnection, because we are going to ssh to the different binlog of other machines

Ssh_user=root

Ssh_port=22 # Fault detection algorithm##

Ping_interval=3

# CONNECT,SELECT,INSERT

Ping_type=CONNECT # * * local scope***#

[server1]

Candicate_master=1

# by default, if a slave lags behind the relay logs of master 100m, MHA will not select the slave as a new master, because the recovery of this slave will take a long time. Setting check_repl_delay=0,MHA to trigger the switch will ignore the replication delay when selecting a new master. This parameter is very useful for hosts with candidate_master=1 set, because the candidate host must be the new master during the handover.

Check_repl_delay=0

Hostname=192.168.2.165

# server2 is now my main library

[server2]

Hostname=192.168.2.167

[server3]

Hostname=192.168.2.166

No_master=1

The above is all the contents of the article "sample Analysis of basic configuration and annotations of MHA in MySQL". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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