In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The following brings you about the MHA high-availability configuration method of mysql, if you are interested, let's take a look at this article. I believe it will be of some help to you after reading mysql's MHA high-availability configuration method.
The first part matches the master-slave relationship of the three nodes.
1. Install mysql or mariadb database on each node
two。 Configure the master node, that is, the written node, as follows
Vim / etc/my.cnf
Add code on the [mysqld] side
Log_bin=log_bin # enables binary log. Master-slave replication is based on this log. Server_id=14#ID replicated by each node must be unique.
3. Configure the slave node
Vim / etc/my.cnf
Add code on the [mysqld] side
Server_id=19 relay_log=relay_log # enables the relay log, and the slave node completes the relay_log_index=relay_log.index based on this log.
4. Open the primary node and run mysql-uroot-e 'show master status;' on the primary node
Record the two-tier log
Enter mysql and run grant replication slave on. * to 'rep'@'192.168.%.%' identified by' 123456'
# create an account with copy permission, account rep, secret 123456, scope of action 192.168.0.0
6. Enter mysql, configure the connection of slave node, configure MariaDB [(none)] > CHANGE MASTER TO- > MASTER_HOST='192.168.0.14',- > MASTER_USER='rep',- > MASTER_PASSWORD='123456',-> MASTER_LOG_FILE='log_bin.000003',- > MASTER_LOG_POS=235; configuration complete, run the following two commands to start synchronization slave start; # # start synchronization engine
Show slave status\ G; check engine status
Circle the two, for yes is successful, do not check the network status for yes, whether the firewall and selinux are turned off, and one can change the IP from the same configuration as the node.
7. To do the MHA experiment, we also need to disable the automatic deletion function from the relay log of the CVM.
Set global relay_log_purge = OFF
Show variables like'% relay_log_purge%'
Part II MHA configuration
1. Install now
Yum install epel-release.noarch
# install eprl source first
Yum install mha4mysql-manager-0.56-0.el6.noarch.rpm-y-- skip-broken
# install the control host
two。 Create a new configuration file vim / etc/mha/app1.cnf
[server default] # the mysql just authorized manages the account name ssh_user=root#mysql that is logged in without a key under the alias user=rootpassword=123456manager_workdir=/mha# SSH, which is used to synchronize repl_user=reprepl_password=123456#ping intervals such as binary logs between the master and slave computers, and to detect whether the master is normal. Ping_interval= 1 [server1] hostname=192.168.0.14port= 3306 [server2] candidate_master=1# is set as a candidate host. Even if the synchronized data is not the latest check_repl_delay=0# from the host, by default, if a slave lags behind the master 100m relay logs, MHA will not select the slave as a new master, because it takes a long time to recover this slave, and the replication delay will be ignored when selecting a new master by setting the check_repl_delay=0,MHA trigger switch. Hostname=192.168.0.16port=3306 [server3] hostname=192.168.0.19port=3306 check ssh connection
# show it all through
4. Check the status of the entire replication environment
Masterha_check_repl-conf=/etc/mha/app1.cnf
5. Check the software open status
Masterha_check_status-conf=/etc/mha/app1.cnf
Displays "NOT_RUNNING", which means that MHA monitoring is not turned on. Execute the following command to start MHA in the background.
Nohup masterha_manager-conf=/etc/mha/app1.cnf
# enable mha
Since then, a small part of the function of mha has been completed, and the software is too complex, and the master node has to manually restore the configuration online. Trouble, it is better to configure a double master mode. Use a vip in front, backup master is usually not allowed to write, and master is hung up on top. As long as the semi-synchronous effect is configured, it should be better than mha. Read the details of mysql's MHA high-availability configuration method above and see if you have gained anything. If you want to know more about it, you can continue to follow our industry information section.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.