keepalived 源碼編譯安裝

1、官方下載源碼包

[root@zk01 ~]# wget  https://www.keepalived.org/software/keepalived-2.0.20.tar.gz

 

2、解壓

[root@zk01 ~]# tar -zxvf keepalived-2.0.20.tar.gz

3、進入解壓目錄,編譯

[root@zk01 keepalived-2.0.20]# ./configure  --prefix=/soft/keepalived 
[root@zk01 keepalived-2.0.20]# make 
[root@zk01 keepalived-2.0.20]# make install 

4、至此,我們可以在/soft目錄下,看到編譯好的keepalived 

[root@zk01 keepalived]# pwd
/soft/keepalived
[root@zk01 keepalived]# ll
total 0
drwxr-xr-x 2 root root 20 Feb  4 02:58 bin
drwxr-xr-x 4 root root 39 Feb  4 02:58 etc
drwxr-xr-x 2 root root 23 Feb  4 02:58 sbin
drwxr-xr-x 5 root root 37 Feb  4 02:58 share

 

提示: 輸入./configure -h 可以查看幫助

[root@zk01 keepalived-2.0.20]# ./configure -h
`configure' configures Keepalived 2.0.20 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/keepalived]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-silent-rules   less verbose build output (undo: "make V=1")
  --disable-silent-rules  verbose build output (undo: "make V=0")
  --disable-lvs-syncd     do not use LVS synchronization daemon
  --disable-lvs           do not use the LVS framework
  --disable-lvs-64bit-stats
                          do not use the LVS 64-bit stats
  --disable-vrrp          do not use the VRRP framework
  --enable-bfd            use the BFD framework
  --disable-fwmark        compile without SO_MARK support
  --enable-snmp           compile with SNMP support
  --enable-snmp-vrrp      compile with SNMP vrrp support
  --enable-snmp-keepalived
                          obsolete - use --enable-snmp-vrrp
  --enable-snmp-checker   compile with SNMP checker support
  --enable-snmp-rfc       compile with SNMP RFC2787 (VRRPv2) and SNMP RFC6527
                          (VRRPv3) support
  --enable-snmp-rfcv2     compile with SNMP RFC2787 (VRRPv2) support
  --enable-snmp-rfcv3     compile with SNMP RFC6527 (VRRPv3) support
  --disable-snmp-reply-v3-for-v2
                          disable RFC6527 responses for VRRPv2 instances
  --enable-dbus           compile with dbus support
  --enable-dbus-create-instance
                          compile with dbus support for creating instances
  --enable-sha1           compile with SHA1 support
  --enable-regex          build with HTTP_GET regex checking
  --enable-regex-timers   build with HTTP_GET regex timers
  --enable-json           compile with signal to dump configuration and stats
                          as json
  --disable-vrrp-auth     compile without VRRP authentication
  --disable-checksum-compat
                          compile without v1.3.6 and earlier VRRPv3 unicast
                          checksum compatibility
  --disable-routes        compile without ip rules/routes
  --disable-linkbeat      build without linkbeat support
  --enable-gnu-std-paths  use GNU standard paths for pid files etc
  --enable-dynamic-linking
                          compile with/without dynamically linked
                          libiptc/libipset/libnl
  --disable-iptables      compile without iptables support
  --enable-libiptc-dynamic
                          compile with libiptc dynamically linked
  --disable-libipset-dynamic
                          compile with libipset statically linked
  --enable-libnl-dynamic  compile with libnl dynamically linked
  --disable-libiptc       compile without libiptc
  --disable-libipset      compile without libipset
  --disable-nftables      build without nftables support
  --disable-libnl         compile without libnl
  --disable-track-process build without track-process functionality
  --enable-strict-config-checks
                          build with strict configuration checking
  --disable-hardening     do not build with security hardening
  --enable-optimise       compiler optimisation level
  --enable-warnings[=WARNINGS]
                          additional compiler warnings, disable for reduced
                          set
  --enable-extra-warnings extra compiler warnings that will probably produce
                          many warnings
  --enable-mem-check      compile with memory alloc checking
  --enable-mem-check-log  compile with memory alloc checking writing to syslog
  --enable-timer-check    compile with set time logging
  --enable-debug          compile with most debugging options
  --enable-netlink-timers compile with netlink command timers
  --enable-smtp-alert-debug
                          compile with smtp-alert debugging
  --enable-stacktrace     compile with stacktrace support
  --enable-perf           compile with perf performance data recording support
                          for vrrp process
  --enable-log-file       enable logging to file (-g)
  --enable-dump-threads   compile with thread dumping support
  --enable-epoll-debug    compile with epoll_wait() debugging support
  --enable-epoll-thread-dump
                          compile with epoll thread dumping support
  --enable-regex-debug    compile with regex debugging support
  --enable-tsm-debug      compile with TSM debugging support
  --enable-vrrp-fd-debug  compile with vrrp fd debugging support
  --enable-eintr-debug    compile with EINTR debugging support, set to
                          check/not check for EINTR
  --enable-track-process-debug
                          compile with track process debugging support, set to
                          log all process connector events
  --enable-parser-debug   compile with parser debugging support
  --enable-checksum-debug compile with checksum debugging support
  --enable-genhash-debug  compile with genhash debugging support
  --enable-checker-debug  compile with checker debugging support
  --enable-smtp-connect-debug
                          compile with smtp connect debugging support
  --enable-mem-err-debug  compile with MALLOC/FREE error debugging support
  --enable-one-process-debug
                          compile with all functionality running in a single
                          process
  --enable-dump-keywords  compile with keyword dumping support
  --enable-network-timestamp
                          compile with network timestamp debugging support
  --enable-asserts        compile with assert() enabled
  --enable-profile        compile with profiling flags
  --enable-conversion-checks
                          compile with conversion warnings if sensible
  --enable-force-conversion-checks
                          compile with conversion warnings
  --enable-Werror         compile with warnings being errors
  --enable-dependency-tracking
                          do not reject slow dependency extractors
  --disable-dependency-tracking
                          speeds up one-time build

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-kernel-dir=DIR   path to linux kernel source directory
  --with-init=(upstart|systemd|SYSV|SUSE|openrc)
                          specify init type
  --with-run-dir=PATH_TO_RUN
                          specify directory where /run is located
  --with-fixed-if-type=TYPE
                          treat interface type TYPE as unchangeable
  --with-default-config-file=FILE
                          Default configuration file
  --with-systemdsystemunitdir=DIR
                          Directory for systemd service files]

Some influential environment variables:
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

Report bugs to <[email protected]>.
Keepalived home page: <http://www.keepalived.org/>.

輸入如下命令可以查看keepalived 啓動相關命令

[root@zk01 ~]# man keepalived

KEEPALIVED(8)                                          System Manager's Manual                                          KEEPALIVED(8)

NAME
       keepalived - load-balancing and high-availability service

SYNOPSIS
       keepalived [-f|--use-file=FILE] [-P|--vrrp] [-C|--check] [-l|--log-console] [-D|--log-detail] [-S|--log-facility={0-7}]
       [-X|--release-vips] [-V|--dont-release-vrrp] [-I|--dont-release-ipvs] [-R|--dont-respawn] [-n|--dont-fork] [-d|--dump-conf]
       [-p|--pid=FILE] [-r|--vrrp_pid=FILE] [-c|--checkers_pid=FILE] [-a|--address-monitoring] [-x|--snmp] [-A|--snmp-agent-
       socket=FILE] [-m|--core-dump] [-M|--core-dump-format[=PATTERN]] [-v|--version] [-h|--help]

DESCRIPTION
       Keepalived provides simple and robust facilities for load-balancing and high-availability. The load-balancing framework relies
       on the well-known and widely used Linux Virtual Server (IPVS) kernel module providing Layer4 load-balancing. Keepalived
       implements a set of checkers to dynamically and adaptively maintain and manage a load-balanced server pool according to their
       health. Keepalived also implements the VRRPv2 and VRRPv3 protocols to achieve high-availability with director failover.

OPTIONS
        -f, --use-file=FILE
              Use the specified configuration file. The default configuration file is "/etc/keepalived/keepalived.conf".

        -P, --vrrp
              Only run the VRRP subsystem. This is useful for configurations that do not use the IPVS load balancer.

        -C, --check
              Only run the healthcheck subsystem. This is useful for configurations that use the IPVS load balancer with a single
              director with no failover.

        -l, --log-console
              Log messages to the local console. The default behavior is to log messages to syslog.

        -D, --log-detail
              Detailed log messages.

        -S, --log-facility=[0-7]
              Set syslog facility to LOG_LOCAL[0-7]. The default syslog facility is LOG_DAEMON.

        -X, --release-vips
              Drop VIP on transition from signal.

        -V, --dont-release-vrrp
              Don't remove VRRP VIPs and VROUTEs on daemon stop. The default behavior is to remove all VIPs and VROUTEs when
              keepalived exits.

        -I, --dont-release-ipvs
              Don't remove IPVS topology on daemon stop. The default behavior it to remove all entries from the IPVS virtual server
              table when keepalived exits.

        -R, --dont-respawn
              Don't respawn child processes. The default behavior is to restart the VRRP and checker processes if either process
              exits.

        -n, --dont-fork
              Don't fork the daemon process. This option will cause keepalived to run in the foreground.

        -d, --dump-conf
              Dump the configuration data.

        -p, --pid=FILE
              Use the specified pidfile for the parent keepalived process. The default pidfile for keepalived is
              "/var/run/keepalived.pid", unless a network namespace is being used. See NAMESPACES below for more details.

        -r, --vrrp_pid=FILE
              Use the specified pidfile for the VRRP child process. The default pidfile for the VRRP child process is
              "/var/run/keepalived_vrrp.pid", unless a network namespace is being used.

        -c, --checkers_pid=FILE
              Use the specified pidfile for checkers child process. The default pidfile for the checker child process is
              "/var/run/keepalived_checkers.pid" unless a network namespace is being used.

        -a, --address-monitoring
              Log all address additions/deletions reported by netlink.

        -x, --snmp
              Enable the SNMP subsystem.

        -A, --snmp-agent-socket=FILE
              Use the specified socket for connection to SNMP master agent.

        -m, --core-dump
              Override the RLIMIT_CORE hard and soft limits to enable keepalived to produce a coredump in the event of a segfault or
              other failure.  This is most useful if keepalived has been built with 'make debug'.  Core dumps will be created in /,
              unless keepalived is run with the --dont-fork option, in which case they will be created in the directory from which
              keepalived was run, or they will be created in the directory of a configuraton file if the fault occurs while reading
              the file.

        -M, --core-dump-pattern[=PATTERN]
              Sets option --core-dump, and also updates /proc/sys/kernel/core_pattern to the pattern specified, or 'core' if none
              specified.  Provided the parent process doesn't terminate abnormally, it will restore /proc/sys/kernel/core_pattern to
              its original value on exit.

              Note: This will also affect any other process producing a core dump while keepalived is running.

        -v, --version
              Display the version and exit.

              Note: This will also affect any other process producing a core dump while keepalived is running.

        -v, --version
              Display the version and exit.

        -h, --help
              Display this help message and exit.

NAMESPACES
       keepalived can be run in a network namespace (see keepalived.conf(5) for configuration details). When run in a network
       namespace, a local mount namespace is also created, and /var/run/keepalived/keepalived_NamespaceName is mounted on
       /var/run/keepalived. By default, pid files with the usual default names are then created in /var/run/keepalived from the
       perspective of a process in the mount namespace, and they will be visible in /var/run/keepalived/keepalived_NamespaceName for
       a process running in the default mount namespace.

SIGNALS
       keepalived reacts to a set of signals.  You can send a signal to the parent keepalived process using the following:

              kill -SIGNAL $(cat /var/run/keepalived.pid)

       Note that -SIGNAL must be replaced with the actual signal you are trying to send, e.g. with HUP. So it then becomes:

              kill -HUP $(cat /var/run/keepalived.pid)

       HUP    This causes keepalived to close down all interfaces, reload its configuration, and start up with the new configuration.

       TERM, INT
              keepalived will shut down.

       USR1   Write configuration data to /tmp/keepalived.data

       USR2   Write statistics info to /tmp/keepalived.stats

SEE ALSO
       keepalived.conf(5), ipvsadm(8)

AUTHOR
       This man page was written by Ryan O'Hara <[email protected]>

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章