systemd не обновляет основной PID для keepalived - PullRequest
0 голосов
/ 09 июля 2020

Я столкнулся с проблемой, когда systemd не обновляет основной PID:

Статус keepalived вместе с keepalived.service и keepalived.service.conf следующий:

[root@rhel7_36 ~]# systemctl status keepalived -l
● keepalived.service - LVS and VRRP High Availability Monitor
   Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/keepalived.service.d
           └─keepalived.service.conf
   Active: active (running) since Thu 2020-07-09 18:21:18 GMT; 42s ago
  Process: 1173 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 1176 (keepalived)
   CGroup: /system.slice/keepalived.service
           ├─1176 /usr/sbin/keepalived -D
           ├─1177 /usr/sbin/keepalived -D
           ├─1178 /usr/sbin/keepalived -D
           ├─1695 /usr/sbin/keepalived -D
           ├─1696 /usr/sbin/keepalived -D
           ├─1697 sh -c /bin/ping -q -c 5 -W 1 192.168.X.X >/dev/null
           ├─1698 sh -c /bin/ping -q -c 5 -W 1 192.168.X.X >/dev/null
           ├─1699 /bin/ping -q -c 5 -W 1 192.168.X.X
           └─1700 /bin/ping -q -c 5 -W 1 192.168.X.X

Jul 09 18:21:20 rhel7_36 Keepalived_vrrp[1178]: VRRP_Group(VG_PREAUTH) Syncing instances to FAULT state
Jul 09 18:21:20 rhel7_36 Keepalived_vrrp[1178]: Opening script file /usr/libexec/keepalived/stateNotify.py
Jul 09 18:21:22 rhel7_36 Keepalived_vrrp[1178]: VRRP_Script(icmp_to_eth1_router) succeeded
Jul 09 18:21:22 rhel7_36 Keepalived_vrrp[1178]: VRRP_Script(icmp_to_eth0_router) succeeded
Jul 09 18:21:23 rhel7_36 Keepalived_vrrp[1178]: Kernel is reporting: Group(VG_PREAUTH) UP
Jul 09 18:21:23 rhel7_36 Keepalived_vrrp[1178]: VRRP_Group(VG_PREAUTH) Leaving FAULT state
Jul 09 18:21:23 rhel7_36 Keepalived_vrrp[1178]: VRRP_Instance(VI_eth1) Entering BACKUP STATE
Jul 09 18:21:23 rhel7_36 Keepalived_vrrp[1178]: VRRP_Group(VG_PREAUTH) Syncing instances to BACKUP state
Jul 09 18:21:23 rhel7_36 Keepalived_vrrp[1178]: VRRP_Instance(VI_eth0) Entering BACKUP STATE
Jul 09 18:21:23 rhel7_36 Keepalived_vrrp[1178]: Opening script file /usr/libexec/keepalived/stateNotify.py

[root@rhel7_36 ~]# systemctl cat keepalived
# /usr/lib/systemd/system/keepalived.service
[Unit]
Description=LVS and VRRP High Availability Monitor
After=syslog.target network-online.target

[Service]
Type=forking
PIDFile=/var/run/keepalived.pid
KillMode=process
EnvironmentFile=-/etc/sysconfig/keepalived
ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/keepalived.service.d/keepalived.service.conf
[Service]
Environment="INSTALL_DIR=/opt/edge"
Nice=-10
Restart=on-failure
RestartSec=20

Теперь я выполняю pkill -9 keepalived, так что keepalived запускается сам в течение 20 секунд. Что он делает в первый раз, и статус keepalived становится таким, как показано ниже

[root@rhel7_36 ~]# systemctl status keepalived -l
● keepalived.service - LVS and VRRP High Availability Monitor
   Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/keepalived.service.d
           └─keepalived.service.conf
   Active: active (running) since Thu 2020-07-09 18:27:36 GMT; 4min 19s ago
  Process: 1910 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 2377 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 1176 (code=killed, signal=KILL)
   CGroup: /system.slice/keepalived.service
           ├─2378 /usr/sbin/keepalived -D
           ├─2379 /usr/sbin/keepalived -D
           └─2380 /usr/sbin/keepalived -D

Jul 09 18:27:38 rhel7_36 Keepalived_vrrp[2380]: VRRP_Group(VG_PREAUTH) Syncing instances to FAULT state
Jul 09 18:27:38 rhel7_36 Keepalived_vrrp[2380]: Opening script file /usr/libexec/keepalived/stateNotify.py
Jul 09 18:27:41 rhel7_36 Keepalived_vrrp[2380]: VRRP_Script(icmp_to_eth0_router) succeeded
Jul 09 18:27:41 rhel7_36 Keepalived_vrrp[2380]: VRRP_Script(icmp_to_eth1_router) succeeded
Jul 09 18:27:41 rhel7_36 Keepalived_vrrp[2380]: Kernel is reporting: Group(VG_PREAUTH) UP
Jul 09 18:27:41 ehel7_36 Keepalived_vrrp[2380]: VRRP_Group(VG_PREAUTH) Leaving FAULT state
Jul 09 18:27:41 rhel7_36 Keepalived_vrrp[2380]: VRRP_Instance(VI_eth1) Entering BACKUP STATE
Jul 09 18:27:41 rhel7_36 Keepalived_vrrp[2380]: VRRP_Group(VG_PREAUTH) Syncing instances to BACKUP state
Jul 09 18:27:41 rhel7_36 Keepalived_vrrp[2380]: VRRP_Instance(VI_eth0) Entering BACKUP STATE
Jul 09 18:27:41 rhel7_36 Keepalived_vrrp[2380]: Opening script file /usr/libexec/keepalived/stateNotify.py

Как вы можете видеть, основной PID не обновляется.

Я включаю PIDFile в Также существуют файлы /usr/lib/systemd/system/keepalived.service и /var/run/keepalived.pid.

Также теперь он не сможет перезагрузить keepalived. Я не понимаю, почему он не обновляет PID.

[root@rhel7_36 ~]# systemctl reload keepalived
Job for keepalived.service failed because the control process exited with error code. See "systemctl status keepalived.service" and "journalctl -xe" for details.

[root@rhel7_36 ~]# systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability Monitor
   Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/keepalived.service.d
           └─keepalived.service.conf
   Active: active (running) (Result: exit-code) since Thu 2020-07-09 18:27:36 GMT; 7min ago
  Process: 3329 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=1/FAILURE)
  Process: 2377 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 1176 (code=killed, signal=KILL)
   CGroup: /system.slice/keepalived.service
           ├─2378 /usr/sbin/keepalived -D
           ├─2379 /usr/sbin/keepalived -D
           ├─2380 /usr/sbin/keepalived -D
           ├─3344 /usr/sbin/keepalived -D
           ├─3345 /usr/sbin/keepalived -D
           ├─3346 sh -c /bin/ping -q -c 5 -W 1 192.168.X.X >/dev/null
           ├─3347 sh -c /bin/ping -q -c 5 -W 1 192.168.X.X >/dev/null
           ├─3348 /bin/ping -q -c 5 -W 1 192.168.X.X
           └─3349 /bin/ping -q -c 5 -W 1 192.168.X.X

Jul 09 18:35:08 rhel7_36 kill[3329]: -s, --signal <sig>     send sp...l
Jul 09 18:35:08 rhel7_36 kill[3329]: -q, --queue <sig>      use sig...)
Jul 09 18:35:08 rhel7_36 kill[3329]: -p, --pid              print p...m
Jul 09 18:35:08 rhel7_36 kill[3329]: -l, --list [=<signal>] list si...e
Jul 09 18:35:08 rhel7_36 kill[3329]: -L, --table            list si...s
Jul 09 18:35:09 rhel7_36 kill[3329]: -h, --help     display this he...t
Jul 09 18:35:09 rhel7_36 kill[3329]: -V, --version  output version ...t
Jul 09 18:35:09 rhel7_36 kill[3329]: For more details see kill(1).
Jul 09 18:35:08 rhel7_36 systemd[1]: keepalived.service: control pr...1
Jul 09 18:35:08 rhel7_36 systemd[1]: Reload failed for LVS and VRRP....
Hint: Some lines were ellipsized, use -l to show in full.

[root@rhel7_36 ~]# journalctl -xe
Jul 09 18:35:08 rhel7_36 systemd[1]: keepalived.service: control proces
Jul 09 18:35:08 rhel7_36 systemd[1]: Reload failed for LVS and VRRP Hig
-- Subject: Unit keepalived.service has finished reloading its configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit keepalived.service has finished reloading its configuration
-- 
-- The result is failed.
Jul 09 18:35:55 rhel7_36 systemd[1]: Starting Cleanup of Temporary Dire
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Jul 09 18:35:55 rhel7_36 systemd[1]: Started Cleanup of Temporary Direc
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has finished starting up.
-- 
-- The start-up result is done

Версия keepalived Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2

Любые входные данные были бы полезны, чтобы понять это и исправить это.

Спасибо !!!

...