Keepalived日志

默认日志存放在系统日志:/var/log/messages下

[[email protected] /]# tail -f  /var/log/messages
Oct  6 13:30:07 lb01 Keepalived_vrrp[3671]: Kernel is reporting: interface eth0 UP
Oct  6 13:30:07 lb01 Keepalived_vrrp[3671]: VRRP_Instance(VI_1) Transition to MASTER STATE
Oct  6 13:30:08 lb01 Keepalived_vrrp[3671]: VRRP_Instance(VI_1) Entering MASTER STATE
Oct  6 13:30:08 lb01 Keepalived_vrrp[3671]: VRRP_Instance(VI_1) setting protocol VIPs.
Oct  6 13:30:08 lb01 Keepalived_vrrp[3671]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 192.168.119.150
Oct  6 13:30:08 lb01 Keepalived_healthcheckers[3670]: Netlink reflector reports IP 192.168.119.150 added
Oct  6 13:30:13 lb01 Keepalived_vrrp[3671]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 192.168.119.150
Oct  6 13:30:48 lb01 dhclient[856]: DHCPREQUEST on eth0 to 192.168.119.254 port 67 (xid=0x32903a31)
Oct  6 13:30:48 lb01 dhclient[856]: DHCPACK from 192.168.119.254 (xid=0x32903a31)
Oct  6 13:30:50 lb01 dhclient[856]: bound to 192.168.119.128 -- renewal in 783 seconds.

把日志单独存放

修改/etc/sysconfig/keepalived

把KEEPALIVED_OPTIONS="-D" 修改为:KEEPALIVED_OPTIONS="-D -d -S 0"

[[email protected] /]# vim /etc/sysconfig/keepalived
# Options for keepalived. See `keepalived --help‘ output and keepalived(8) and
# keepalived.conf(5) man pages for a list of all options. Here are the most
# common ones :
#
# --vrrp               -P    Only run with VRRP subsystem.
# --check              -C    Only run with Health-checker subsystem.
# --dont-release-vrrp  -V    Dont remove VRRP VIPs & VROUTEs on daemon stop.
# --dont-release-ipvs  -I    Dont remove IPVS topology on daemon stop.
# --dump-conf          -d    Dump the configuration data.
# --log-detail         -D    Detailed log messages.
# --log-facility       -S    0-7 Set local syslog facility (default=LOG_DAEMON)
#

KEEPALIVED_OPTIONS="-D -d -S 0"

在/etc/rsyslog.conf 末尾添加

[[email protected] /]# vim /etc/rsyslog.conf
local0.*                                                /var/log/keepalived.log

重启日志记录服务

[[email protected] /]# /etc/init.d/rsyslog restart
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]

重启keepalived

[[email protected] /]# /etc/init.d/keepalived restart
Stopping keepalived:                                       [  OK  ]
Starting keepalived:                                       [  OK  ]

查看日志

[[email protected] /]# tail -f /var/log/keepalived.log
Oct  6 13:48:22 lb01 Keepalived_healthcheckers[3998]:  Using autogen SSL context
Oct  6 13:48:22 lb01 Keepalived_healthcheckers[3998]: Using LinkWatch kernel netlink reflector...
Oct  6 13:48:22 lb01 Keepalived_vrrp[3999]: VRRP sockpool: [ifindex(2), proto(112), unicast(0), fd(10,11)]
Oct  6 13:48:22 lb01 Keepalived_vrrp[3999]: VRRP_Instance(VI_1) Transition to MASTER STATE
Oct  6 13:48:22 lb01 Keepalived_vrrp[3999]: VRRP_Instance(VI_1) Received lower prio advert, forcing new election
Oct  6 13:48:23 lb01 Keepalived_vrrp[3999]: VRRP_Instance(VI_1) Entering MASTER STATE
Oct  6 13:48:23 lb01 Keepalived_vrrp[3999]: VRRP_Instance(VI_1) setting protocol VIPs.
Oct  6 13:48:23 lb01 Keepalived_healthcheckers[3998]: Netlink reflector reports IP 192.168.119.150 added
Oct  6 13:48:23 lb01 Keepalived_vrrp[3999]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 192.168.119.150
Oct  6 13:48:28 lb01 Keepalived_vrrp[3999]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 192.168.119.150
时间: 2024-10-09 22:04:48

Keepalived日志的相关文章

keepalived配置日志

1.编辑配置文件/etc/sysconfig/keepalived,将第14行的KEEPALIVED_OPTIONS="-D"修改为KEEPALIVED_OPTIONS="-D -d -S 0" sudo sed -i '14 s#KEEPALIVED_OPTIONS="-D"#KEEPALIVED_OPTIONS="-D -d -S 0"#g' /etc/sysconfig/keepalived # 说明: # --dump

Centos7 keepalived 修改日志路径

Keepalived默认所有的日志都是写入到/var/log/message下的,由于message的日志太多了,而Keepalived的日志又很难分离出来,所以本文提供了一个调整Keepalived日志输出路径的方法.具体操作步骤如下:1. 修改 /etc/sysconfig/keepalived 把KEEPALIVED_OPTIONS="-D" 修改为KEEPALIVED_OPTIONS="-D -d -S 0" #其中-S指定syslog的facility 2

keepalived双主互备和自定义日志

自定义日志: keepalived的日志默认存储在/var/log/messages 有时我们会有需要将keepalived日志拿出来单独分析,那么这就需要我做自己去定义 /etc/sysconfig/keepalived #编辑keepalived的环境配置文件 KEEPALIVED_OPTIONS="-D -d -S 0" #修改内容 # --dump-conf -d  导出配置数据 # --log-detail -D  详细日志信息 # --log-facility -S  设置

Haproxy + keepalived 负载均衡日志定制

定制输出日志的好处 用户所有请求都通过负载均衡器,因此在此处收集日志,比在各后端真实服务器收集日志再汇总要有效得多. 工作目标 ? 记录用户访问日志:haproxy产生.? 记录keepalived日志:keepalived启动.运行状态,用于排错. 总体规划 ? 使用独立的分区存储日志.因keepalived日志内容较少,可与haproxy日志共用存储空间.比如我的项目里,用/data/logs作为日志的存储路径(/data最好用独立的分区或者磁盘),haproxy日志名称haproxy.lo

企业中MySQL高可用集群架构三部曲之MM+keepalived

各位老铁们,老张与大家又见面了.看到各位在博客里面给我的留言和访问量的情况,我很是欣慰,也谢谢大家对我的认可.我写这些博客,就是想把自己对于MySQL数据库的一些看法和自己平时的实战经验分享出来,我们可以一起探讨,共同进步.也保证今后只要一有空就更新博文,推出更多的干货. 我的学生经常对我说:"张老师,每次我遇到报错,有时还是会百度,但是最烦的是不知道百度哪篇帖子说的是正确的".其实这些呢,都是因为自己还没有对MySQL数据库核心知识的不熟悉,和对技术掌握的不牢固.平时下得功夫还是不到

nginx+keepalived高可用

nginx+keepalived高可用 1.环境如下 lb-01:192.168.75.136/24  nginx+keepalived-master lb-02:192.168.75.137/24  nginx+keepalived-backup VIP:192.168.75.135/24   rs-01:192.168.75.133/24 apache rs-02:192.168.75.13424 apache lb操作系统centos7.rs操作系统ubuntu14.04 2.lb-01/

Saltstack自动部署Haproxy+keepalived+nginx+memcache+php(fastcgi)

二系列: 部署keepalived总的目录结构 [[email protected] salt]# tree /srv/salt/ /srv/salt/ ├── base │   ├── init │   │   ├── audit.sls │   │   ├── dns.sls │   │   ├── env_init.sls │   │   ├── epel.sls │   │   ├── files │   │   │   └── resolv.conf │   │   ├── histo

Centos7+Nginx+Keepalived实现Apache服务的高可用&负载均衡

Centos7+Nginx+Keepalived实现Apache服务的高可用&负载均衡 今天是2017年的第一天,昨天也就是2016年的最后一天,我尝试部署了Centos7+Nginx+Keepalived实现WEB服务的高可用负载均衡服务,终于在2017年的第一天前完成了,所以在此分享给有需要的朋友:说到负载均衡,其实在linux下有很多服务可以实现,比如nginx.haproxy.lvs等服务,当前我们在前面的文章有介绍过了,但是对于高可用服务,我们在linux下最常见也是应用最多的是Kee

MySQL 主主复制 + LVS + Keepalived 实现 MySQL 高可用性

MySQL复制能够保证数据的冗余的同时可以做读写分离来分担系统压力,如果是主主复制还可以很好的避免主节点的单点故障.但是MySQL主主复制存在一些问题无法满足我们的实际需要:未提供统一访问入口来实现负载均衡,如果其中master宕掉的话需要手动切换到另外一个master,而不能自动进行切换. 这篇文章下面要介绍如何通过LVS+Keepalived的方式来是实现MySQL的高可用性,同时解决以上问题. Keepalived和LVS介绍 Keepalived是一个基于VRRP(虚拟路由冗余协议)可用