Skip to content

Instantly share code, notes, and snippets.

@d4rkstar
Forked from ianunruh/quickstart-corosync.sh
Last active August 29, 2015 14:25
Show Gist options
  • Save d4rkstar/8d20cfe041fd97299ca5 to your computer and use it in GitHub Desktop.
Save d4rkstar/8d20cfe041fd97299ca5 to your computer and use it in GitHub Desktop.
#!/bin/bash
BIND_NETWORK="192.168.5.0"
SHARED_VIP="192.168.5.30"
apt-get update
apt-get install -y pacemaker ntp
# Allow bind on a IP which is not yet defined on the system
echo 'net.ipv4.ip_nonlocal_bind=1' >> /etc/sysctl.conf
sysctl -p
# Configure Corosync
sed -i 's/START=no/START=yes/g' /etc/default/corosync
sed -i "s/bindnetaddr: 127.0.0.1/bindnetaddr: $BIND_NETWORK/g" /etc/corosync/corosync.conf
# Start clustering software
service corosync start
service pacemaker start
crm configure <<EOF
primitive virtual-ip ocf:heartbeat:IPaddr \
params ip="$SHARED_VIP"
property stonith-enabled="false"
property expected-quorum-votes="2"
property no-quorum-policy="ignore"
rsc_defaults resource-stickiness=100
commit
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment