Centos7 yum -y install ipvadm 安装后,启动ipvsadm却报错。
Redirecting to /bin/systemctl start ipvsadm.service Job for ipvsadm.service failed because the control process exited with error code. See "systemctl status ipvsadm.service" and "journalctl -xe" for details.
看提示是要我查看服务状态
# systemctl status ipvsadm.service ● ipvsadm.service - Initialise the Linux Virtual Server Loaded: loaded (/usr/lib/systemd/system/ipvsadm.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since 三 2017-06-28 18:15:15 CST; 12s ago Process: 2505 ExecStart=/bin/bash -c exec /sbin/ipvsadm-restore < /etc/sysconfig/ipvsadm (code=exited, status=1/FAILURE) Main PID: 2505 (code=exited, status=1/FAILURE) 6月 28 18:15:15 localhost.localdomain systemd[1]: Starting Initialise the Linux Virtual Server... 6月 28 18:15:15 localhost.localdomain bash[2505]: /bin/bash: /etc/sysconfig/ipvsadm: 没有那个文件或目录 6月 28 18:15:15 localhost.localdomain systemd[1]: ipvsadm.service: main process exited, code=exited, status=1/FAILURE 6月 28 18:15:15 localhost.localdomain systemd[1]: Failed to start Initialise the Linux Virtual Server. 6月 28 18:15:15 localhost.localdomain systemd[1]: Unit ipvsadm.service entered failed state. 6月 28 18:15:15 localhost.localdomain systemd[1]: ipvsadm.service failed.
提示没有
/etc/sysconfig/ipvsadm
网上查阅很多资料,说先save,可是并没有这个操作。
# service ipvsadm save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
最后还是看到个靠谱的解决方法,手动生成这个文件:
ipvsadm --save > /etc/sysconfig/ipvsadm
service ipvsadm start ,启动OK。
附录(来源):ipvsadm命令选项解释: