从源代码构建时,我在使用systemd进行keepalive工作时遇到了一些麻烦。我将单元文件从包安装的keepalived复制到centos 7,它主要用于启动和停止keepalived进程,但当keepalived进入FAULT状态时,systemd显示它不断退出代码256 。从包装中安装时,它会正确显示FAULT状态。我不确定有关systemd的两个安装之间有什么区别。
[Unit]
Description=LVS and VRRP High Availability Monitor
After=syslog.target network.target
[Service]
Type=forking
KillMode=process
EnvironmentFile=-/etc/sysconfig/keepalived
ExecStart=/usr/local/sbin/keepalived $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/var/run/keepalived.pid
[Install]
WantedBy=multi-user.target
该过程开始并停止正常,但遇到FAULT状态时,我得到了这个:
● keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/etc/systemd/system/keepalived.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2016-10-01 00:47:12 EDT; 2s ago
Process: 30947 ExecStart=/usr/local/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 30948 (keepalived)
CGroup: /system.slice/keepalived.service
├─30948 /usr/local/sbin/keepalived -D
├─30949 /usr/local/sbin/keepalived -D
└─30950 /usr/local/sbin/keepalived -D
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: Registering gratuitous ARP shared channel
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: Opening file '/etc/keepalived/keepalived.conf'.
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: Truncating auth_pass to 8 characters
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: VRRP_Instance(VPN) removing protocol VIPs.
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: Using LinkWatch kernel netlink reflector...
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: VRRP_Instance(VPN) Entering BACKUP STATE
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: VRRP sockpool: [ifindex(3), proto(112), unicast(1), fd(10,11)]
Oct 01 00:47:12 server.test.com Keepalived_vrrp[30950]: pid 30951 exited with status 256
Oct 01 00:47:13 server.test.com Keepalived_vrrp[30950]: pid 30953 exited with status 256
答案 0 :(得分:0)
在keepalived project的维护者的大力帮助下,确定keepalived实际上正在进入FAULT状态,但是然后详细记录了vrrp_script
失败,这是在版本之后添加的内容可用于centos yum repo。