圆月山庄资源网 Design By www.vgjia.com

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

总结

标签:
shell,keepalived启动脚本,shell,keepalived

圆月山庄资源网 Design By www.vgjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
圆月山庄资源网 Design By www.vgjia.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。