现象:
当一台机器上,keepalived启动后,正常运行30s,后就自动停止。
检查:
1.检查keepalived.conf
# cat keepalived.conf
! Configuration File for keepalived
global_defs {
router_id home
smtp_connect_timeout 30
script_user root
enable_script_security
}
vrrp_script chk_home {
script /etc/keepalived/check.sh
interval 5
weight 1
}
vrrp_instance VI_1 {
state MASTER
interface ens192
virtual_router_id 2
priority 100
unicast_src_ip 10.10.10.230
unicast_peer {
10.10.10.231
}
advert_int 2
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.10.10.247
}
virtual_ipaddress_excluded {
2409:8010:5af0:1101:10:845:0:4C
}
track_script {
chk_home
}
}
比较配置,没有发现问题。
2.检查主机防火墙,keepalived安装依赖
# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
5月 18 14:11:29 nm-foot-gxc-home02 systemd[1]: Stopping firewalld - dynamic firewall daemon...
5月 18 14:11:30 nm-foot-gxc-home02 systemd[1]: firewalld.service: Succeeded.
5月 18 14:11:30 nm-foot-gxc-home02 systemd[1]: Stopped firewalld - dynamic firewall daemon.
# yum install -y libnl3 libnl3-devel lm_sensors-libs net-snmp-agent-libs net-snmp-libs
无法连接BC-Linux的YUM源服务器。
上次元数据过期检查:4:05:39 前,执行于 2023年05月18日 星期四 11时14分19秒。
软件包 libnl3-3.5.0-4.oe1.x86_64 已安装。
软件包 libnl3-devel-3.5.0-4.oe1.x86_64 已安装。
软件包 lm_sensors-3.6.0-4.oe1.x86_64 已安装。
软件包 net-snmp-1:5.9-3.oe1.x86_64 已安装。
软件包 net-snmp-libs-1:5.9-3.oe1.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
# yum install curl gcc openssl-devel libnl3-devel net-snmp-devel -y
无法连接BC-Linux的YUM源服务器。
上次元数据过期检查:4:05:47 前,执行于 2023年05月18日 星期四 11时14分19秒。
软件包 curl-7.71.1-7.oe1.x86_64 已安装。
软件包 gcc-7.3.0-20210605.39.oe1.x86_64 已安装。
软件包 openssl-devel-1:1.1.1f-10.oe1.x86_64 已安装。
软件包 libnl3-devel-3.5.0-4.oe1.x86_64 已安装。
软件包 net-snmp-devel-1:5.9-3.oe1.x86_64 已安装。
依赖关系解决。
无需任何处理。
完毕!
3.journalctl -xe 查看日志
]# journalctl -xe
-- 启动结果为“done”。
5月 18 15:20:01 hostname01 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=sysstat-collect comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
5月 18 15:20:01 hostname01 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=sysstat-collect comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
5月 18 15:20:01 hostname01 kernel: audit: type=1130 audit(1684394401.637:973763): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=sysstat-collect comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=>
5月 18 15:20:01 hostname01 audit[1620944]: USER_START pid=1620944 uid=0 auid=0 ses=127393 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="root" exe="/usr/sbin/crond" hostname=? addr=? >
5月 18 15:20:01 hostname01 audit[1620944]: CRED_REFR pid=1620944 uid=0 auid=0 ses=127393 msg='op=PAM:setcred grantors=pam_env,pam_tally2,pam_faillock,pam_unix acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron>
5月 18 15:20:01 hostname01 CROND[1620949]: (root) CMD (/bin/bash /etc/titanagent/agent_monitor.sh >> /var/log/titanagent/edog.o.log 2>> /var/log/titanagent/edog.e.log)
5月 18 15:20:01 hostname01 audit[1620946]: USER_START pid=1620946 uid=0 auid=1002 ses=127394 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="topteact" exe="/usr/sbin/crond" hostname=? >
5月 18 15:20:01 hostname01 audit[1620946]: CRED_REFR pid=1620946 uid=0 auid=1002 ses=127394 msg='op=PAM:setcred grantors=pam_env,pam_tally2,pam_faillock,pam_unix acct="topteact" exe="/usr/sbin/crond" hostname=? addr=? termin>
5月 18 15:20:01 hostname01 CROND[1620958]: (topteact) CMD (sh /topteact//agent70/bin/monitor.sh /topteact//agent70/bin>/dev/null 2>&1)
5月 18 15:20:01 hostname01 audit[1620945]: USER_START pid=1620945 uid=0 auid=0 ses=127392 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="root" exe="/usr/sbin/crond" hostname=? addr=? >
5月 18 15:20:01 hostname01 audit[1620945]: CRED_REFR pid=1620945 uid=0 auid=0 ses=127392 msg='op=PAM:setcred grantors=pam_env,pam_tally2,pam_faillock,pam_unix acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron>
5月 18 15:20:01 hostname01 CROND[1620971]: (root) CMD (/bin/bash /etc/titanagent/agent_update_exception.sh >> /var/log/titanagent/check.o.log 2>> /var/log/titanagent/check.e.log)
5月 18 15:20:01 hostname01 dbus-daemon[996]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.417964' (uid=1002 pid=1620968 comm="/usr/b>
5月 18 15:20:01 hostname01 systemd[1]: Starting Hostname Service...
-- Subject: systemd-hostnamed.service 单元已开始启动
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- systemd-hostnamed.service 单元已开始启动。
5月 18 15:20:01 hostname01 audit[1620944]: CRED_DISP pid=1620944 uid=0 auid=0 ses=127393 msg='op=PAM:setcred grantors=pam_env,pam_tally2,pam_faillock,pam_unix acct="root" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron>
5月 18 15:20:01 hostname01 CROND[1620944]: (root) CMDEND (/bin/bash /etc/titanagent/agent_monitor.sh >> /var/log/titanagent/edog.o.log 2>> /var/log/titanagent/edog.e.log)
5月 18 15:20:01 hostname01 systemd[1]: session-127393.scope: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The unit session-127393.scope has successfully entered the 'dead' state.
5月 18 15:20:01 hostname01 audit[1620944]: USER_END pid=1620944 uid=0 auid=0 ses=127393 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="root" exe="/usr/sbin/crond" hostname=? addr=? t>
5月 18 15:20:01 hostname01 dbus-daemon[996]: [system] Successfully activated service 'org.freedesktop.hostname1'
5月 18 15:20:01 hostname01 systemd[1]: Started Hostname Service.
-- Subject: systemd-hostnamed.service 单元已结束启动
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- systemd-hostnamed.service 单元已结束启动。
--
-- 启动结果为“done”。
日志中也都正常,没有看到报错信息。
4.检查jdk版本
# java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
5.检查定时任务
最后才想到,看日志都没有报错,想到可能是自己主动停止的。检查各个用户下配置的crontab。终于找到一个check脚本,另一个应用配置keepalived高可用时,检查脚本写的有问题。居然用定时任务检查高可用。。。。