haproxy安装使用一(安装篇)

安装
1、yum install
[root@host228 ~]# yum install haproxy
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.cn99.com
 * extras: mirror.jdcloud.com
 * updates: mirrors.aliyun.com
base                                                                                                              | 3.6 kB  00:00:00     
centos-gluster41                                                                                                  | 2.9 kB  00:00:00     
docker-ce-stable                                                                                                  | 3.5 kB  00:00:00     
extras                                                                                                            | 3.4 kB  00:00:00     
updates                                                                                                           | 3.4 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                       | 2.5 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package haproxy.x86_64 0:1.5.18-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================
 Package                         Arch                           Version                               Repository                    Size
=========================================================================================================================================
Installing:
 haproxy                         x86_64                         1.5.18-8.el7                          base                         834 k

Transaction Summary
=========================================================================================================================================
Install  1 Package

Total download size: 834 k
Installed size: 2.6 M
Is this ok [y/d/N]: y
Downloading packages:
haproxy-1.5.18-8.el7.x86_64.rpm                                                                                   | 834 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : haproxy-1.5.18-8.el7.x86_64                                                                                           1/1 
  Verifying  : haproxy-1.5.18-8.el7.x86_64                                                                                           1/1 

Installed:
  haproxy.x86_64 0:1.5.18-8.el7                                                                                                          

Complete!
[root@host228 ~]# rpm -qi haproxy
Name        : haproxy
Version     : 1.5.18
Release     : 8.el7
Architecture: x86_64
Install Date: Fri 15 Mar 2019 04:21:38 PM CST
Group       : System Environment/Daemons
Size        : 2690238
License     : GPLv2+
Signature   : RSA/SHA256, Mon 12 Nov 2018 10:28:49 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM  : haproxy-1.5.18-8.el7.src.rpm
Build Date  : Wed 31 Oct 2018 05:39:00 AM CST
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
2、源码安装

下载:http://www.haproxy.org/download/1.8/src/haproxy-1.8.14.tar.gz
上传到服务器上解压编译安装:

[root@intel175 test]$ tar -xf haproxy-1.8.14.tar
[root@intel175 test]$ cd haproxy-1.8.14/
[root@intel175 haproxy-1.8.14]$ make prefix=/data/zgy/haproxy TARGET=linux2628
[root@intel175 haproxy-1.8.14]# make install prefix=/data/zgy/haproxy 
install -d "/usr/local/sbin"
install haproxy  "/usr/local/sbin"
install -d "/usr/local/share/man"/man1
install -m 644 doc/haproxy.1 "/usr/local/share/man"/man1
install -d "/usr/local/doc/haproxy"
for x in configuration proxy-protocol management architecture peers-v2.0 cookie-options lua WURFL-device-detection linux-syn-cookies network-namespaces DeviceAtlas-device-detection 51Degrees-device-detection netscaler-client-ip-insertion-protocol peers close-options SPOE intro; do \
        install -m 644 doc/$x.txt "/usr/local/doc/haproxy" ; \
done
[zgy@intel175 haproxy-1.8.14]$ mkdir -p /data/zgy/haproxy/conf
[zgy@intel175 haproxy-1.8.14]$ which haproxy
/usr/local/sbin/haproxy
[zgy@intel175 haproxy-1.8.14]$ haproxy --version
HA-Proxy version 1.8.14-52e4d43 2018/09/20
Copyright 2000-2018 Willy Tarreau <[email protected]>

Usage : haproxy [-f <cfgfile|cfgdir>]* [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]
        [ -p <pidfile> ] [ -m <max megs> ] [ -C <dir> ] [-- <cfgfile>*]
        -v displays version ; -vv shows known build options.
        -d enters debug mode ; -db only disables background mode.
        -dM[<byte>] poisons memory with <byte> (defaults to 0x50)
        -V enters verbose mode (disables quiet mode)
        -D goes daemon ; -C changes to <dir> before loading files.
        -W master-worker mode.
        -q quiet mode : don't display messages
        -c check mode : only check config files and exit
        -n sets the maximum total # of connections (2000)
        -m limits the usable amount of memory (in MB)
        -N sets the default, per-proxy maximum # of connections (2000)
        -L set local peer name (default to hostname)
        -p writes pids of all children to this file
        -de disables epoll() usage even when available
        -dp disables poll() usage even when available
        -dS disables splice usage (broken on old kernels)
        -dR disables SO_REUSEPORT usage
        -dr ignores server address resolution failures
        -dV disables SSL verify on servers side
        -sf/-st [pid ]* finishes/terminates old pids.
        -x <unix_socket> get listening sockets from a unix socket

你可能感兴趣的:(Linux)