【发布时间】:2016-10-03 18:28:34
【问题描述】:
在从源代码构建时,我在使用 systemd 进行 keepalived 工作时遇到了一点麻烦。我从 centos 7 可用的安装包 keepalived 复制了单元文件,它的主要工作原理是它确实启动和停止 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
【问题讨论】: