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 | + | 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 | ||
| − | + | SERVICE=$1 | |
| − | + | IPADDR=$2 | |
| − | + | TYPE=$3 | |
| − | |||
| − | |||
if [ $TYPE = 'activeactive' ]; then | if [ $TYPE = 'activeactive' ]; then | ||
| Line 31: | Line 29: | ||
commit | commit | ||
| − | primitive | + | primitive ${SERVICE} ocf:heartbeat:${SERVICE} |
| − | clone | + | clone ${SERVICE}_clone ${SERVICE} |
| − | colocation | + | 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 | + | primitive ${SERVICE} ocf:heartbeat:${SERVICE} |
| − | colocation | + | 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 09: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