一:安装haproxy

  1:解压   编译   安装

  tar zxf haproxy-1.7.9.tar.gz

cd  haproxy-1.7.9

uname -e

make TARGET=linux2.6 PREFIX=/usr/local/haproxy

make install PREFIX=/usr/local/haproxy

二:创建haproxy配置文件

mkdir /etc/haproxy

cd /etc/haproxy/

vi   haproxy.cfg

########################
global
    log 127.0.0.1 local0
    log 127.0.0.1 local1 notice
    maxconn 4096
    user www
    group www
    daemon
    nbproc 8

defaults
    log global
    mode tcp
    option tcplog
    option dontlognull
    retries 3
    option redispatch
    maxconn 2000
    timeout connect 50000
    timeout client 50000
    timeout server 50000

#Ha代理192.168.6.140 22端口
listen sshd
    bind 0.0.0.0:11000
    server 140_ssh 192.168.6.140:22 check inter 2000 rise 2 fall 5

#Ha代理http
listen 192.168.6.140_tomcat
    bind 0.0.0.0:11001
    mode http
    balance roundrobin
    server web1 192.168.6.140:8080 weight 1 maxconn 10000 check inter 3s rise 3 fall 3

# Ha代理redis

listen redis
    bind 0.0.0.0:9999
    balance leastconn
    mode tcp
    # redis 健康检查,确保只有master提供连接
    option tcp-check
    tcp-check connect
    tcp-check send PING\r\n
    tcp-check expect string +PONG
    tcp-check send info\ replication\r\n
    tcp-check expect string role:master
    tcp-check send QUIT\r\n
    tcp-check expect string +OK
    server redis01 127.0.0.1:6380 check port 6380 inter 5s fastinter 2s downinter 5s rise 3 fall 3
    server redis02 127.0.0.1:6381 check port 6381 inter 5s fastinter 2s downinter 5s rise 3 fall 3

# Ha web页面配置

listen status

bind *:10000
    mode http
    stats enable
    stats uri /status
    stats refresh 5s
    stats show-node
    stats show-legends
    stats hide-version
    bind-process 2

三:配置haproxy启动脚本

cp /haproxy-1.7.9/examples/haproxy.init /etc/init.d/haproxy
cp /usr/local/haproxy/sbin/haproxy /usr/sbin/
chmod a+x /etc/init.d/haproxy

四:启动haproxy服务

/usr/local/haproxy/sbin/haproxy -f /etc/haproxy/haproxy.cfg

/etc/init.d/haproxy start

Haproxy 代理的更多相关文章

  1. 利用HAProxy代理SQL Server的AlwaysOn辅助副本

    利用HAProxy代理SQL Server的AlwaysOn辅助副本 公司最近数据库升级到SQL Server2014 ,并部署了alwayson高可用集群 机房内有三套程序需要读取数据库 第一套:主 ...

  2. haproxy(8):haproxy代理MySQL要考虑的问题

    HaProxy系列文章:http://www.cnblogs.com/f-ck-need-u/p/7576137.html haproxy可以通过 TCP协议 来代理MySQL.但是两个问题必须考虑: ...

  3. haproxy代理https配置方法【转】

    记得在之前的一篇文章中介绍了nginx反向代理https的方法,今天这里介绍下haproxy代理https的方法: haproxy代理https有两种方式:1)haproxy服务器本身提供ssl证书, ...

  4. [ Mariadb ] 通过HAProxy代理后端Mariadb实现负载均衡

    一.本次环境架构图 由于公司内网服务器有限,所以后端采用Mariadb自带的mysql_multi模型实现多实例. mysql的多实例有两种方式可以实现,两种方式各有利弊. 1.使用多个配置文件启动不 ...

  5. haproxy代理kibana、nginx代理kibana并实现登录验证

    在使用ELK进行日志统计的时候,由于Kibana自身并没有身份验证的功能,任何人只要知道链接地址就可以正常登录到Kibana控制界面,由于日常的查询,添加和删除日志都是在同一个web中进行,这样就有极 ...

  6. 使用Haproxy代理rabbitmq集群,用keepalive保证haproxy高可用

    原文地址:https://www.jianshu.com/p/440b8e1d5339 使用Haproxy代理rabbitmq集群 上一篇文章教了rabbitmq集群搭建.但是这样搭建出来的集群是3个 ...

  7. [原]HAproxy 代理技术原理探究

    HAproxy 技术分享 简介 HAProxy是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件 Features 1.免费 2.能够做到4层以上代理 3.高性能 ...

  8. HAProxy 代理负载均衡

    HAProxy HAProxy是免费 高效 可靠的高可用及负载均衡解决方案,该软件非常适合于处理高负载站点的七层数据请求,HAProxy的工作模式使其可以非常容易且安全地集成到我们现有的站点架构中.使 ...

  9. haproxy代理配置段参数设定

    代理配置段:有四个配置段 default:设定默认参数, frontenf:前端服务器的设定 backend:后端服务器的设定 listening:是设定前端和后端一一对应的设定 参数: 1bind: ...

  10. HAproxy 代理技术原理探究

    HAproxy 技术分享 简介 HAProxy是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件 Features 1.免费 2.能够做到4层以上代理 3.高性能 ...

随机推荐

  1. Oracle 导入dump

    1. 准备好.dmp文件

  2. 第三章 指令-- 30 指令-使用钩子函数的第二个binding参数拿到传递的值

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  3. spring ObjectFactory

    AspectJAwareAdvisorAutoProxyCreator implements PostProcessor postProcessorAfterInitialization(Object ...

  4. Linux下内存查看及详解

    在Linux下面,我们常用top命令来查看系统进程,top也能显示系统内存.我们常用的Linux下查看内容的专用工具是free命令. Linux下内存查看命令free详解: 在Linux下查看内存我们 ...

  5. ES使用中的总结整理

    最近项目中使用了ES搜索,开始时自己搭建了ES环境做测试,后面申请了公司的云平台应用, 对接ES的过程中颇具波折,遇到了很多问题,在这里统一整理记录下: 1,ES的9200 及 9300端口说明 92 ...

  6. vscode存盘时格式化

    1.文件->首选项->设置

  7. C# DataGridView 更改类型 重绘

    DataGridView   更改类型 需要用到重绘 DataGridViewTextBoxColumn aa01 = new DataGridViewTextBoxColumn(); aa00.Da ...

  8. 批处理(.bat)文件使用笔记

    color: 一位参数时→改变字体颜色,例如 color a 就是修改字体为亮绿色. 两位参数时→改变背景和字体颜色,第一位参数为背景颜色值,第二位参数为字体颜色值. color [BF] B:背景颜 ...

  9. CF#356 div2 C 猜数字

    C. Bear and Prime 100 time limit per test 1 second memory limit per test 256 megabytes input standar ...

  10. linux crontab 定时任务,任务命令单独linux执行正常,放定时任务就不执行了,解决办法 (原)

    这是我crontab里面的内容 */30 * * * *  ./usr/bin/wget -q -O sync_log.txt http://fly.dllm.cn/index.php/Home/In ...