Best practice

    crm_mon
crm configure show
INFO: building help index
node bart
node lisa
property $id="cib-bootstrap-options" \
	dc-version="1.0.9-74392a28b7f31d7ddc86689598bd23114f58978b" \
	cluster-infrastructure="openais" \
	expected-quorum-votes="2"
crm_verify -L
crm configure property stonith-enabled=false
crm_verify -L
crm configure primitive SimpsonsIP ocf:heartbeat:IPaddr2 params ip=192.168.1.50 cidr_netmask=32 op monitor interval=30s
crm configure property no-quorum-policy=ignore
crm configure rsc_defaults resource-stickiness=100
crm configure primitive Apache2 ocf:heartbeat:apache \
         params configfile=/etc/httpd/conf/httpd.conf \
         op monitor interval=1min

crm configure colocation website-with-ip INFINITY: Apache2 SimpsonsIP
crm configure order apache-after-ip mandatory: ClusterIP Apache2

Just in case:

crm configure delete Apache2
crm resource move Apache2 Bart
crm resource unmove Apache2 # This is not unmove, but rather giving the control back to the cluster

drbd

  • first disable drbd in /etc/init.d/drbd
  • create drbd resource Rmail
  • add a constraint (ms, only one master)
  • create a filesystem resource, device and mount point (like /etc/fstab)
  • dependencies fs is only on the master (primary)
  • fs is allowed to start after the Primary was promoted
insserv -r drbd
chkconfig --del drbd
# drbd
configure primitive res_mail ocf:linbit:drbd params drbd_resource=Rmail op monitor interval=60s
ms MailClone res_mail meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
# fs
cib new fs
    configure primitive mailfs ocf:heartbeat:Filesystem \
         params device="/dev/drbd0" directory="/var/mail" fstype="ext4"
    configure colocation fs_on_drbd inf: mailfs MailClone:Master
    configure order mailfs-after-res_mail inf: MailClone:promote mailfs:start
    # services - postfix,apache2...
    configure colocation postfix-with-mailfs inf: postfix mailfs
    configure colocation Apache2-with-srvfs inf: Apache2 srvfs
    configure order Apache2-after-srvfs inf: srvfs Apache2
cib commit fs

Tips & tricks

 drbdsetup /dev/drbd0 syncer -r 120M

Full working example config

node bart \
	attributes standby="off"
node lisa \
	attributes standby="off"
primitive Apache2 ocf:heartbeat:apache \
	params configfile="/etc/apache2/apache2.conf" \
	op monitor interval="1min"
primitive SimpsonsIP ocf:heartbeat:IPaddr2 \
	params ip="192.168.1.50" cidr_netmask="32" \
	op monitor interval="30s"
primitive postfix ocf:heartbeat:postfix \
	op monitor interval="1min" timeout="1min"
primitive srv ocf:linbit:drbd \
	params drbd_resource="srv" \
	op monitor interval="60s"
primitive srvfs ocf:heartbeat:Filesystem \
	params device="/dev/drbd0" directory="/srv" fstype="ext4"
ms SrvClone srv \
	meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
location prefer-bart Apache2 10: bart
colocation Apache2-with-srvfs inf: Apache2 srvfs
colocation fs_on_drbd inf: srvfs SrvClone:Master
colocation postfix-with-ip inf: postfix SimpsonsIP
colocation postfix-with-srvfs inf: postfix srvfs
colocation website-with-ip inf: Apache2 SimpsonsIP
order Apache2-after-srvfs inf: srvfs Apache2
order postfix-after-ip inf: SimpsonsIP postfix
order postifx-after-srvfs inf: srvfs postfix
order srvfs-after-srv inf: SrvClone:promote srvfs:start
property $id="cib-bootstrap-options" \
	dc-version="1.0.9-74392a28b7f31d7ddc86689598bd23114f58978b" \
	cluster-infrastructure="openais" \
	expected-quorum-votes="2" \
	stonith-enabled="false" \
	no-quorum-policy="ignore"
rsc_defaults $id="rsc-options" \
	resource-stickiness="100"

Prehazovani sluzeb z uzlu na uzel

 crm resource move Apache2 lisa

Ale pozor! Ted se o resource nestara jiz cluster, ale vy! Takze je potreba udelat

 crm resource unmove Apache2
 
 
linux/cluster/openais.txt · Last modified: 2011/11/11 23:38 by 78.102.87.187