[root@c01 tmp]# fpm -s dir -t rpm -v 1.7.7 -n haproxy --before-install /tmp/haproxy_before.sh --after-install /tmp/haproxy_after.sh --after-remove /tmp/haproxy_remove.sh -d 'libaio' /apps/haproxy-1.7.7/ /etc/init.d/haproxy_sc

查看脚本:

[root@c01 tmp]# cat haproxy_before.sh
#!/bin/bash
if [ ! -d /apps/haproxy-1.7.7 ];then
mkdir -p /apps/haproxy-1.7.7
fi [root@c01 tmp]# cat haproxy_after.sh
#!/bin/bash
mkdir /apps/haproxy-1.7.7/conf
echo "
global
log 127.0.0.1 local0 info #[err warning info debug] //日志位置
maxconn 4096
daemon #设置成后台运行
nbproc 1 #进程数量
pidfile /apps/haproxy-1.7.7/haproxy.pid defaults
log global
mode http #默认模式
option httplog #http日志格式
option dontlognull
retries 3 #三次失败后认为服务器不可用
option redispatch #如果cookie写入了serverId而客户端不会刷新cookie,当serverId对应的服务器挂掉后,强制定向到其他健康的服务器
maxconn 2000 #当服务器负载很高的时候,自动结束掉当前队列处理比较久的链接默认的最大连接数
contimeout 5000 #连接超时
clitimeout 30000 #客户端超时
srvtimeout 30000 #服务器超时 frontend web_in
mode http
maxconn 1000
bind :80
acl is_a hdr_beg(host) -i www.espressos1.com #判断域名是不是www.espressos1.com,是则给与a服务器集群服务
acl is_b hdr_beg(host) -i www.espressos2.com #判断域名是不是www.espressos2.com,是则给与a服务器集群服务 use_backend a_server if is_a
use_backend b_server if is_b backend a_server
mode http #http 模式
stats uri /haproxy
balance roundrobin
cookie JSESSIONID prefix
stats hide-version
option httpclose
server web1 10.100.0.220:80 check
#server web2 128.1.2.5:80 check backend b_server
mode http #http 模式
stats uri /haproxy
balance roundrobin
cookie JSESSIONID prefix stats hide-version
option httpclose
server web1 10.100.0.229:80 ">/apps/haproxy-1.7.7/conf/haproxy.conf.acl
echo "
global
log 127.0.0.1 local0 info
maxconn 51200
user nobody
group nobody
daemon
nbproc 1
pidfile /var/run/haproxy.pid defaults
log global
mode http
option httplog
option tcplog
option httpclose
option forwardfor except 127.0.0.0/8
option redispatch
option dontlognull
retries 3
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 5s
timeout http-request 10s
timeout http-keep-alive 10s
timeout queue 1m
maxconn 10000
listen admin_stats
bind 0.0.0.0:9001
mode http
stats refresh 30s
stats uri /ha-stu
stats realm welcome login\ Haproxy
stats auth admin:admin@!
stats hide-version
stats admin if TRUE
#
listen mysql
bind 0.0.0.0:3306
mode tcp
# balance roundrobin
balance source
server mysql-01 xxx.xxx.xxx.xxx:3306
#
listen mysql-ds
bind 0.0.0.0:3307
mode tcp
# balance roudrobin
balance source
server mysql-02 xx.xxx.xxx.xxx:3306 ">/apps/haproxy-1.7.7/conf/haproxy.conf.nomal
[root@c01 tmp]# cat haproxy_remove.sh
#!/bin/bash
if [ -d /apps/haproxy-1.7.7 ];then
rm -rf /apps/haproxy-1.7.7
fi

haproxy rpm制做的更多相关文章

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

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

  2. HAproxy+varnish动静分离部署wordpress

    author:JevonWei 版权声明:原创作品 实验背景:将wordpress应用部署在后端服务器上,使用HAProxy做代理服务器,Varnish做缓存服务器,后端有四台web服务器,web1和 ...

  3. Haproxy基于ACL做访问控制

    author:JevonWei 版权声明:原创作品 haproxy配置文档 https://cbonte.github.io/haproxy-dconv/ 基于ACL做访问控制(四层代理) 网络拓扑 ...

  4. HAproxy功能配置

    author:JevonWei 版权声明:原创作品 haproxy配置文档 https://cbonte.github.io/haproxy-dconv/ 环境 前端HAProxy 172.16.25 ...

  5. HAProxy 实现 mysql 负载均衡

    通过yum 安装和配置HAProxy # yum install -y haproxy     #安装haproxy # rpm -qa | grep haproxy     #查看安装的haprox ...

  6. haproxy监控页面添加及参数简介(转)

    环境: [root@localhost 13:55:31 haproxy]# cat /etc/redhat-release CentOS release 6.8 (Final) [root@loca ...

  7. linux中级之HAProxy基础配置

    一.haproxy简介 HAProxy是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件,HAProxy是完全免费的.借助HAProxy可以快速并且可靠的提供基于T ...

  8. Haproxy部署及控制台使用手册

    一.介绍 1.简介 HAProxy是一个使用C语言编写开源软件,提供高可用,负载均衡,以及基于TCP(四层)和HTTP(七层)的应用程序代理: HAProxy特别适用于那些负载特大的web站点,这些站 ...

  9. 制做RPM包

    http://nmshuishui.blog.51cto.com/1850554/1583117 [root@NGM ~]# yum install pcre-devel zlib-devel ope ...

随机推荐

  1. python模块之imghdr(识别不同格式的图片文件)

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python模块之imghdr(识别不同格式的图片文件) import imghdr '''>> ...

  2. bootstrap table + spring + springmvc + mybatis 实现从前端到后端的表格分页

    1.使用准备 前台需要的资源文件,主要有Bootstrap3相关css.js以及bootstrap Table相关css.js: <-- 样式 --> <link rel=" ...

  3. Swift 中的闭包与 C 和 Objective-C中的 blocks 以及其它一些编程语言中的 lambdas 比較类似。

    闭包是功能性自包括模块,能够在代码中被传递和使用. Swift 中的闭包与 C 和 Objective-C中的 blocks 以及其它一些编程语言中的 lambdas 比較相似.  闭包能够 捕获 和 ...

  4. mysql find_in_set

    select * from IpResourceInfo a where find_in_set(a.id,(SELECT group_concat(CAST(resourcesid AS char) ...

  5. ios中layoutsubview何时被调用

    layoutsubview和viewDidlayoutsubview(控制器)被调用的集中情况 一:当view的frame或bounds发生改变 1:直接改view的frame或bounds 会调用v ...

  6. asiHttpRequst 学习地址

    最全面的地址 http://blog.csdn.net/uxyheaven/article/details/7884734 http://allseeing-i.com/ASIHTTPRequest/ ...

  7. Swift 导航栏设置图片点击事件,图片蓝色的解决方案

    如果导航栏想做一个点击事件,正好是一个图片 我们可以直接这样: self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIIm ...

  8. Mac系统清理、占用空间大、空间不够、查看系统文件大小分布

    背景: 最近老提示空间不够,很尴尬,一直弹系统提示 如图,256的空间,就剩下几个G了,其中最大头的系统占用:160G,占比60%多 正常情况下:我们可以点击管理,进入到系统磁盘优化界面: 这种适用于 ...

  9. ios实例开发精品文章推荐(7.22)

    UIView 基本方法 UIView的一些基本方法理解:loadView.viewDidLoad.viewDidUnload.viewWillAppear,viewWillDisappear init ...

  10. MATLAB 的函数

    [需要注意]MATLAB函数不能先定义后调用! 如下为先定义后调用,结果报错: 错误: 文件:justTest2.m 行:88 列:5脚本中的函数定义必须出现在文件的结尾.请将 "mymax ...