keepalived+LVS 详解(1) -- 编译
先安装依赖包
由于环境不同可能不一样,也可以在后面的执行过程中,提示缺什么,在安装什么。
apt-get install libssl-dev libpopt-dev libnl-3-dev libnl-genl-3-dev
下载最新的源码,目前是2.0版本:
https://www.keepalived.org/download.html
解压后进入目录,执行,有兴趣的可以研究下atuomake的执行
./configure --prefix=/usr/local/keepalived --enable-bfd --enable-mem-check --enable-mem-check-log --enable-timer-check --enable-debug --enable-track-process-debug --enable-parser-debug --enable-vrrp-fd-debug --disable-lvs
make && make install
启动
keepalived/etc/keepalived/keepalived.conf 是配置文件的路径,可以根据自己的路径修改
配置文件的修改,后面章节在解析:
cd bin
./keepalived -f ../keepalived/etc/keepalived/keepalived.conf --debug=TPEFOAC -D -g
具体的参数可以执行keepalived -h参看,unix的文本配置啊,全靠keepalived.conf
keepalived -h
Usage: ./keepalived [OPTION...]
-f, --use-file=FILE Use the specified configuration file
-B, --no_bfd Don't run BFD subsystem
--all Force all child processes to run, even if have no configuration
-l, --log-console Log messages to local console
-D, --log-detail Detailed log messages
-S, --log-facility=[0-7] Set syslog facility to LOG_LOCAL[0-7]
-g, --log-file=FILE Also log to FILE (default /tmp/keepalived.log)
--flush-log-file Flush log file on write
-G, --no-syslog Don't log via syslog
-u, --umask=MASK umask for file creation (in numeric form)
-X, --release-vips Drop VIP on transition from signal.
-V, --dont-release-vrrp Don't remove VRRP VIPs and VROUTEs on daemon stop
-R, --dont-respawn Don't respawn child processes
-n, --dont-fork Don't fork the daemon process
-d, --dump-conf Dump the configuration data
-p, --pid=FILE Use specified pidfile for parent process
-r, --vrrp_pid=FILE Use specified pidfile for VRRP child process
-b, --bfd_pid=FILE Use specified pidfile for BFD child process
-s, --namespace=NAME Run in network namespace NAME (overrides config)
-m, --core-dump Produce core dump if terminate abnormally
-M, --core-dump-pattern=PATN Also set /proc/sys/kernel/core_pattern to PATN (default 'core')
-L, --mem-check-log Log malloc/frees to syslog
-i, --config-id id Skip any configuration lines beginning '@' that don't match id
or any lines beginning @^ that do match.
The config-id defaults to the node name if option not used
--signum=SIGFUNC Return signal number for STOP, RELOAD, DATA, STATS, TDUMP
-t, --config-test[=LOG_FILE] Check the configuration for obvious errors, output to
stderr by default
--debug[=...] Enable debug options. p, b, c, v specify parent, bfd, checker and vrrp processes
If no process(es) specified, the option will apply to all processes
T - timer debug
M - email alert debug
H - smtp connect debug
E - epoll debug
D - epoll thread dump debug
F - vrrp fd dump debug
S - TSM debug
N - netlink timer debug
P - network timestamp debug
U - checksum diagnostics
O - track process debug
A - track process debug with extra detail
C - parser (config) debug
Z - memory alloc/free error debug
I - EINTR debugging
K - dump keywords
Example --debug=TpMEvcp
-v, --version Display the version number
-h, --help Display this help message