Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pacemaker_cluster [2015/11/25 11:31]
Pekka Kuronen
pacemaker_cluster [2017/11/06 10:11]
Line 1: Line 1:
-===== Super quick steps to set up a Pacemaker cluster to Centos 6 ===== 
- 
- 
-This is a quickie to show you how to start do Pacemaker ensured high available Apache with a service IP and KVM virtual host fencing. 
- 
- 
-==== Install software ==== 
- 
- 
-Install these to every node and virtual host as well 
- 
- 
-<​code>​ 
-yum install fence-virt fence-virtd ence-virtd-multicast fence-virtd-libvirt 
-</​code>​ 
- 
- 
-Install these to pacemaker nodes / guests 
- 
- 
-<​code>​ 
-yum install pacemaker cman pcs ccs resource-agents 
-</​code>​ 
- 
- 
-==== Prepare virtual machine fencing ==== 
- 
- 
-Configure at virtual host, use virbr0, /​etc/​cluster/​fence_xvm.key 
- 
- 
-<​code>​ 
-fence_virtd -c 
-</​code>​ 
- 
- 
-Make key 
- 
- 
-<​code>​ 
-dd if=/​dev/​random bs=512 count=1 of=/​etc/​cluster/​fence_xvm.key 
-</​code>​ 
- 
- 
-Configuration should be like this 
- 
- 
-<​code>​ 
-backends { 
- ​ libvirt { 
-  uri = "​qemu:///​system";​ 
-  } 
- } 
- ​listeners { 
- ​ multicast { 
- ​ key_file = "/​etc/​cluster/​fence_xvm.key";​ 
- ​ interface = "​virbr0";​ 
- ​ port = "​1229";​ 
- ​ address = "​225.0.0.12";​ 
- ​ family = "​ipv4";​ 
-  } 
- } 
- ​fence_virtd { 
- ​ backend = "​libvirt";​ 
- ​ listener = "​multicast";​ 
- ​ module_path = "/​usr/​lib64/​fence-virt";​ 
- } 
-</​code>​ 
- 
- 
-Start fencing daemon, insert to your rc.local to get it up after boot 
- 
- 
-<​code>​ 
-fence_virtd 
-</​code>​ 
- 
- 
-Test it, you should see your virtual guests 
- 
- 
-<​code>​ 
-fence_xvm -o list 
-</​code>​ 
- 
- 
-Copy the /​etc/​cluster/​fence_xvm.key to all guests 
- 
- 
-Test in GUESTS. if timeouts check if you are using other interface at the virtual host, br0 etc 
- 
- 
-<​code>​ 
-fence_xvm -o listen 
-</​code>​ 
- 
- 
-Configure the fencing to your pacemaker cluster later with command 
- 
- 
-<​code>​ 
-crm configure primitive st-virt stonith:​fence_xvm 
-</​code>​ 
- 
- 
-==== configure your pacemaker ==== 
- 
- 
-Do this in one node and copy the /​etc/​cluster to all nodes 
- 
- 
-<​code>​ 
-ccs -f /​etc/​cluster/​cluster.conf --addfencedev pcmk agent=fence_pcmk ​ 
-ccs -f /​etc/​cluster/​cluster.conf --addmethod pcmk-redirect host1 
-ccs -f /​etc/​cluster/​cluster.conf --addmethod pcmk-redirect host2 
-ccs -f /​etc/​cluster/​cluster.conf --addfenceinst pcmk host1 pcmk-redirect port=host1 
-ccs -f /​etc/​cluster/​cluster.conf --addfenceinst pcmk host2 pcmk-redirect port=host2 
-</​code>​ 
- 
- 
-Do this in every node 
- 
- 
-<​code>​ 
-cp /​etc/​corosync/​corosync.conf.example /​etc/​corosync/​corosync.conf 
-echo "​CMAN_QUORUM_TIMEOUT=0">>​ /​etc/​sysconfig/​cman 
-</​code>​ 
- 
- 
-==== Fire it up ==== 
- 
- 
-<​code>​ 
-chkconfig cman on 
-chkconfig pacemaker on 
-</​code>​ 
- 
- 
-<​code>​ 
-service cman start 
-service pacemaker start 
-</​code>​ 
- 
- 
-<​code>​ 
-pcs status 
-pcs config 
-</​code>​ 
- 
- 
-==== Start putting the thing to work ==== 
- 
- 
-Set basic properties 
- 
- 
-<​code>​ 
-pcs property set stonith-enabled=true 
-pcs property set no-quorum-policy=ignore 
-pcs resource defaults migration-threshold=1 
-</​code>​ 
- 
- 
-Set up Apache with HA IP 
- 
- 
-Be sure that your Apache provides [[http://​localhost/​server-status|http://​localhost/​server-status]] ​ 
- 
- 
-<​code>​ 
-pcs resource create WebSite ocf:​heartbeat:​apache configfile=/​etc/​httpd/​conf/​httpd.conf statusurl="​http://​localhost/​server-status"​ op monitor interval=1min 
-pcs resource create ClusterIP ocf:​heartbeat:​IPaddr2 ip=1.2.3.4 nic="​eth0"​ cidr_netmask=27 op monitor interval=30s 
-pcs constraint colocation add WebSite ClusterIP INFINITY 
-pcs constraint location WebSite prefers host1=50 
-</​code>​ 
- 
- 
-Finally put the nodes to shoot each other when they'​ve get a problem 
- 
- 
-<​code>​ 
-crm configure primitive st-virt stonith:​fence_xvm 
-</​code>​ 
- 
-{(rater>​id=persistent_source_routing|type=rate|trace=ip|tracedetails=0|headline=off)} 
- 
-~~DISCUSSION|Leave a comment~~ 
  

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line