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. Echatrs 中PIE饼图中间位置怎么显示总数值?

    title: { text: '总资产', subtext: '2000000.00', x: 'center', y: 'center' }图例:

  2. 模拟银行ATM系统(基础版)

    Account类 package ATM; public class Account {//定义Account类 private String accountID;//用于存储学生的用户账号(由八位数 ...

  3. c++局部变量在外可用的方法

    C++的局部变量在作用域结束后,一般都会被回收.如下面这段代码 map<a*, b*> _map; void fun() { a _a; b _b; _map[&_a] = &am ...

  4. 【转】Docker部署Tomcat及Web应用

    Docker部署Tomcat及Web应用 - Scofield_No1的博客 - CSDN博客https://blog.csdn.net/qq_32351227/article/details/786 ...

  5. vim 永久添加行号

    sudo vi /etc/vim/vimrc 打开vimrc文件,最下面添加set nu,保存就可以添加行号了,set autoindent是自动换行

  6. Python3练习题 035:Project Euler 007:第10001个素数

    import time def f(x): #判断 x 是否为素数,返回bool值 if x == 2: return True elif x <= 1: return False else: ...

  7. [转帖]windows7/windows NT介绍

    windows7/windows NT介绍 原文应该是IT168发布的 但是一直没找到 感觉看了之后 明白了很多 技术都是互相融合的 没有严格意义上的对立直说.   Windows 7/Windows ...

  8. Redis 使用命令行的方式 获取 hash type key 的value值

    1. 之前只是非常简单的看了下 get key 和 set key 但是这样 设置的 key value 应该是都 string 类型的 2. 但是没考虑过其他类型的 是如何获取 相关内容的 ,一直 ...

  9. Android——AsyncTask

    AsyncTask简单介绍 我们首先需要明确Android之所以有Handler和AsyncTask,都是为了不阻塞主线程(UI线程),且UI的更新只能在主线程中完成,因此异步处理是不可避免的.And ...

  10. 不使用DataContext直接将ViewModels绑定到ItemsControl控件

    在常规的MVVM设计模式中,都是通过DataContext将ViewModels的一个对象绑定到View的DataContext中,从而完成相应地绑定,在本文中我们将通过另外的一种思路来将ViewMo ...