rabbitMQ学习笔记【三】-haproxy部署 原创

一、下载
https://fossies.org/linux/misc/haproxy-1.8.5.tar.gz

二、安装
cd /usr/local
tar -zxvf haproxy-1.8.5.tar.gz
cd haproxy-1.8.5
make TARGET=linux2628 ARCH=x86_64 PREFIX=/usr/local/haproxy
make install PREFIX=/usr/local/haproxy

三、配置
vi [url="http://dl.iteye.com/topics/download/a56eb9d3-5082-3f3d-8366-0d32e4d16efd"]/usr/local/haproxy/sbin/haproxy.cfg[/url]

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1 local2
chroot /usr/local/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user nobody
group nobody
daemon
defaults
mode tcp
log global
#option httplog
option dontlognull
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 600
listen stats
mode http
bind 0.0.0.0:1080
stats enable
stats hide-version
stats uri /haproxyadmin?stats
stats realm Haproxy\ Statistics
stats auth admin:admin
stats admin if TRUE
frontend rabbitmq
bind *:5672
mode tcp
log global
default_backend rabbitmqs
backend rabbitmqs
balance leastconn
server rabbitmq1 192.168.3.9:5672 check port 5672 inter 5000 rise 1 fall 2 maxconn 300
server rabbitmq2 192.168.3.10:5672 check port 5672 inter 5000 rise 1 fall 2 maxconn 300
server rabbitmq3 192.168.3.18:5672 check port 5672 inter 5000 rise 1 fall 2 maxconn 300


四、启动
cd /usr/local/haproxy/sbin
./haproxy -f haproxy.cfg

五、统计界面
http://192.168.3.143:1080/haproxyadmin?stats
[img]http://dl2.iteye.com/upload/attachment/0129/5082/6f9d0128-5a98-371b-ac8e-05f48c8054aa.png[/img]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值