Reply To: RE: HA stops at every midnight and peer disk becomes standalone

VitalPBX Community Support General Discussion HA stops at every midnight and peer disk becomes standalone Reply To: RE: HA stops at every midnight and peer disk becomes standalone

    Up
    0
    Down

    You may create the following script to solve the split-brain on DRBD

    cat > /usr/local/bin/drbdsplit << EOF
    #!/bin/bash
    set -e
    # Authors: Rodrigo Cuadra
    # with Collaboration of Jose Miguel Rivera
    # 2019/11/06
    # Support: rcuadra@aplitel.com
    #
    drbdadm secondary drbd0
    drbdadm disconnect drbd0
    drbdadm -- --discard-my-data connect drbd0
    ssh root@$ip_slave "drbdadm connect drbd0"
    echo "Disk Status"
    drbdadm status
    EOF
    chmod +x /usr/local/bin/drbdsplit

    Where the variable “$ip_slave”, is the IP of the opposite server.

    This script must be created on both servers.

    To automatize this process, you can edit the file “/etc/drbd.conf”, and add the following on both servers:

    resource resourcename {
    	   [snip]
    	   handlers {
    	      split-brain "/usr/local/bin/drbdsplit";
    	   }
    	   [snip]
    	}
    0