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 /usr/local/haproxy/sbin/haproxy.cfg
  
#---------------------------------------------------------------------
# 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
rabbitMQ学习笔记【三】-haproxy部署 原创_第1张图片
  • rabbitMQ学习笔记【三】-haproxy部署 原创_第2张图片
  • 大小: 63.2 KB
  • haproxy.cfg.zip (767 Bytes)
  • 下载次数: 1
  • 查看图片附件

你可能感兴趣的:(haproxy)