In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following content mainly brings you the analysis of MySQL dual-master high availability configuration method. The knowledge mentioned here, which is slightly different from books, is summed up by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing. I hope to bring help to the majority of readers.
1. Install MySQL instances on two CVM respectively
Mysql01:192.168.0.207
Mysql02:192.168.0.208
Vip1:192.168.0.211
Vip2:192.168.0.212
(slightly)
Configure primary primary replication on two servers
GRANT REPLICATION SLAVE ON *. * TO 'dba_repl'@'192.168.0.%' IDENTIFIED BY' 123456'
Change master to MASTER_HOST='192.168.0.207'
MASTER_USER='dba_repl'
MASTER_PASSWORD = '123456'
MASTER_LOG_FILE = 'mysql-bin.000003'
MASTER_LOG_POS = 120
Third, configure keepalived, the key point of this scheme lies in the configuration of keepalived, the priority of the two vrrp_instance on the two hosts is opposite.
MySQL01:
Global_defs {
# Keepalived process identifier
Lvs_id MySQL_HA
}
# Script used to check if Proxy is running
Vrrp_script check_proxy {
Script "killall-0 mysql"
Interval 2
Weight 3
}
# Virtual interface 1
# The priority specifies the order in which the assigned interface to take over in a failover
Vrrp_instance VI_01 {
State MASTER
Interface eth0
Virtual_router_id 51
Priority 100
# The virtual ip address shared between the two loadbalancers
Virtual_ipaddress {
192.168.0.211 dev eth0
}
Track_script {
Check_proxy
}
}
# Virtual interface 2
# The priority specifies the order in which the assigned interface to take over in a failover
Vrrp_instance VI_02 {
State MASTER
Interface eth0
Virtual_router_id 52
Priority 102
# The virtual ip address shared between the two loadbalancers
Virtual_ipaddress {
192.168.0.212 dev eth0
}
Track_script {
Check_proxy
}
}
Principal two:
Global_defs {
# Keepalived process identifier
Lvs_id MySQL_HA
}
# Script used to check if Proxy is running
Vrrp_script check_proxy {
Script "killall-0 mysql"
Interval 2
Weight 3
}
# Virtual interface 1
# The priority specifies the order in which the assigned interface to take over in a failover
Vrrp_instance VI_01 {
State MASTER
Interface eth0
Virtual_router_id 51
Priority 102
# The virtual ip address shared between the two loadbalancers
Virtual_ipaddress {
10.103.9.211 dev eth0
}
Track_script {
Check_proxy
}
}
# Virtual interface 2
# The priority specifies the order in which the assigned interface to take over in a failover
Vrrp_instance VI_02 {
State MASTER
Interface eth0
Virtual_router_id 52
Priority 100
# The virtual ip address shared between the two loadbalancers
Virtual_ipaddress {
192.168.0.212 dev eth0
}
Track_script {
Check_proxy
}
}
For the above analysis of MySQL dual-master high availability configuration method, if you have more information, you can continue to pay attention to the innovation of our industry. If you need professional solutions, you can contact the pre-sale and after-sale ones on the official website. I hope this article can bring you some knowledge updates.
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.