Difference between revisions of "Setup crm"

From PDP/Grid Wiki
Jump to navigationJump to search
 
 
Line 5: Line 5:
 
#      run on ONE node in a cluster-to-be
 
#      run on ONE node in a cluster-to-be
 
#
 
#
if [ $# -ne 2 -o "$2" != activeactive -o "$2" != activepassive ]; then
+
if [ $# -ne 3 -o "$3" != activeactive -o "$3" != activepassive ]; then
         echo "usage: $0 ipaddr {activeactive|activepassive}"
+
         echo "usage: $0 servicename ipaddr {activeactive|activepassive}"
 
         exit 1
 
         exit 1
 
fi
 
fi
  
IPADDR=$1
+
SERVICE=$1
#IPADDR=194.171.97.37
+
IPADDR=$2
TYPE=$2
+
TYPE=$3
#TYPE='activeactive'
 
#TYPE='activepassive'
 
  
 
if [ $TYPE = 'activeactive' ]; then
 
if [ $TYPE = 'activeactive' ]; then
Line 31: Line 29:
 
commit
 
commit
  
primitive bdii ocf:heartbeat:bdii
+
primitive ${SERVICE} ocf:heartbeat:${SERVICE}
clone bdii_clone bdii
+
clone ${SERVICE}_clone ${SERVICE}
colocation bdii-on-cluster INFINITY: bdii ClusterIP
+
colocation ${SERVICE}-on-cluster INFINITY: ${SERVICE} ClusterIP
 
fence-reboot stonith::suicide
 
fence-reboot stonith::suicide
 
clone fencing fence-reboot
 
clone fencing fence-reboot
Line 53: Line 51:
 
commit
 
commit
  
primitive bdii ocf:heartbeat:bdii
+
primitive ${SERVICE} ocf:heartbeat:${SERVICE}
colocation bdii-on-cluster INFINITY: bdii ClusterIP
+
colocation ${SERVICE}-on-cluster INFINITY: ${SERVICE} ClusterIP
 
fence-reboot stonith::suicide
 
fence-reboot stonith::suicide
 
clone fencing fence-reboot
 
clone fencing fence-reboot
Line 69: Line 67:
  
 
exit 0
 
exit 0
 +
 
</pre>
 
</pre>

Latest revision as of 11:54, 8 June 2011

#!/bin/bash

#
#       run on ONE node in a cluster-to-be
#
if [ $# -ne 3 -o "$3" != activeactive -o "$3" != activepassive ]; then
        echo "usage: $0 servicename ipaddr {activeactive|activepassive}"
        exit 1
fi

SERVICE=$1
IPADDR=$2
TYPE=$3

if [ $TYPE = 'activeactive' ]; then

    crm configure <<UFO

property stonith-enabled=false
commit

primitive ClusterIP ocf:heartbeat:IPaddr2 params ip=$IPADDR cidr_netmask=32 clusterip_hash="sourceip" op monitor interval=10s
clone ClusterIP_clone ClusterIP meta globally-unique=true clone-max=2 clone-node-max=2
commit

property no-quorum-policy=ignore
rsc_defaults resource-stickiness=100
commit

primitive ${SERVICE} ocf:heartbeat:${SERVICE}
clone ${SERVICE}_clone ${SERVICE}
colocation ${SERVICE}-on-cluster INFINITY: ${SERVICE} ClusterIP
fence-reboot stonith::suicide
clone fencing fence-reboot
property stonith-enabled="true"
commit

UFO

elif [ $TYPE = 'activepassive' ]; then

    crm configure <<UFO

property stonith-enabled=false
commit

primitive ClusterIP ocf:heartbeat:IPaddr2 params ip=$IPADDR cidr_netmask=32 op monitor interval=10s
property no-quorum-policy=ignore
rsc_defaults resource-stickiness=100
commit

primitive ${SERVICE} ocf:heartbeat:${SERVICE}
colocation ${SERVICE}-on-cluster INFINITY: ${SERVICE} ClusterIP
fence-reboot stonith::suicide
clone fencing fence-reboot
property stonith-enabled="true"
commit

UFO

else
    echo 'improper TYPE specified'
    exit 1
fi


exit 0