一 安装

[root@haproxy_master ~]# yum -y install gcc gcc-c++ make openssl-devel wget openssh-clients #安装编译工具
[root@haproxy_master ~]# service iptables stop
[root@haproxy_master ~]# chkconfig iptables off
[root@haproxy_master ~]# vi /etc/selinux/config
SELINUX=disabled

1.1 yum安装

[root@HAProxy ~]# yum -y install haproxy

二 常见参数

[root@haproxy_master ~]# haproxy -h
 
参数
说明
-v
显示当前版本信息:“-vv”显示已知的创建选项
-d
表示让警察运行在debug模式;-db表示禁用后台模式,让程序在前台运行。
-D
让程序以daemon模式启动,此选项也可以在HAProxy匹配文件中设置。
-q
表示无提示模式,程序运行不输出任何信息。
-c
对HAProxy配置文件进行语法检查,若配置文件错误,会输出对应的错误位置和错误信息。
-n
设置最大并发连接总数。
-m
限制可用的内存大小,以MB为单位。
-N
设置默认的连接数。
-p
设置HAProxy的PID文件路径。
-de
不是用epoll模型。
-ds
不是用speculative epoll。
-dp
不是用poll模型。
-sf
程序启动后向PID文件里的进程发送FINISH信号,此参数需要放在命令行最后。
-st
程序启动后向PID文件里的进程发送TERMINATE信号,此参数需要放在命令行最后。

三 HAProxy启动脚本

Usage: /etc/init.d/haproxy {start|stop|status|restart|try-restart|reload|force-reload}"
 #!/bin/sh
#
# haproxy
#
# chkconfig: - 85 15
# description: HAProxy is a free, very fast and reliable solution \
# offering high availability, load balancing, and \
# proxying for TCP and HTTP-based applications
# processname: haproxy
# config: /etc/haproxy/haproxy.cfg
# pidfile: /var/run/haproxy.pid # Source function library.
. /etc/rc.d/init.d/functions # Source networking configuration.
. /etc/sysconfig/network # Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0 exec="/usr/sbin/haproxy"
prog=$(basename $exec) [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog cfgfile=/etc/haproxy/haproxy.cfg
pidfile=/var/run/haproxy.pid
lockfile=/var/lock/subsys/haproxy check() {
$exec -c -V -f $cfgfile $OPTIONS
} start() {
$exec -c -q -f $cfgfile $OPTIONS
if [ $? -ne 0 ]; then
echo "Errors in configuration file, check with $prog check."
return 1
fi echo -n $"Starting $prog: "
# start it up here, usually something like "daemon $exec"
daemon $exec -D -f $cfgfile -p $pidfile $OPTIONS
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
} stop() {
echo -n $"Stopping $prog: "
# stop it here, often "killproc $prog"
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
} restart() {
$exec -c -q -f $cfgfile $OPTIONS
if [ $? -ne 0 ]; then
echo "Errors in configuration file, check with $prog check."
return 1
fi
stop
start
} reload() {
$exec -c -q -f $cfgfile $OPTIONS
if [ $? -ne 0 ]; then
echo "Errors in configuration file, check with $prog check."
return 1
fi
echo -n $"Reloading $prog: "
$exec -D -f $cfgfile -p $pidfile $OPTIONS -sf $(cat $pidfile)
retval=$?
echo
return $retval
} force_reload() {
restart
} fdr_status() {
status $prog
} case "$1" in
start|stop|restart|reload)
$1
;;
force-reload)
force_reload
;;
check)
check
;;
status)
fdr_status
;;
condrestart|try-restart)
[ ! -f $lockfile ] || restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
exit 2
esac

004.HAProxy的管理与维护的更多相关文章

  1. 管理和维护RHCS集群

    导读 管理和维护RHCS集群是一个非常复杂和繁琐的工作,要维护好一个RHCS集群,必须熟悉RHCS的基本运行原理,在集群管理方面,RHCS提供了两种方式:即Luci图形界面方式和命令行方式,这儿重点讲 ...

  2. Oracle RAC OCR 的管理与维护

    OCR相当于Windows的注册表.对于Windows而言,所有的软件信息,用户,配置,安全等等统统都放到注册表里边.而集群呢,同样如此,所有和集群相关的资源,配置,节点,RAC数据库统统都放在这个仓 ...

  3. Linux基础三:linux目录结构和目录文件的浏览、管理及维护

    目录文件的浏览.管理及维护(一) 1.Linux文件系统的层次结构 1)Linux文件系统的树状结构:在Linux或UNIX操作系统中,所有的文件和目录都被组织成一个以根节点开始的倒置的树状结构. 2 ...

  4. Oracle RAC管理及维护命令详解

    Oracle Clusterware的命令集可以分为以下4种: 节点层:osnodes 网络层:oifcfg 集群层:crsctl, ocrcheck,ocrdump,ocrconfig 应用层:sr ...

  5. Couchbase IV(管理与维护)

    Couchbase IV(管理与维护) 管理 常用命令 Command Description server-list List all servers in a cluster server-inf ...

  6. Mysql --分区表的管理与维护

    改变一个表的分区方案只需使用alter table 加 partition_options 子句就可以了.和创建分区表时的create table语句很像 创建表 CREATE TABLE trb3 ...

  7. 数据切分——Mysql分区表的管理与维护

    关于Mysql分区表的介绍可以参考: http://blog.csdn.net/jhq0113/article/details/44592865 关于Mysql分区表的创建可以参考: http://b ...

  8. 用手机管理及维护MySQL,Oracle等数据库

    现在移动办公的情况及需求越来越多,平时MySQL,Oracle,SQLServer等数据库的管理都要通过客户端工具操作,现在有一款基于web网页的软件:TreeSoft数据库管理系统,在服务器布署一套 ...

  9. 首先给大家介绍一下数据库project师,数据库project师(Database Engineer),是从事管理和维护数据库管理系统(DBMS)

    摘要 MySQL的最初的核心思想,主要是开源.简便易用.其开发可追溯至1985年,而第一个内部发行版本号诞生,已经是1995年. 到1998年,MySQL已经能够支持10中操作系统了.当中就包含win ...

随机推荐

  1. python3数字、日期和时间

    1.对数值进行取整 #使用内建的round(value,ndigits)函数来取整,ndigits指定保留的位数,在取整时会取值在偶数上,如1.25取一位会取整1.2,1.26会取整1.3 In [1 ...

  2. 【转】Python数据类型之“数字(numerics)”

    [转]Python数据类型之“数字(numerics)” 上一节内容说的是“Python基本语法”,本节主要讲下Python中的数据类型. 存储在内存中的数据通常有两个属性: 在内存中的存放位置:这个 ...

  3. STM32F103X datasheet学习笔记---DMA

    1.前言 直接存储器存取(DMA)用来提供在外设和存储器之间或者存储器和存储器之间的高速数据传输. 无须CPU干预,数据可以通过DMA快速地移动,这就节省了CPU的资源来做其他操作. 两个DMA控制器 ...

  4. Linux内核驱动之GPIO子系统(一)GPIO的使用【转】

    转自:http://blog.csdn.net/tommy_wxie/article/details/9427047 一 概述 Linux内核中gpio是最简单,最常用的资源(和 interrupt  ...

  5. python根据服务名获取服务启动路径

    #coding=utf8 import _winreg as winreg class Win32Environment: """Utility class to get ...

  6. 020_秘钥管理服务器vault

    一. https://github.com/hashicorp/vault     #待研究

  7. 服务器上安装FileZilla Server连接时报You appear to be behind a NAT router. Please configure the passive mode settings and forward a range of ports in your router.

    官方资源下载链接:客户端,或者直接点击下载“FileZilla_3.24.0_win64-setup.exe”:服务端,或者直接点击下载“FileZilla_Server-0_9_60_2.exe”: ...

  8. Java 企业级 JavaEE

    授权协议:CDDL 开发语言:Java 操作系统:跨平台 开发厂商:Oracle 原文:https://www.oschina.net/p/j2ee Java EE 详细介绍 这是SUN公司推出的J2 ...

  9. ubuntu git hub 建立仓库

    https://www.cnblogs.com/woider/p/6533709.html 1.安装git apt-get install git 2.配置 Git 用户信息 把用户名和邮箱换成你自己 ...

  10. django----数据库操作(对model增删改查)

    优化查询 articles_list=models.Article.objects.all().iterator() for i in articles_list: print(i.title) 添加 ...