1.安装haproxy

yum -y install haproxy

2.配置文件

# this config needs haproxy-1.1. or haproxy-1.2.

global

        log 127.0.0.1   local0

        log 127.0.0.1   local1 notice

        #log loghost    local0 info

        maxconn 

        chroot /usr/share/haproxy

        uid 

        gid 

        daemon

        #debug

        #quiet

defaults

        log     global

        mode    http

        option  httplog

        option  dontlognull

        retries 

        redispatch

        maxconn 

        contimeout      

        clitimeout      

        srvtimeout      

listen  appli1-rewrite 0.0.0.0:

        cookie  SERVERID rewrite

        balance roundrobin

        server  app1_1 192.168.34.23: cookie app1inst1 check inter  rise  fall 

        server  app1_2 192.168.34.32: cookie app1inst2 check inter  rise  fall 

        server  app1_3 192.168.34.27: cookie app1inst3 check inter  rise  fall 

        server  app1_4 192.168.34.42: cookie app1inst4 check inter  rise  fall 

listen  appli2-insert 0.0.0.0:

        option  httpchk

        balance roundrobin

        cookie  SERVERID insert indirect nocache

        server  inst1 192.168.114.56: cookie server01 check inter  fall 

        server  inst2 192.168.114.56: cookie server02 check inter  fall 

        capture cookie vgnvisitor= len 

        option  httpclose               # disable keep-alive

        rspidel ^Set-cookie:\ IP=       # do not let this cookie tell our internal IP address

listen  appli3-relais 0.0.0.0:

        dispatch 192.168.135.17:

listen  appli4-backup 0.0.0.0:

        option  httpchk /index.html

        option  persist

        balance roundrobin

        server  inst1 192.168.114.56: check inter  fall 

        server  inst2 192.168.114.56: check inter  fall  backup

listen  ssl-relay 0.0.0.0:

        option  ssl-hello-chk

        balance source

        server  inst1 192.168.110.56: check inter  fall 

        server  inst2 192.168.110.57: check inter  fall 

        server  back1 192.168.120.58: backup

listen  appli5-backup 0.0.0.0:

        option  httpchk *

        balance roundrobin

        cookie  SERVERID insert indirect nocache

        server  inst1 192.168.114.56: cookie server01 check inter  fall 

        server  inst2 192.168.114.56: cookie server02 check inter  fall 

        server  inst3 192.168.114.57: backup check inter  fall 

        capture cookie ASPSESSION len 

        srvtimeout      

        option  httpclose               # disable keep-alive

        option  checkcache              # block response if set-cookie & cacheable

        rspidel ^Set-cookie:\ IP=       # do not let this cookie tell our internal IP address

        errorloc             http://192.168.114.58/error502.html

        errorfile            /etc/haproxy/errors/.http

haproxy笔记之一:Haproxy基本安装配置(反向代理,类似Nginx,可以代理tcp的连接,不只是http)(注意iptables和selinux的问题)的更多相关文章

  1. Apache 2.4.7在CentOS6.4中安装配置反向代理解决单外网IP对应多个内网主机的方法实践

    欢迎转载,转载时请保留全文及出处. Apache 2.4.7在CentOS6.4中安装配置反向代理解决单外网IP对应多个内网主机的方法实践 Apache安装 下载源程序(http://httpd.ap ...

  2. 笔记-python-centos环境下安装配置

    笔记-python-centos环境下安装配置 1.      准备工作 环境准备 centos6.5 mini,已有python 2.6.6 下载源码包 Python官网下载Gzipped sour ...

  3. 阿里云服务器Linux CentOS安装配置(八)nginx安装、配置、域名绑定

    阿里云服务器Linux CentOS安装配置(八)nginx安装.配置.域名绑定 1.安装nginx yum -y install nginx 2.启动nginx service nginx star ...

  4. CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL)

    CentOS 6.5安装配置LNMP服务器(Nginx+PHP+MySQL) 一.准备篇: /etc/init.d/iptables stop #关闭防火墙 关闭SELINUX vi /etc/sel ...

  5. MongoDB入门学习笔记之简介与安装配置

    一.MongoDB简介 1.文档数据库 MongoDB是一款开源的文档型非关系数据库,具有高性能.高可靠性和自动扩展等特点.MongoDB中的每一条记录是一个文档,其数据存储结构为键/值对,类似JSO ...

  6. Hive学习笔记(二)—— 安装配置

    Hive安装配置及基本操作 1. Hive安装及配置 (1). 上传文件到Hadoop102节点,解压到/opt/moudle (2). 修改/opt/module/hive/conf目录下的hive ...

  7. 3-STM32物联网开发WIFI(ESP8266)+GPRS(Air202)系统方案数据篇(安装配置数据库,使用Navicat for MySQL和手机APP 连接测试)

    2-STM32物联网开发WIFI(ESP8266)+GPRS(Air202)系统方案数据篇(数据库简单说明) https://www.mysql.com/ 咱用安装版的 我把自己下载的放在了这里 现在 ...

  8. Ubuntu 16.04 安装配置支持http2的nginx

    第一步 安装最新版本的nginx 对于ubuntu16.04而言 直接装就是最新的 ``` sudo apt-get update sudo apt-get install nginx 查看Nginx ...

  9. 【MySQL笔记】mysql来源安装/配置步骤和支持中国gbk/gb2312编码配置

    不久的学习笔记.分享.我想有很大的帮助谁刚开始学习其他人的 备注:该票据于mysql-5.1.73版本号例如 1. mysql源代码编译/安装步骤 1) 官网下载mysql源代码并解压 2) cd至源 ...

随机推荐

  1. 用一行Python进行数据收集探索

    简易的Pandas之路 任何使用Python数据的人都会熟悉Pandas包.Pandas是大多数行和列格式数据的go-to包.如果你没有Pandas,请确保在终端中使用pip install安装: p ...

  2. PAT Advanced 1132 Cut Integer (20) [数学问题-简单数学]

    题目 Cutting an integer means to cut a K digits long integer Z into two integers of (K/2) digits long ...

  3. 运行SQL文件报错Invalid ON UPDATE clause for 'create_date' column

    Invalid ON UPDATE clause for 'create_date' column   原因: 高版本的mysql导数据到低版本出现的问题 日期类型报错 MySQL 5.5 每个表只允 ...

  4. mysql 不停机 短时间锁表 备份 主备同步 新增备份机器

    刷新数据   [root@localhost ~]# mysql -e 'flush tables with read lock;' 锁表刷新表数据   [root@localhost ~]# mys ...

  5. C盘满了解决办法之pagefile.sys文件

    pagefile.sys文件一般存在于C盘,只有点击了隐藏属性才能看见. 这个文件一般比较大,它是系统创建虚拟内存页面的文件.平时大家使用软件的时候对于产生大量的临时数据,这些数据需要占用大量内存,如 ...

  6. docker 一些简略环境搭建及部分链接

    1.center 7  搭建 docker https://www.cnblogs.com/yufeng218/p/8370670.html 2.docker 命令 https://www.cnblo ...

  7. Faraday Future,FF2019年一季度前完成第一阶段5亿美元左右的A+轮融资,2019年年底前完成7亿美元的Pre-IPO轮融资,2020IPO

    FF2019年一季度前完成第一阶段5亿美元左右的A+轮融资,2019年年底前完成7亿美元的Pre-IPO轮融资,2020IPO 区块链公司先行宣布将对FF进行投资.EVAIO(中文名:伊娃)公司 跨链 ...

  8. Python笔记_第一篇_面向过程_第一部分_5.Python数据类型之字典类型(dict)

    字典!在Python中字典是另一种可变容器模型,可以存储任意类型的对象.是Python存储数据类型的最高级(maybe). 特点:1. 字典的存储方式和其他类型数据略有不同,是通过键(key)和值(v ...

  9. 分辨率单位及换算,LW / PH、LP / mm、L / mm、Cycles / mm、Cycles / pixel、LP / PH

    对于测试数字成像设备非常重要的参数是分辨率.但有不同的方式来表达数码相机的分辨率,有时令人困惑.下面介绍的是是最常见的单位. 百万像素 “这台相机有1000万像素的分辨率”是我们经常在广告上看到的数据 ...

  10. chromosome interaction mapping|cis- and trans-regulation|de novo|SRS|LRS|Haplotype blocks|linkage disequilibrium

    Dissecting evolution and disease using comparative vertebrate genomics-The sequencing revolution   s ...