1:下载haproxy
wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.20.tar.gz
2:解压,编译,安装
tar zxf haproxy-1.3.20.tar.gz
cd haproxy-1.3.20
uname -a
make TARGET=linux2.6 PREFIX=/usr/local/product/haproxy-1.3.20
make install PREFIX=/usr/local/product/haproxy-1.3.20
3:ln -s /usr/local/product/haproxy-1.5.9 /usr/local/haproxy
4:创建haproxy配置文件
mkdir /etc/haproxy
cd /etc/haproxy
vi haproxy.cfg
########################
global
  log 127.0.0.1 local0
  log 127.0.0.1 local1 notice
  #log loghost local0 info
  maxconn 4096
  #chroot /usr/share/haproxy
  user www
  group www
  daemon
  nbproc 8
  #debug
  #quiet

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代理mysql
listen mysql_db 0.0.0.0:3306
  server db_1 rdsh0t197b6ly9dth6c5.mysql.rds.aliyuncs.com:3306 check inter 2000 rise 2 fall 5

#Ha代理http
listen http_app 0.0.0.0:8080
  mode http
  option httplog
  balance roundrobin
  server app1 172.21.8.188:80 cookie app1 weight 5 check inter 2000 rise 2 fall 3

#HA web页面
#没有验证过
listen  admin_stats
        bind  0.0.0.0:81
        mode  http
        stats refresh 30s
        stats uri /haproxy-status
        stats realm Global\ statistics
        stats auth httx:abc(用户名:密码)
 
#HA代理多台机器
#没有考证过
listen proxy-gps-smart
        bind     0.0.0.0:9001
        mode     tcp
        option   tcplog
        balance  leastconn
        maxconn  200000
        option   tcpka
        server   gps63 172.17.100.63:2966 weight 1 check port 2966 inter 1s rise 2 fall 2
        server   gps64 172.17.100.64:2966 weight 1 check port 2966 inter 1s rise 2 fall 2
        server   gps65 172.17.100.65:2966 weight 1 check port 2966 inter 1s rise 2 fall 2
        server   gps66 172.17.100.66:2966 weight 1 check port 2966 inter 1s rise 2 fall 2
      server   gps67 172.17.100.67:2966 weight 1 check port 2966 inter 1s rise 2 fall 2

5:启动haproxy
/usr/local/haproxy/sbin/haproxy -f /etc/haproxy/haproxy.cfg

6:haproxy 启动
cp /haproxy-1.3.20/examples/haproxy.init /etc/init.d/haproxy
cp /usr/local/haproxy/sbin/haproxy /usr/sbin/
chmod a+x /etc/init.d/haproxy

搭建haproxy的更多相关文章

  1. 利用ansible书写playbook搭建HAProxy+Keepalived+PXC负载均衡和高可用的PXC环境续

    ansible.playbook.haproxy.keepalived.PXC haproxy+keepalived双主模式调度pxc集群 HAProxy介绍 反向代理服务器,支持双机热备支持虚拟主机 ...

  2. Docker搭建HAproxy+tomcat 实现高可用

    构建业务镜像1创建tomcat-app1和tomcat-app2两个目录,代表不同的两个基于tomcat的业务.准备tomcat的配置文件[root@localhost ~]#mkdir -p /da ...

  3. MariaDB+Galera+Haproxy+Keepalived搭建集群

    1.MariaDB Galera Cluster介绍 MariaDB Galera Cluster是MariaDB同步多主机集群,它仅支持XtraDB/InnoDB存储引擎,在MySQLInnoDB存 ...

  4. mqtt haproxy 代理及负载搭建

    目录 mqtt 分布集群搭建 haproxy 安装配置 解压 安装 配置haproxy.cfg 启动haproxy 配置mqtt 测试 负载配置说明 负载均衡算法 ACL规则定义 全局配置 默认配置 ...

  5. Mysql的Haproxy反向代理和负载均衡

    HaProxy提供高可用性.负载均衡以及基于TCP和HTTP应用的代理,支持虚拟主机,它是免费.快速并且可靠的一种解决方案.应用到Haproxy主要是因为他免费,并且基于TCP和HTTP的应用代理. ...

  6. 使用Codis搭建redis集群服务

    转(http://www.jianshu.com/p/f8e968e57863) 一. 应用场景 redis 作为数据结构存储引擎,有着很多优点 高性能单机引擎可以达到5-10W qps 数据结构全面 ...

  7. 搭建 RabbitMQ Server 高可用集群

    阅读目录: 准备工作 搭建 RabbitMQ Server 单机版 RabbitMQ Server 高可用集群相关概念 搭建 RabbitMQ Server 高可用集群 搭建 HAProxy 负载均衡 ...

  8. KeepAlived+HaProxy+MyCat+Percona双机热备PXC集群

    一.搭建PXC集群 1.环境:centos7+PXC5.7.21+mycat1.6.5 2.卸载mariadb rpm -qa | grep mariadb* yum -y remove mariad ...

  9. HAProxy从零开始到掌握

    转自:https://www.jianshu.com/p/c9f6d55288c0 目录: HAProxy是什么 HAProxy的核心能力和关键特性 HAProxy的安装和运行 使用HAProxy搭建 ...

随机推荐

  1. SQL Server自动化运维系列——批量执行SQL脚本(Power Shell)

    需求描述 一般在生产环境中,在投产的情况下,需要批量的来执行SQL脚本文件,来完成整个投产,如果投产文件比较多的情况下,无疑这是一个比较痛苦的过程,所以本篇通过PowerShell脚本来批量完成. 监 ...

  2. 大数据系列(2)——Hadoop集群坏境CentOS安装

    前言 前面我们主要分析了搭建Hadoop集群所需要准备的内容和一些提前规划好的项,本篇我们主要来分析如何安装CentOS操作系统,以及一些基础的设置,闲言少叙,我们进入本篇的正题. 技术准备 VMwa ...

  3. mysql 安装问题

    针对免安装版的mysql: 1.启动CMD,在mysql安装目录下  ~\bin\目录下,输入: mysqld -install   安装msyql服务: 2.启动MySQL服务,输入: net st ...

  4. NYOJ 451

    光棍节的快乐 描述 光棍们,今天是光棍节.聪明的NS想到了一个活动来丰富这个光棍节. 规则如下: 每个光棍在一个纸条上写一个自己心仪女生的名字,然后把这些纸条装进一个盒子里,这些光 棍依次抽取一张纸条 ...

  5. 防SQL注入

    addslashes(); 一.SQL注入简介 SQL注入是比较常见的网络攻击方式之一,它不是利用操作系统的BUG来实现攻击,而是针对程序员编程时的疏忽,通过SQL语句,实现无帐号登录,甚至篡改数据库 ...

  6. intel和AMD CPU性能对比(2016年CPU天梯图)组装电脑必读!

    http://www.365pcbuy.com/article-411.html 特别提示:此文已经于2016年10月12日更新!内容变动较大,请细细品鉴! 如何为客户推荐高性价比机型是我站的重要工作 ...

  7. 2748: [HAOI2012]音量调节 bzoj

    Description 一个吉他手准备参加一场演出.他不喜欢在演出时始终使用同一个音量,所以他决定每一首歌之前他都要改变一次音量.在演出开始之前,他已经做好了一个列表,里面写着在每首歌开始之前他想要改 ...

  8. LeetCode:Max Points on a Line

    题目链接 Given n points on a 2D plane, find the maximum number of points that lie on the same straight l ...

  9. .NET Core 1.0 RC2 历险之旅

    文章背景:对于.NET Core大家应该并不陌生, 从它被 宣布 到现在已经有1-2年的时间了,其比较重要的一个版本1.0 RC2 也即将发布..Net Core从一个一个的测试版到现在的RC2,经历 ...

  10. Win10 UWP 开发学习代码(不断更新)

    页面之间跳转(传值) string txt = "Spring Lee"; this.Frame.Navigate(typeof(BlankPage1),txt); 另一个页面接收 ...