1. Install Haproxy 
    CentOS/RHEL 5 , 32 bit:
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 
    CentOS/RHEL 5 , 64 bit:
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm 
    CentOS/RHEL 6 , 32 bit:
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 
    CentOS/RHEL 6 , 64 bit:
    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    yum -y install haproxy
  2. Configure Haproxy
    vi /etc/haproxy/haproxy.cfg
    global
    log 127.0.0.1 local0
    log 127.0.0.1 local1 debug
    maxconn # Total Max Connections.
    daemon
    nbproc # Number of processing cores.
    defaults
    log global
    mode http
    option httplog
    option dontlognull
    retries
    option redispatch
    maxconn
    timeout server
    timeout connect
    timeout client
    timeout queue 1000s # [HTTP Site Configuration]
    listen http_web 10.10.0.112:
    mode http
    balance roundrobin # Load Balancing algorithm
    option httpchk
    option forwardfor
    server server1 23.253.48.253: weight maxconn check
    server server2 208.43.40.162: weight maxconn check # [Change HAProxy Stats URL]
    listen stats 10.10.0.112:
    mode http
    log global
    balance roundrobin maxconn timeout server
    timeout connect
    timeout client
    timeout queue 1000s stats enable
    stats hide-version
    stats refresh 30s
    stats show-node
    stats realm Haproxy\ Statistics
    stats auth admin:password
    stats uri /ha-stats

    haproxy Code

    开启防火墙 1936 端口

  3. 重启相关服务
    service iptables restart 
    service haproxy restart
    chkconfig haproxy on
  4. 后台查看网站:
    http://10.10.0.112:1936/ha-stats  or  http://10.10.0.112:1936/stats
  5. 参考链接:
    http://tecadmin.net/install-and-configure-haproxy-on-centos/

How to intall and configure Haproxy on Centos的更多相关文章

  1. Configure Ocserv on CentOS 6

    Configure Ocserv on CentOS 6 Table of Contents 1. Install ocserv 2. Configure ocserv 3. How to host ...

  2. [scrapy-redis] install and configure scrapy-redis on CentOS 7 (1)

    0. 安装依赖 yum install -y zlib zlib-devel openssl openssl-devel bzip2 bzip2-devel sqlite-devel gcc wget ...

  3. haproxy 在centos上cannot bind 端口的问题

    setsebool -P haproxy_connect_any=1 要不把selinux干掉也行

  4. IP Failover Setup using Keepalived on CentOS/Redhat 6

    source url:http://tecadmin.net/ip-failover-setup-using-keepalived-on-centos-redhat-6/ Keepalived is ...

  5. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Mariadb 10.1.20 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  6. Cenos7 编译安装 Mariadb Nginx PHP Memcache ZendOpcache (实测 笔记 Centos 7.0 + Mariadb 10.0.15 + Nginx 1.6.2 + PHP 5.5.19)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...

  7. Configuring Network in CentOS 6.3 Virtual Box + Screenshots

    Configuring Network in CentOS 6.3 Virtual Box + Screenshots Posted: May 23, 2013 in Uncategorized Ta ...

  8. 编译安装LNMP Centos 6.5 x64 + Nginx1.6.0 + PHP5.5.13 + Mysql5.6.19

    (来自:http://www.cnblogs.com/vicowong/archive/2011/12/01/2116212.html) 环境: 系统硬件:vmware vsphere (CPU:2* ...

  9. Centos7 编译安装 Nginx PHP Mariadb Memcache扩展 ZendOpcache扩展 (实测 笔记 Centos 7.0 + Mariadb 10.1.9 + Nginx 1.9.9 + PHP 5.5.30)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1503-01.iso 安装步骤: 1.准备 1.1 ...

随机推荐

  1. java得到日期相减的天数

    /** * <li>功能描述:时间相减得到天数 * @param beginDateStr * @param endDateStr * @return * long * @author A ...

  2. html总结:表格中的文字居中

    <style> table { text-align:center; } </style>

  3. PHP的内存回收(GC)

    php官方对gc的介绍:http://php.net/manual/zh/features.gc.php

  4. NGINX Docs | Load Balancing Apache Tomcat Servers with NGINX Open Source and NGINX Plus

    NGINX Docs | Load Balancing Apache Tomcat Servers with NGINX Open Source and NGINX Plushttps://docs. ...

  5. 渗透测试平台bwapp简单介绍及安装

    先来介绍一下bwapp bwapp是一款非常好用的漏洞演示平台,包含有100多个漏洞 SQL, HTML, iFrame, SSI, OS Command, XML, XPath, LDAP, PHP ...

  6. Arrays.copyOf() 和 System.arrayCopy()分析

    java数组的拷贝四种方法:for.clone.System.arraycopy.Arrays.copyof public class Test1 { public static void main( ...

  7. [转帖]cmd批处理常用符号详解

    cmd批处理常用符号详解 https://www.jb51.net/article/32866.htm 很多符号 还是不清楚的.. 批处理能够极大的提高 工作效率 需要加强深入学习.   1.@一般在 ...

  8. getMessage(),getFile,getLine获取异常用法

    try { $param = $request->all(); $param['building_id'] = 0; $param['sync'] = 2; // 1小程序2App $param ...

  9. Spring是如何校验XML的

    首先来看下xml的一些概念: xml的schema里有namespace,可以给它起个别名.比如常见的spring的namespace: xmlns:mvc="http://www.spri ...

  10. npm --save-dev 和--save 参数的区别

    npm中的--save与--save-dev参数的区别 --save一般规定把产品运行时(或生产环境)需要的npm包存入到package.json的dependencies中: --save-dev则 ...