Closed vieyahn2017 closed 4 months ago
killall nginx
kill -9 $(ps -ef | grep nginx | grep python |awk '{print $2}' ) ps aux | grep nginx | grep python | awk '{print $2}' | xargs kill
ps aux | grep nginx | grep -v grep | awk '{print $2}'| xargs kill
service keepalived start
Starting keepalived (via systemctl): Job for keepalived.service failed because a configured resource limit was exceeded.
See "systemctl status keepalived.service" and "journalctl -xe" for details.
[FAILED]
systemctl status keepalived.service
● keepalived.service - SYSV: Start and stop Keepalived
Loaded: loaded (/etc/rc.d/init.d/keepalived; bad; vendor preset: disabled)
Active: failed (Result: resources) since Thu 2019-04-18 09:39:40 CST; 1min 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 33994 ExecStart=/etc/rc.d/init.d/keepalived start (code=exited, status=0/SUCCESS)
Apr 18 09:39:40 jxt116 systemd[1]: Starting SYSV: Start and stop Keepalived...
Apr 18 09:39:40 jxt116 keepalived[33994]: Starting keepalived: [ OK ]
Apr 18 09:39:40 jxt116 systemd[1]: PID file /var/run/keepalived.pid not readable (yet?) after start.
Apr 18 09:39:40 jxt116 systemd[1]: Failed to start SYSV: Start and stop Keepalived.
Apr 18 09:39:40 jxt116 systemd[1]: Unit keepalived.service entered failed state.
Apr 18 09:39:40 jxt116 systemd[1]: keepalived.service failed.
journalctl -xe
-- Unit user-993.slice has begun shutting down.
Apr 18 09:30:01 jxt116 systemd[1]: Started Session 2755 of user root.
-- Subject: Unit session-2755.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2755.scope has finished starting up.
--
-- The start-up result is done.
Apr 18 09:30:01 jxt116 systemd[1]: Starting Session 2755 of user root.
-- Subject: Unit session-2755.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2755.scope has begun starting up.
Apr 18 09:30:01 jxt116 CROND[24897]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Apr 18 09:38:38 jxt116 su[32928]: (to viid) root on pts/1
Apr 18 09:38:38 jxt116 su[32928]: pam_unix(su-l:session): session opened for user viid by root(uid=0)
Apr 18 09:38:38 jxt116 su[32928]: pam_unix(su-l:session): session closed for user viid
Apr 18 09:39:40 jxt116 polkitd[844]: Registered Authentication Agent for unix-process:33988:85742353 (system bus name :1.7701 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/Polic
Apr 18 09:39:40 jxt116 systemd[1]: Starting SYSV: Start and stop Keepalived...
-- Subject: Unit keepalived.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit keepalived.service has begun starting up.
Apr 18 09:39:40 jxt116 Keepalived[33999]: Starting Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2
Apr 18 09:39:40 jxt116 Keepalived[33999]: Unable to resolve default script username 'keepalived_script' - ignoring
Apr 18 09:39:40 jxt116 keepalived[33994]: Starting keepalived: [ OK ]
Apr 18 09:39:40 jxt116 Keepalived[33999]: Configuration file '/etc/keepalived/keepalived.conf' is not a regular non-executable file
Apr 18 09:39:40 jxt116 Keepalived[33999]: Stopped Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2
Apr 18 09:39:40 jxt116 systemd[1]: PID file /var/run/keepalived.pid not readable (yet?) after start.
Apr 18 09:39:40 jxt116 systemd[1]: Failed to start SYSV: Start and stop Keepalived.
-- Subject: Unit keepalived.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit keepalived.service has failed.
--
-- The result is failed.
Apr 18 09:39:40 jxt116 systemd[1]: Unit keepalived.service entered failed state.
Apr 18 09:39:40 jxt116 systemd[1]: keepalived.service failed.
Apr 18 09:39:40 jxt116 polkitd[844]: Unregistered Authentication Agent for unix-process:33988:85742353 (system bus name :1.7701, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8
Apr 18 09:40:01 jxt116 systemd[1]: Started Session 2756 of user root.
-- Subject: Unit session-2756.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2756.scope has finished starting up.
--
-- The start-up result is done.
Apr 18 09:40:01 jxt116 systemd[1]: Starting Session 2756 of user root.
-- Subject: Unit session-2756.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2756.scope has begun starting up.
Apr 18 09:40:01 jxt116 CROND[34329]: (root) CMD (/usr/lib64/sa/sa1 1 1)
vi /opt/xxx/tools/deploy/business_machine/base/keepalived/install_keepalived/keepalived/install_kp/keepalived.service
[Unit]
Description=LVS and VRRP High Availability Monitor
After=syslog.target network-online.target
[Service]
Type=forking
PIDFile=/opt/xxx/base/keepalived/var/run/keepalived.pid
KillMode=process
EnvironmentFile=-/opt/xxx/base/keepalived/etc/sysconfig/keepalived
ExecStart=/opt/xxx/base/keepalived/sbin/keepalived $KEEPALIVED_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
~
Failed to read PID from file /var/run/keepalived.pid: Invalid argument Failed to start LVS and VRRP High Availability Monitor. 这是由于没有按照Keepalived工具默认的路径配置造成的,解决方法
cp home/work/server/keepalived/etc/keepalived /etc/init.d
mkdir /etc/keepalived
cp /home/work/server/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
cp /home/work/server/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
cp /home/work/server/keepalived/sbin/keepalived /usr/local/sbin/
作者:屌丝50 来源:CSDN 原文:https://blog.csdn.net/weixin_40885374/article/details/81018645 版权声明:本文为博主原创文章,转载请附上博文链接!
问题见 PIDFile=/usr/local/program/keepalived/var/run/keepalived.pid ##发现这个目录不存在,无法写入keepalived.pid 修改成
PIDFile=/var/run/keepalived.pid
运行命令 systemctl daemon-reload #重新载入 systemd,扫描新的或有变动的单元
在运行就Ok了 service keepalived start Starting keepalived (via systemctl): [ OK ]
作者:猪脚踏浪 来源:CSDN 原文:https://blog.csdn.net/zsg88/article/details/76690847 版权声明:本文为博主原创文章,转载请附上博文链接!
echo 11111 > /var/run/keepalived.pid
[root@jxt116 keepalived]# service keepalived start
Starting keepalived (via systemctl): Job for keepalived.service failed because a configured resource limit was exceeded. See "systemctl status keepalived.service" and "journalctl -xe" for details.
[FAILED]
[root@jxt116 keepalived]# systemctl status keepalived.service
● keepalived.service - SYSV: Start and stop Keepalived
Loaded: loaded (/etc/rc.d/init.d/keepalived; bad; vendor preset: disabled)
Active: failed (Result: resources) since Mon 2019-04-22 11:01:09 CST; 2s ago
Docs: man:systemd-sysv-generator(8)
Process: 25677 ExecStart=/etc/rc.d/init.d/keepalived start (code=exited, status=0/SUCCESS)
Apr 22 11:01:09 jxt116 systemd[1]: Starting SYSV: Start and stop Keepalived...
Apr 22 11:01:09 jxt116 keepalived[25677]: Starting keepalived: [ OK ]
Apr 22 11:01:09 jxt116 systemd[1]: PID 11111 read from file /var/run/keepalived.pid does not exist or is a zombie.
Apr 22 11:01:09 jxt116 systemd[1]: Failed to start SYSV: Start and stop Keepalived.
Apr 22 11:01:09 jxt116 systemd[1]: Unit keepalived.service entered failed state.
Apr 22 11:01:09 jxt116 systemd[1]: keepalived.service failed.
[root@jxt116 keepalived]#
vi /var/log/messages
Apr 22 11:25:46 jxt116 systemd: Starting SYSV: Start and stop Keepalived... Apr 22 11:25:46 jxt116 Keepalived[49107]: Starting Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2 Apr 22 11:25:46 jxt116 Keepalived[49107]: Unable to resolve default script username 'keepalived_script' - ignoring Apr 22 11:25:46 jxt116 keepalived: Starting keepalived: [ OK ] Apr 22 11:25:46 jxt116 Keepalived[49107]: Configuration file '/etc/keepalived/keepalived.conf' is not a regular non-executable file Apr 22 11:25:46 jxt116 Keepalived[49107]: Stopped Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2
cd /opt/xxx/tools/deploy/business_machine/base/keepalived
/opt/xxx/tools/deploy/business_machine/base/keepalived/install_keepalived/keepalived/install_kp
PIDFile=/opt/xxx/base/keepalived/var/run/keepalived.pid
cd /opt/xxx/base/keepalived
[root@jxt116 keepalived]# cd /etc/keepalived/ [root@jxt116 keepalived]# ls check_nginx.sh keepalived.conf [root@jxt116 keepalived]# ll total 8 -rwxr-xr-x. 1 root root 333 Apr 22 11:25 check_nginx.sh -rwxr-xr-x. 1 root root 488 Apr 22 15:08 keepalived.conf [root@jxt116 keepalived]# chmod 644 keepalived.conf [root@jxt116 keepalived]# ll total 8 -rwxr-xr-x. 1 root root 333 Apr 22 11:25 check_nginx.sh -rw-r--r--. 1 root root 488 Apr 22 15:08 keepalived.conf [root@jxt116 keepalived]# service keepalived start Starting keepalived (via systemctl): [ OK ] [root@jxt116 keepalived]#
cat /run/systemd/generator.late/keepalived.service
# Automatically generated by systemd-sysv-generator
[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/rc.d/init.d/keepalived
Description=SYSV: Start and stop Keepalived
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=no
PIDFile=/var/run/keepalived.pid
ExecStart=/etc/rc.d/init.d/keepalived start
ExecStop=/etc/rc.d/init.d/keepalived stop
ExecReload=/etc/rc.d/init.d/keepalived reload
/usr/local/sbin/ cp /opt/xxx/base/keepalived/sbin/keepalived /usr/local/sbin/
vi /var/log/messages
Apr 25 15:57:35 jxt116 Keepalived_vrrp[103207]: VRRP_Script(chk_nginx) timed out
Apr 25 15:57:35 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Changing effective priority from 100 to 90
Apr 25 15:57:35 jxt116 Keepalived_vrrp[103207]: /etc/keepalived/check_nginx.sh exited due to signal 15
Apr 25 15:57:35 jxt116 Keepalived_vrrp[103207]: VRRP_Script(chk_nginx) succeeded
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Changing effective priority from 90 to 100
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Received advert with lower priority 96, ours 100, forcing new election
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Sending/queueing gratuitous ARPs on eth0 for 8.6.53.180
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:36 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:37 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Received advert with lower priority 96, ours 100, forcing new election
Apr 25 15:57:37 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:37 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Sending/queueing gratuitous ARPs on eth0 for 8.6.53.180
Apr 25 15:57:37 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:37 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:37 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:37 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:41 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:41 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Sending/queueing gratuitous ARPs on eth0 for 8.6.53.180
Apr 25 15:57:41 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:41 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:41 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:41 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:42 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:42 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) Sending/queueing gratuitous ARPs on eth0 for 8.6.53.180
Apr 25 15:57:42 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:42 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:42 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:42 jxt116 Keepalived_vrrp[103207]: Sending gratuitous ARP on eth0 for 8.6.53.180
Apr 25 15:57:45 jxt116 systemd-logind: New session 4812 of user root.
Apr 25 15:57:45 jxt116 systemd: Started Session 4812 of user root.
Apr 25 15:57:45 jxt116 systemd: Starting Session 4812 of user root.
Apr 25 15:57:46 jxt116 Keepalived[103205]: Stopping
Apr 25 15:57:46 jxt116 Keepalived_healthcheckers[103206]: Stopped
Apr 25 15:57:46 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) sent 0 priority
Apr 25 15:57:46 jxt116 Keepalived_vrrp[103207]: VRRP_Instance(VI_1) removing protocol VIPs.
Apr 25 15:57:46 jxt116 avahi-daemon[841]: Withdrawing address record for 8.6.53.180 on eth0.
Apr 25 15:57:46 jxt116 systemd: Reloading.
Apr 25 15:57:47 jxt116 Keepalived_vrrp[103207]: Stopped
Apr 25 15:57:47 jxt116 Keepalived[103205]: Stopped Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2
Apr 25 15:57:47 jxt116 keepalived: Stopping keepalived: [FAILED]
Apr 25 15:57:48 jxt116 ntpd[125752]: Deleting interface #9 eth0, 8.6.53.180#123, interface stats: received=0, sent=0, dropped=0, active_time=15111 secs
Keepalived_healthcheckers[103206]: Stopped 这个莫名其妙的停止 服务重启(service keepalived start)也就好了
service keepalived start
systemctl status keepalived.service
cd /opt/xxx/tools/deploy/business_machine/base/keepalived/install_keepalived/keepalived/install_kp cd /opt/xxx/base/keepalived
[root@jxt116 keepalived]# cd /etc/keepalived/ [root@jxt116 keepalived]# ls check_nginx.sh keepalived.conf
[root@jxt118 ~]# systemctl stop firewalld.service [root@jxt118 ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@jxt118 ~]# systemctl start firewalld.service
[root@jxt118 ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:67
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:67
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
INPUT_direct all -- 0.0.0.0/0 0.0.0.0/0
INPUT_ZONES_SOURCE all -- 0.0.0.0/0 0.0.0.0/0
INPUT_ZONES all -- 0.0.0.0/0 0.0.0.0/0
DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 192.168.122.0/24 ctstate RELATED,ESTABLISHED
ACCEPT all -- 192.168.122.0/24 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
FORWARD_direct all -- 0.0.0.0/0 0.0.0.0/0
FORWARD_IN_ZONES_SOURCE all -- 0.0.0.0/0 0.0.0.0/0
FORWARD_IN_ZONES all -- 0.0.0.0/0 0.0.0.0/0
FORWARD_OUT_ZONES_SOURCE all -- 0.0.0.0/0 0.0.0.0/0
FORWARD_OUT_ZONES all -- 0.0.0.0/0 0.0.0.0/0
DROP all -- 0.0.0.0/0 0.0.0.0/0 ctstate INVALID
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:68
OUTPUT_direct all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD_IN_ZONES (1 references)
target prot opt source destination
FWDI_public all -- 0.0.0.0/0 0.0.0.0/0 [goto]
FWDI_public all -- 0.0.0.0/0 0.0.0.0/0 [goto]
Chain FORWARD_IN_ZONES_SOURCE (1 references)
target prot opt source destination
Chain FORWARD_OUT_ZONES (1 references)
target prot opt source destination
FWDO_public all -- 0.0.0.0/0 0.0.0.0/0 [goto]
FWDO_public all -- 0.0.0.0/0 0.0.0.0/0 [goto]
Chain FORWARD_OUT_ZONES_SOURCE (1 references)
target prot opt source destination
Chain FORWARD_direct (1 references)
target prot opt source destination
Chain FWDI_public (2 references)
target prot opt source destination
FWDI_public_log all -- 0.0.0.0/0 0.0.0.0/0
FWDI_public_deny all -- 0.0.0.0/0 0.0.0.0/0
FWDI_public_allow all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
Chain FWDI_public_allow (1 references)
target prot opt source destination
Chain FWDI_public_deny (1 references)
target prot opt source destination
Chain FWDI_public_log (1 references)
target prot opt source destination
Chain FWDO_public (2 references)
target prot opt source destination
FWDO_public_log all -- 0.0.0.0/0 0.0.0.0/0
FWDO_public_deny all -- 0.0.0.0/0 0.0.0.0/0
FWDO_public_allow all -- 0.0.0.0/0 0.0.0.0/0
Chain FWDO_public_allow (1 references)
target prot opt source destination
Chain FWDO_public_deny (1 references)
target prot opt source destination
Chain FWDO_public_log (1 references)
target prot opt source destination
Chain INPUT_ZONES (1 references)
target prot opt source destination
IN_public all -- 0.0.0.0/0 0.0.0.0/0 [goto]
IN_public all -- 0.0.0.0/0 0.0.0.0/0 [goto]
Chain INPUT_ZONES_SOURCE (1 references)
target prot opt source destination
Chain INPUT_direct (1 references)
target prot opt source destination
Chain IN_public (2 references)
target prot opt source destination
IN_public_log all -- 0.0.0.0/0 0.0.0.0/0
IN_public_deny all -- 0.0.0.0/0 0.0.0.0/0
IN_public_allow all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
Chain IN_public_allow (1 references)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW
Chain IN_public_deny (1 references)
target prot opt source destination
Chain IN_public_log (1 references)
target prot opt source destination
Chain OUTPUT_direct (1 references)
target prot opt source destination
后面 把浮动ip改成119,后续OK (为啥我之前配180也可以?)
[root@jxt116 logs]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 8.6.53.116 netmask 255.255.255.192 broadcast 8.6.53.127
inet6 fe80::4311:de91:ea00:51d4 prefixlen 64 scopeid 0x20<link>
ether 28:6e:d4:88:c6:51 txqueuelen 1000 (Ethernet)
RX packets 7827395 bytes 5872441442 (5.4 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2600302 bytes 1482744103 (1.3 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 3508 bytes 275112 (268.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3508 bytes 275112 (268.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:05:77:a0 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@jxt116 logs]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 28:6e:d4:88:c6:51 brd ff:ff:ff:ff:ff:ff
inet 8.6.53.116/26 brd 8.6.53.127 scope global eth0
valid_lft forever preferred_lft forever
inet 8.6.53.119/32 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::4311:de91:ea00:51d4/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:05:77:a0 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:05:77:a0 brd ff:ff:ff:ff:ff:ff
重启keepalived服务:
只有从节点有浮动ip,脑裂问题消失。
重启机器 测试,也是一样的,只有主有浮动ip。
关闭主节点的keepalived: 浮动ip切换到备节点
100.129.133.138 100.129.133.128
4: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:b7:fa:9b brd ff:ff:ff:ff:ff:ff
inet 172.125.58.70/16 brd 172.125.255.255 scope global noprefixroute enp5s0
valid_lft forever preferred_lft forever
inet 172.125.55.54/32 scope global enp5s0
valid_lft forever preferred_lft forever
4: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:77:a9:50 brd ff:ff:ff:ff:ff:ff
inet 172.125.56.52/16 brd 172.125.255.255 scope global noprefixroute enp5s0
valid_lft forever preferred_lft forever
inet 172.125.55.54/32 scope global enp5s0
valid_lft forever preferred_lft forever
#!/bin/bash
# 检查脑裂的脚本,在备节点上进行部署
LB01_VIP=172.125.55.54
LB01_IP=172.125.58.70
LB02_IP=1172.125.56.52
while true
do
ping -c 2 -W 3 $LB01_VIP &>/dev/null
if [ $? -eq 0 -a `ip add|grep "$LB01_VIP"|wc -l` -eq 1 ];then
echo "ha is brain."
else
echo "ha is ok"
fi
sleep 5
done
4: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:2f:bc:ba brd ff:ff:ff:ff:ff:ff
inet 172.125.55.67/16 brd 172.125.255.255 scope global noprefixroute enp5s0
valid_lft forever preferred_lft forever
inet 172.125.59.154/32 scope global enp5s0
4: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether fa:16:3e:b9:7b:8e brd ff:ff:ff:ff:ff:ff
inet 172.125.56.131/16 brd 172.125.255.255 scope global noprefixroute enp5s0
valid_lft forever preferred_lft forever
inet 172.125.59.154/32 scope global enp5s0
linuxSu 知止而後能定,定而後能靜,靜而後能安,安而後能慮,慮而後能得。 --四叔 BOOTPROTO=[none|static|bootp|dhcp](引导时不使用协议|静态分配|BOOTP协议|DHCP协议) BOOTPROTO=[none|static|bootp|dhcp](引导时不使用协议|静态分配|BOOTP协议|DHCP协议) posted on 2015-05-11 17:44 linuxSu 阅读(...) 评论(...) 编辑 收藏
linux里的bootproto的none,static,dhcp有什么区别
这个是网络配置参数: BOOTPROTO=static 静态IP
BOOTPROTO=dhcp 动态IP
BOOTPROTO=none 无(不指定) 通常情况下是dhcp或者static,通过指定方式的办法来获得地址,如果没有指定的话可能会出现问
keepalived绑定的ip一段时间(大约几分钟)后消失的问题 我用keepalived将ip地址绑定到单独的一块网卡eth1,该网卡未分配任何ip地址。keepalived启动后,ip地址绑定正常。但过了几分钟后,绑定的ip地址就消失了。检查keepalived日志未发现异常。
接着检查系统其他日志,在/var/log/messages中看到,每隔几分钟分钟就会有一条dhcpclient的日志。据此猜测是启用的eth1的dhcp功能导致的keepalived绑定的ip在一段时间(大约几分钟)后消失。
修改配置文件/etc/sysconfig/network-scripts/ifcfg-eth1,设置BOOTPROTO=none。重启服务service network restart和service keepalived restart后,ip地址不在丢失,服务器工作正常。
keepalived-vrrp-healthcheck.txt
数据库主备探索