keepalived是什么?
Keepalived软件起初是专为LVS负载均衡软件设计的,用来管理并监控LVS集群系统中各个服务节点的状态,后来又加入了可以实现高可用的VRRP功能。因此,Keepalived除了能够管理LVS软件外,还可以作为其他服务(例如:Nginx、Haproxy、MySQL等)的高可用解决方案软件。
Keepalived软件主要是通过VRRP协议实现高可用功能的。VRRP是Virtual Router RedundancyProtocol(虚拟路由器冗余协议)的缩写,VRRP出现的目的就是为了解决静态路由单点故障问题的,它能够保证当个别节点宕机时,整个网络可以不间断地运行。
所以,Keepalived 一方面具有配置管理LVS的功能,同时还具有对LVS下面节点进行健康检查的功能,另一方面也可实现系统网络服务的高可用功能。
keepalived官网http://www.keepalived.org
1.1 keepalived的相关的文件
keepalived的执行命令:/data/apps/keepalived/sbin/keepalived
keepalived的配置文件:/data/apps/keepalived/etc/keepalived/keepalived.conf
keepalived的Pid文件:/data/apps/keepalived/run/keepalived.pid
1.2 keepalived的启停止方式
注意:不要去修改/data/apps/keepalived/etc/sysconfig/keepalived文件
启动方式:keepalived -f 配置文件(绝对路径) -p PID文件(绝对路径)
关闭方式:kill $( cat PID文件(绝对路径) )
1.3 脚本内容
注意:该脚本只能Linux的超级用户root才能启动,因为脚本中有进行限制
#!/bin/bash ## Define variables RETVAL=0 Conf="/data/apps/keepalived/etc/keepalived/keepalived.conf" Exce="/data/apps/keepalived/sbin/keepalived" Pid="/data/apps/keepalived/run/keepalived.pid" # Determine the user to execute if [ "$UID" -ne "$RETVAL" ];then echo "Must be root to run scripts" exit 1 fi # Load local functions library [ -f /etc/init.d/functions ] && source /etc/init.d/functions # Define functions start(){ if [ ! -f "$Pid" ];then $Exce -f $Conf -p $Pid >/dev/null 2>&1 RETVAL=$"Start keepalived service" /bin/true else action "Start keepalived service" /bin/false fi else echo "keepalived service is running" fi return $RETVAL } stop(){ if [ -f "$Pid" ];then kill $(cat $Pid) >/dev/null 2>&1 RETVAL=$"Stop keepalived service" /bin/true else action "Stop keepalived service" /bin/false fi else echo "keepalived service is not running" fi return $RETVAL } status(){ if [ -f "$Pid" ];then echo "keepalived service is running" else echo "keepalived service is not running" fi return $RETVAL } # case local functions case "$1" in start) start RETVAL=$"USAGE:$0{status|start|stop|restart}" exit 1 esac # Scripts return values exit $RETVAL
总结
更新日志
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]