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. POJ-2561 Network Saboteur(DFS)

    题目: A university network is composed of N computers. System administrators gathered information on t ...

  2. 吴裕雄--天生自然 PYTHON3开发学习:运算符

    #!/usr/bin/python3 a = 21 b = 10 c = 0 c = a + b print ("1 - c 的值为:", c) c = a - b print ( ...

  3. Vus the Cossack and Strings(Codeforces Round #571 (Div. 2))(大佬的位运算实在是太强了!)

    C. Vus the Cossack and Strings Vus the Cossack has two binary strings, that is, strings that consist ...

  4. c语言中用简单方法对多维数组进行初始化

    例:int array[4][3] = {1,2,3,4,5,6,7,8,9,10,11,12}; 说明:a.由4*3可知,本二维数组包含12个元素,因此初始化时array[0][0] = 1 ,ar ...

  5. c语言中常用的串运算

    调用标准库函数 #include<string.h> 串比较,strcmp(char s1,char s2) 串复制,strcpy(char to,char from) 串连接,strca ...

  6. ant design vue 时间选择器只能到最大日期

    <a-date-picker :disabledDate="disabledEndDate"  style="width: 100%" placehold ...

  7. mysql超大sql导入(10G)

    mysql  大数据库文件上传(10G) phpstudy2017 环境  mysql 5.5.53   php 5.5.45 更改php.ini memory_limit 为 2048M php.i ...

  8. CkEditor - Custom CSS自定义样式

    CkEditor是目前世界上最多人用的富文本编辑器.遇上客户提需求,要改一下编辑器的样式,那就是深入CkEditor的底层来修改源码. 修改完的样式是这样,黑边,蓝底,迷之美学.这就是男人自信的表现, ...

  9. [Algo] 306. Check If Linked List Is Palindrome

    Given a linked list, check whether it is a palindrome. Examples: Input:   1 -> 2 -> 3 -> 2 ...

  10. systemd[1]: mariadb.service: Can't open PID file /data/mariadb/mysql/30-mariadb-1.pid (yet?) after start: No such file or directory

    环境:Centos8 编译安装Mariadb-10.4.11,安装到make install都没有问题,添加服务启动脚本到/lib/systemd/system/,服务启动脚本名为mariadb.se ...