In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to achieve master-master replication in MySQL. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
1 Machine Planning 192.168.6.119keepalive+ipvsadm (Lvs)
192.168.6.121keepalive+ipvsadm (Lvs)
192.168.6.66VIP
192.168.6.114 real machine (testing httpd load balancing), lvs client
192.168.6.115 real machine (testing httpd load balancing), lvs client
It's needed on 114.115.
[root@node1 ~] # more / usr/local/bin/lvs_real
#! / bin/bash
# description: start realserver
VIP=192.168.6.66
/ etc/rc.d/init.d/functions
Case "$1" in
Start)
Echo "start LVS of REALServer"
/ sbin/ifconfig lo:0$ VIP broadcast $VIP netmask 255.255.255.255 up
Echo "1" > / proc/sys/net/ipv4/conf/lo/arp_ignore
Echo "2" > / proc/sys/net/ipv4/conf/lo/arp_announce
Echo "1" > / proc/sys/net/ipv4/conf/all/arp_ignore
Echo "2" > / proc/sys/net/ipv4/conf/all/arp_announce
Stop)
/ sbin/ifconfig lo:0 down
Echo "close LVS Directorserver"
Echo "0" > / proc/sys/net/ipv4/conf/lo/arp_ignore
Echo "0" > / proc/sys/net/ipv4/conf/lo/arp_announce
Echo "0" > / proc/sys/net/ipv4/conf/all/arp_ignore
Echo "0" > / proc/sys/net/ipv4/conf/all/arp_announce
*)
Echo "Usage: $0 {start | stop}"
Exit 1
Esac
Start client script
[root@node1 ~] # sh / usr/local/bin/lvs_real start
4 the server keepalive configuration file is as follows
119 121 machines (master / slave modify key points are fine)
[root@localhost keepalived] # more keepalived.conf
# writed by sery, contact sery@163.com
# guration File for keepalived
# global define
Global_defs {
Router_id LVS_CNC_1
}
Vrrp_sync_group VGM {
Group {
VI_CACHE
}
}
#
# vvrp_instance define #
#
Vrrp_instance VI_CACHE {
State MASTER
Interface eth0
Lvs_sync_daemon_inteface eth0
Virtual_router_id 51
Priority 180
Advert_int 5
Authentication {
Auth_type PASS
Auth_pass 1111
}
Virtual_ipaddress {
192.168.6.66
}
}
# # #
# virtual machine setting #
# # #
# setting port 80 forward
Virtual_server 192.168.6.66 80 {
Delay_loop 6
Lb_algo wlc
Lb_kind DR
# persistence_timeout 20
Protocol TCP
Real_server 192.168.6.114 80 {
Weight 100
TCP_CHECK {
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
Connect_port 80
}
}
Real_server 192.168.6.115 80 {
Weight 100
TCP_CHECK {
Connect_timeout 3
Nb_get_retry 3
Delay_before_retry 3
Connect_port 80
}
}
}
Start keepalive
[root@localhost ~] # / etc/init.d/keepalived start
Check the ipvsadm situation
[root@localhost keepalived] # ipvsadm-ln
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.6.66:80 wlc
-> 192.168.6.115 Route 80 100
-> 192.168.6.114 Route 80 100
After reading the above, do you have any further understanding of how to achieve master-master replication in MySQL? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.