HAProxy安装配置

一、HAProxy安装

haproxy安装在106.14.141.169这台服务器上。

yum install haproxy

二、HAProxy配置

配置文件路径:/etc/haproxy/haproxy.cfg

修改为如下:

#listen rabbitmq_admin 0.0.0.0:8002

#   server izuf6a1s9ws9726xatwn47z 192.168.3.30:15672

#   server izuf6a1s9ws9726xatwn46z 192.168.3.31:15672

#   server izuf6a1s9ws9726xatwn45z 192.168.3.32:15672

 

#绑定配置

listen rabbitmq_cluster 0.0.0.0:8001

        #配置tcp模式

        mode tcp

        option tcplog

        #简单的轮询

        balance roundrobin

        #RabbitMQ集群节点配置

        server izuf6a1s9ws9726xatwn47z 192.168.3.30:5672 check inter 5000 rise 2 fall 2

        server izuf6a1s9ws9726xatwn46z 192.168.3.31:5672 check inter 5000 rise 2 fall 2

        server izuf6a1s9ws9726xatwn45z 192.168.3.32:5672 check inter 5000 rise 2 fall 2

 

#haproxy监控页面配置

listen monitor :8000

        mode http

        option httplog

        stats enable

        #设置haproxy监控地址为http://localhost:8000/rabbitmq-stats

        stats uri /rabbitmq-stats

        stats refresh 30s

        #添加用户名密码认证

        stats auth admin:1234

 

三、HAProxy启停

到/etc/haproxy目录下,启动haproxy

haproxy -f haproxy.cfg

停止haproxy

ps -ef | grep haproxy

kill -9 pid

重新启动haproxy

sudo service haproxy restart

四、验证

打开url: http://106.14.141.169:8000/rabbitmq-stats,账号密码admin/1234

然后看到相关信息即为成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值