ChenHuajun / pha4pgsql

Pacemaker High Availability for PostgreSQL
GNU General Public License v3.0
62 stars 29 forks source link

lvsdr 显示stopped 应该怎么恢复它? #10

Closed RavenZZ closed 5 years ago

RavenZZ commented 5 years ago

image

ChenHuajun commented 5 years ago
  1. 执行cls_cleanup检查是否可以修复
  2. 对照下面的代码,看下日志(/var/log/cluster/corosync.log)里输出什么错误消息:

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
}
  1. 可以手动执行下面启动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
    }
RavenZZ commented 5 years ago

@ChenHuajun 执行cls_cleanup恢复了