acassen / keepalived

Keepalived
https://www.keepalived.org
GNU General Public License v2.0
4.01k stars 736 forks source link

restart keepalived not work , systemd: Can't open PID file /etc/keepalived/logs/keepalived.pid (yet?) after start: No such file or directory #2401

Closed kangqiao-lu closed 7 months ago

kangqiao-lu commented 7 months ago

[root@localhost]# ll /var/run/keepalived.pid -rw-r--r-- 1 root root 7 Apr 2 10:13 /var/run/keepalived.pid [root@st-mysql-uat-8 ~]# cat /var/run/keepalived.pid 115595 [root@localhost ~]# ps aux|grep keepalived root 115595 0.0 0.0 123016 1400 ? Ss 10:13 0:00 /usr/sbin/keepalived -D root 115596 0.0 0.0 144724 3908 ? S 10:13 0:00 /usr/sbin/keepalived -D root 115597 0.0 0.0 146748 3468 ? S 10:13 0:01 /usr/sbin/keepalived -D root 270126 0.0 0.0 112720 972 pts/2 S+ 14:59 0:00 grep --color=auto keepalived [root@localhost ~]# systemctl restart keepalived [root@localhost ~]# ps aux|grep keepalived root 115595 0.0 0.0 123016 1400 ? Ss 10:13 0:00 /usr/sbin/keepalived -D root 115596 0.0 0.0 144724 3908 ? S 10:13 0:00 /usr/sbin/keepalived -D root 115597 0.0 0.0 146748 3468 ? S 10:13 0:01 /usr/sbin/keepalived -D root 270946 0.0 0.0 112720 972 pts/2 S+ 14:59 0:00 grep --color=auto keepalived [root@localhost ~]# cat /var/run/keepalived.pid 115595

logmsg: Apr 2 14:59:53 st-mysql-uat-8 Keepalived[271933]: Starting Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2 Apr 2 14:59:53 st-mysql-uat-8 Keepalived[271933]: Opening file '/etc/keepalived/keepalived.conf'. Apr 2 14:59:53 st-mysql-uat-8 Keepalived[271933]: daemon is already running Apr 2 14:59:53 st-mysql-uat-8 systemd: Can't open PID file /etc/keepalived/logs/keepalived.pid (yet?) after start: No such file or directory Apr 2 14:59:53 st-mysql-uat-8 systemd: Started LVS and VRRP High Availability Monitor.

keepalived.conf:

rrp_script chk_mysql { script "/etc/keepalived/check_mysql.sh" interval 30 }

vrrp_instance VI_1 { state BACKUP
interface eth0 virtual_router_id 99 priority 100 advert_int 1 nopreempt
authentication { auth_type PASS auth_pass 1111 } track_script { chk_mysql }

virtual_ipaddress {
    192.168.0.200/24 dev eth0 label eth0:1
}
notify_master "/etc/keepalived/notify_master.sh"

}

kangqiao-lu commented 7 months ago

keepalived-1.3.5-19 CentOS Linux release 7.7.1908 (Core) Linux 3.10.0-514.el7.x86_64