Last active
August 29, 2015 14:14
-
-
Save tommybobbins/46d2c4353b5bf883b4ee to your computer and use it in GitHub Desktop.
Create nginx failover cluster from scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Cribbed liberally from: | |
#http://www.weedpi.com/how-to/how-to-create-a-pi-cluster | |
apt-get -y remove oracle-java8-jdk xserver-xorg xserver-xorg-core xserver-xorg-input-all wolfram-engine gnome-desktop3-data lxde-common lxde-core | |
apt-get -y autoremove | |
Make the following files sane: | |
/etc/hosts; /etc/hostname; /etc/network/interfaces | |
# install Heartbeat and Pacemaker (below will install both Heartbeat and Pacemaker with all dependencies) | |
sudo apt-get install heartbeat | |
# Create /etc/ha.d/ha.cf | |
debugfile /var/log/ha-debug | |
logfile /var/log/ha-log | |
logfacility local0 | |
keepalive 2 | |
deadtime 30 | |
warntime 10 | |
initdead 120 | |
udpport 694 | |
bcast eth0 | |
node rpi1 rpi2 | |
ping 10.0.0.1 | |
crm respawn | |
#Create /etc/ha.d/authkeys | |
auth 1 | |
1 crc | |
# Change the file permission for teh authkeys file | |
sudo chmod 600 /etc/ha.d/authkeys | |
# If all went well lets restart Heartbeat | |
/etc/init.d/heartbeat restart | |
crm configure property stonith-enabled=false | |
crm configure property expected-quorum-votes="2" | |
crm configure property no-quorum-policy=ignore | |
crm configure rsc_defaults resource-stickiness=100 | |
crm_attribute --type rsc_defaults --attr-name migration-threshold --attr-value 2 | |
crm_attribute --type rsc_defaults --attr-name failure-timeout --attr-value 30s | |
crm configure primitive clusterIP1 ocf:IPaddr2 params ip=10.0.0.113 cidr_netmask=24 nic=eth0 op monitor interval=30s | |
crm configure primitive nginx lsb:nginx op monitor interval="10s" timeout="20s" op start interval="0" timeout="15s" op stop interval="0" timeout="15s" | |
crm configure group cluster clusterIP1 nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment