移动keepalived服务报错
# service keepalived start
错误如下
Job for keepalived.service failed because a configured resource limit was exceeded. See "systemctl status keepalived.service" and "journalctl -xe" for details.
查看错误
# systemctl status keepalived.service
我们可以看到日志,是写日志出了问题
[root@zk-02 sbin]# systemctl status keepalived.service
● keepalived.service - LVS and VRRP High Availability Monitor
Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
Active: failed (Result: resources) since Fri 2017-08-04 15:32:31 CST; 4min 59s ago
Process: 16764 ExecStart=/usr/local/program/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
Aug 04 15:32:25 zk-02 Keepalived_healthcheckers[16768]: Activating healthchecker for service [10.10.10.2]:1358
Aug 04 15:32:25 zk-02 Keepalived_healthcheckers[16768]: Activating healthchecker for service [10.10.10.3]:1358
Aug 04 15:32:25 zk-02 Keepalived_healthcheckers[16768]: Activating healthchecker for service [10.10.10.3]:1358
Aug 04 15:32:25 zk-02 Keepalived_vrrp[16769]: (VI_1): No VIP specified; at least one is required
Aug 04 15:32:26 zk-02 Keepalived[16766]: Keepalived_vrrp exited with permanent error CONFIG. Terminating
Aug 04 15:32:26 zk-02 Keepalived[16766]: Stopping
Aug 04 15:32:31 zk-02 systemd[1]: keepalived.service never wrote its PID file. Failing. ##写日志出了问题
Aug 04 15:32:31 zk-02 systemd[1]: Failed to start LVS and VRRP High Availability Monitor.
Aug 04 15:32:31 zk-02 systemd[1]: Unit keepalived.service entered failed state.
Aug 04 15:32:31 zk-02 systemd[1]: keepalived.service failed.
[root@zk-02 sbin]# vi /var/run/keepalived.pid
[root@zk-02 sbin]# vim /lib/systemd/system/keepalived.service
[root@zk-02 sbin]# vim /lib/systemd/system/keepalived.service
# vi /lib/systemd/system/keepalived.service内容如下
[Unit]
Description=LVS and VRRP High Availability Monitor
After=syslog.target network-online.target
[Service]
Type=forking
PIDFile=/usr/local/program/keepalived/var/run/keepalived.pid ##发现这个目录不存在,无法写入keepalived.pid
KillMode=process
EnvironmentFile=-/usr/local/program/keepalived/etc/sysconfig/keepalived
ExecStart=/usr/local/program/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
问题见
PIDFile=/usr/local/program/keepalived/var/run/keepalived.pid ##发现这个目录不存在,无法写入keepalived.pid
修改成
PIDFile=/var/run/keepalived.pid
运行命令
# systemctl daemon-reload #重新载入 systemd,扫描新的或有变动的单元
service keepalived start
Starting keepalived (via systemctl): [ OK ]