Setup corosync

From PDP/Grid Wiki
(Redirected from Setup corosync bdii)
Jump to navigationJump to search
#!/bin/bash

#
#       run on all nodes in a cluster-to-be
#

COROSYNCCONF=/etc/corosync/corosync.conf

if [ $# -ne 2 ]; then
        echo "usage: $0 ipnet clusternumber"
        exit 1
fi
IPNET=$1
PORT=$((($2 << 1) + 5405))

if [ ! -f $COROSYNCCONF ]; then
    cp ${COROSYNCCONF}.example $COROSYNCCONF
    perl -p -i -e 's|(bindnetaddr:).*|\1  '"$IPNET|; s|(mcastport:).*|\1 $PORT|" $COROSYNCCONF

    cat >>${COROSYNCCONF}  <<UFO
aisexec {
        user: root
        group: root
}
service {
        name: pacemaker
        ver: 0
}
UFO

        /etc/init.d/corosync start

else
    echo "corosync already configured, abort"
fi