当前位置:网站首页>14. Haproxy+kept load balancing and high availability
14. Haproxy+kept load balancing and high availability
2022-07-29 04:15:00 【Machoul】
haproxy+keepalived Load balancing and high availability
summary

- Multiple rabbitmq Services form clusters , from haproxy To do load balancing ,haproxy A port will be exposed , The client can use the haproxy Of the server ip+ Port to carry out alignment rabbitmq Use .
- But if it's a haproxy Words , When haproxy There is a single point of failure , So the whole rabbitmq There will be unavailable scenarios , So be right haproxy Make up your mind , Main operations to achieve high availability
- adopt keepalived Realization haproxy The master-slave relationship of , When one of them haproxy There is a failure and downtime , another haproxy We can continue to support the operation of our services , So as to achieve a highly available effect
haproxy Load balancing
Preparation conditions
- Three have been clustered rabbitmq The server
- 172.16.140.130:5672
- 172.16.140.131:5672
- 172.16.140.132:5672
- install haproxy Server for 172.16.140.130:5672
- Three have been clustered rabbitmq The server
install haproxy
yum install -y haproxycreate profile
mkdir -p /usr/local/config/haproxy cd /usr/local/config/haproxy vim haproxy.cfgAdd configuration content
global log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon defaults log global mode tcp option tcplog option dontlognull retries 3 option redispatch maxconn 2000 timeout connect 5s timeout client 120s timeout server 120s listen rabbitmq_cluster bind 0.0.0.0:5671 mode tcp balance roundrobin server rabbitmq_node1 172.16.140.130:5672 check inter 5000 rise 2 fall 2 server rabbitmq_node2 172.16.140.131:5672 check inter 5000 rise 2 fall 2 server rabbitmq_node3 172.16.140.132:5672 check inter 5000 rise 2 fall 2 listen monitor bind 0.0.0.0:8100 mode http option httplog stats enable stats uri /stats stats refresh 5sstart-up haproxy
haproxy -f /usr/local/config/haproxy/haproxy.cfgConnect in code rabbitmq The address to be filled in is haproxy Address , The port number is
rabbitmq_clusterAddress configured inCan pass monitor in 8100 To view the current service status
keepalived High availability
In the use of the haproxy after , We have achieved the goal of load balancing , But if it's just a haproxy Words , So when haproxy Downtime , So the whole rabbitmq Will be unavailable , So we need to use keepalived To realize the active and standby mode
preparation
- Three have been clustered rabbitmq The server
- 172.16.140.130:5672
- 172.16.140.131:5672
- 172.16.140.132:5672
- Two installations haproxy Server for
- 172.16.140.130:5672
- 172.16.140.131:5672
- Three have been clustered rabbitmq The server
Expected results : For two haproxy Provide active and standby mode
install keepalived
yum install -y keepalivedAfter installation , stay
/etc/keepalived/There are documents inkeepalived.conffile , Backup the original , Create a new profile .Configuration profile
global_defs { # Global configuration router_id lb01 # Identification -> name } vrrp_instance VI_HAPROXY { state MASTER # Identify character status interface ens160 # Network card binding interface virtual_router_id 51 # Virtual routing id priority 150 # priority advert_int 1 # Monitoring intervals authentication { # authentication auth_type PASS # authentication auth_pass 1111 # The authentication code } virtual_ipaddress { 172.16.140.167 # Virtual VIP Address } }start-up keepalived
systemctl start keepalived systemctl enable keepalivedThe above steps also need to be operated on the standby machine , The difference is the configuration file
global_defs { router_id lb02 } vrrp_instance VI_1 { state BACKUP interface ens160 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 172.16.140.167 } }see keepalived journal
tail -f /var/log/messages -n 200
边栏推荐
- Array as function parameter -- pointer constant / constant pointer
- Lua语言(stm32+2G/4G模块)和C语言(stm32+esp8266)从字符串中提取相关数据的方法-整理
- Asp. Net MVC, how can the controller in the folder jump to the controller in the root directory?
- Installation and use of stm32cubemx (5.3.0)
- Locker 2022.1.1
- GBase 8a特殊场景下屏蔽 ODBC 负载均衡方式?
- LCA 板子
- kotlin的List,Map,Set等集合类不指定类型
- 基于STM32和阿里云的环境检测系统设计
- 小程序:区域滚动、下拉刷新、上拉加载更多
猜你喜欢

SVG--loading动画

不会就坚持58天吧 实现前缀树

Install the laser of ROS_ scan_ Problems encountered in match library (I)

不会就坚持68天吧 狒狒吃香蕉

Note: restframe work records many to one tables, how to serialize in that table (reverse query)

Record of problems encountered in ROS learning

Fu Yingna: Yuan universe is the new generation of Internet!

Is the array name a pointer

不会就坚持59天吧 替换单词

顺序表和链表
随机推荐
STM32F103ZET6程序移植为C8T6+C8T6下载程序flash timeout的解决方案
12.优先级队列和惰性队列
请问为什么我进行mysql数据update时,kafka中采集到的是先删除原纪录(op d)再新增新
小程序:区域滚动、下拉刷新、上拉加载更多
SQL server how to judge when the parameter received by the stored procedure is of type int?
不会就坚持58天吧 实现前缀树
[k210 stepping pit] pytorch model is converted to kmodel and used on dock. (ultimately not achieved)
Multi rotor six axis hardware selection
SQL time fuzzy query datediff() function
Machine vision series 3:vs2019 opencv environment configuration
openFeign异步调用问题
[kvm] create virtual machine from kickstart file
这个报错是什么鬼啊,不影响执行结果,但是在执行sql时一直报错。。。连接maxComputer是使用
AssertionError(“Torch not compiled with CUDA enabled“)
Beginner: array & String
The function "postgis_version" cannot be found when installing PostGIS
Pat a1069/b1019 the black hole of numbers
Codeforces round 810 (Div. 2) d. rain (segment tree difference)
伏英娜:元宇宙就是新一代互联网!
There is a special cryptology language called asn.1