Setup corosync

From PDP/Grid Wiki
Revision as of 14:24, 31 May 2011 by Gertp (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
  1. !/bin/bash
  1. run on all nodes in a cluster-to-be
  1. IPNET=194.171.97.0

if [ $# -ne 1 ]; then

       echo "usage: $0 ipnet"
       exit 1

fi

IPNET=$1

heartbeat_bdii=/usr/lib/ocf/resource.d/heartbeat/bdii heartbeat_bdii_source=heartbeat_bdii COROSYNCCONF=/etc/corosync/corosync.conf

if [ ! -e $heartbeat_bdii ]; then

   if [ -e $heartbeat_bdii_source ]; then
       cp $heartbeat_bdii_source $heartbeat_bdii
   else
       echo "bdii heartbeat startup script not found. fix me."
       exit 1
   fi

fi

if [ ! -f $COROSYNCCONF ]; then

   cp ${COROSYNCCONF}.example $COROSYNCCONF
   perl -p -i -e 's|(bindnetaddr:).*|\1  '"$IPNET|" $COROSYNCCONF
   cat >>/etc/corosync/corosync.conf <<UFO

aisexec {

       user: root
       group: root

} service {

       name: pacemaker
       ver: 0

} UFO

       /etc/init.d/corosync start

else

   echo "corosync already configured, abort"

fi