Closed RavenZZ closed 5 years ago
https://github.com/ChenHuajun/pha4pgsql/blob/master/ra/lvsdr
lvsdr_monitor() {
# check virtual server for ${OCF_RESKEY_vip}:${OCF_RESKEY_port}
ipvsadm -L -t ${OCF_RESKEY_vip}:${OCF_RESKEY_port} >/dev/null 2>&1
if [ $? -ne 0 ]; then
if ocf_is_probe; then
ocf_log info "These is no virtual service definition for this virtual servie"
else
ocf_log err "These is no virtual service definition for this virtual servie"
fi
return $OCF_NOT_RUNNING
fi
#update Real Servers
update_lvs
if [ $? -ne 0 ]; then
return $OCF_ERR_GENERIC
fi
return $OCF_SUCCESS
}
可以手动执行下面启动LVS的命令,看哪一步失败
lvsdr_start() {
#lvsdr_monitor
#if [ $? = $OCF_SUCCESS ]; then
# return $OCF_SUCCESS
#fi
# Since this is the Director we must be able to forward packets
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/vs/expire_nodest_conn
# Clear all iptables rules.
#iptables -F
# Reset iptables counters.
#iptables -Z
# Clear all ipvsadm rules/services.
#ipvsadm -C
ipvsadm -D -t ${OCF_RESKEY_vip}:${OCF_RESKEY_port} 2>/dev/null
# Add an IP virtual service for VIP ${OCF_RESKEY_vip}:${OCF_RESKEY_port}
ipvsadm -A -t ${OCF_RESKEY_vip}:${OCF_RESKEY_port} ${OCF_RESKEY_virtual_service_options}
if [ $? -ne 0 ]; then
ocf_exit_reason "fail to add virtual server via ipvsadm"
return $OCF_ERR_GENERIC
fi
}
@ChenHuajun 执行cls_cleanup
恢复了