首页 > 其他 > 详细

RabbitMQ——用HAProxy实现负载均衡

时间:2021-05-07 14:59:16      阅读:28      评论:0      收藏:0      [点我收藏+]

linux安装haproxy

yum search haproxy     或者     yum list | grep haproxy

技术分享图片

yum install -y haproxy.x86_64     安装  

rpm -qi haproxy       查看版本

haproxy --help

vim /etc/haproxy/haproxy.cfg  配置文件

haproxy -f /etc/haproxy/haproxy.cfg   指定配置文件

service haproxy start

service haproxy status

HAProxy控制台   http://4.14.21.19:7100/stats

 

在RabbitMQ镜像集群已装好的前提下,

HAProxy配置文件新添部分备份如下:

#haproxy monitor
listen monitor
        bind 0.0.0.0:7100
        mode http
        option httplog
        stats enable
        maxconn 10
        stats uri /stats
        stats refresh 5s
        stats   realm haproxy  #认证时的realm,作为提示用的
        stats   auth admin:Fire001  #认证用户名和密码
        stats   hide-version  #隐藏HAProxy版本号
        stats   admin if TRUE  #管理界面只有认证通过后才能在ui上进行管理



#rabbitmq cluster
listen rabbitmq_cluster
        bind 0.0.0.0:7107
        #配置TCP模式
        mode tcp
        #简单的轮询
        balance roundrobin
        #RabbitMQ集群节点配置
        server rabbitmq_node1 172.31.140.161:7101 check inter 5000 rise 2 fall 3 weight 1
        server rabbitmq_node2 172.31.140.161:7103 check inter 5000 rise 2 fall 3 weight 1
        server rabbitmq_node3 172.31.140.161:7103 check inter 5000 rise 2 fall 3 weight 1

#rabbitmq console
listen rabbitm1_console
   bind 0.0.0.0:7108
   mode http
   balance roundrobin
   server rabbitmq_console1 172.31.140.161:7102
   server rabbitmq_console2 172.31.140.161:7104
   server rabbitmq_console3 172.31.140.161:7106

 

RabbitMQ——用HAProxy实现负载均衡

原文:https://www.cnblogs.com/xingchong/p/14738588.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!