Linux platform: CentOS 6.5 x86_64
Install DRBD 8.3
rpm -ivh http://www.elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
yum -y install drbd83-utils kmod-drbd83 (drbd84 is conflict with resource-agents-3.9.5)
1. zabbix mysql database server:
vip, mysql, drbd resource, drbd filesystem
chkconfig mysqld off
chkconfig drbd off
primitive clusterip ocf:heartbeat:IPaddr2 params ip="192.168.1.52" cidr_netmask="24"
primitive zabbixdata ocf:linbit:drbd params drbd_resource="zabbixdata"
ms zabbixdataclone zabbixdata meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
primitive zabbixfs ocf:heartbeat:Filesystem params device="/dev/drbd/by-res/zabbixdata" directory="/new/mysql" fstype="ext4"primitive mysqld lsb:mysqld
group myzabbix zabbixfs clusterip mysqld
colocation myzabbix_on_drbd inf: myzabbix zabbixdataclone:Master
order myzabbix_after_drbd inf: zabbixdataclone:promote myzabbix:start
2. zabbix server:
vip, zabbixserver
chkconfig zabbix-server off
SourceIP/ListenIP --> ClusterIP
primitive clusterip ocf:heartbeat:IPaddr2 params ip="192.168.1.51" cidr_netmask="24"
primitive myzabbixserver ocf:heartbeat:zabbixserver
group myzabbix clusterip myzabbixserver
3. zabbix web:
vip, apache
chkconfig httpd off
primitive clusterip ocf:heartbeat:IPaddr2 params ip="192.168.1.50" cidr_netmask="24"
primitive website ocf:heartbeat:apache params configfile="/etc/httpd/conf/httpd.conf"
group myweb clusterip website
wget
/etc/httpd/conf/httpd.conf
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1 <YOUR-NETWORK-HERE/24>
</Location>
LSB Resource Agents are those found in /etc/init.d
.
OCF Resource Agents are those found in /usr/lib/ocf/resource.d/provider
vi /etc/drbd.d/wwwdata.res
resource wwwdata {
device /dev/drbd0;
disk /dev/sdb;
meta-disk internal;
syncer {
verify-alg sha1;
}
# below is for Active/Active mode
# Please refer http://www.drbd.org/users-guide-8.3/s-enable-dual-primary.html
# net {
# allow-two-primaries;
# }
on zabbixweb01.test.com {
address 192.168.1.15:7789;
}
on zabbixweb02.test.com {
address 192.168.1.25:7789;
}
}
primitive clusterip ocf:heartbeat:IPaddr2 params ip="192.168.1.50" cidr_netmask="24"
primitive website ocf:heartbeat:apache params configfile="/etc/httpd/conf/httpd.conf"
primitive webdata ocf:linbit:drbd params drbd_resource="wwwdata"
ms webdataclone webdata meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
primitive webfs ocf:heartbeat:Filesystem params device="/dev/drbd/by-res/wwwdata" directory="/var/www/html" fstype="ext4"
group myweb webfs clusterip website
colocation myweb_on_drbd inf: myweb webdataclone:Master
order myweb_after_drbd inf: webdataclone:promote myweb:start
also can be done by below[
colocation website-with-webfs inf: website webfs
order website-after-webfs inf: webfs website
colocation fs_on_drbd inf: webfs webdataclone:Master
order webfs-after-webdata inf: webdataclone:promote webfs:start
colocation website-with-ip inf: website clusterip
order apache-after-ip inf: clusterip website
]
crm configure show
若有location cli-prefer-website website inf: zabbixweb01.test.com role=Started
则crm configure delete cli-prefer-website
for using GFS2
mkfs.gfs2 -p lock_dlm -j 2 -t mycluster:web /dev/drbd0
delete webfs
primitive webfs ocf:heartbeat:Filesystem params device="/dev/drbd/by-res/wwwdata" directory="/var/www/html" fstype="gfs2"
clone clusteripclone clusterip meta globally-unique="true" clone-max="2" clone-node-max="2"
configure edit clusterip to add params [clusterip_hash="sourceip"]
clone webfsclone webfs
clone websiteclone website
edit webdataclone to change master-max="2"
colocation website-with-webfs inf: websiteclone webfsclone
order website-after-webfs inf: webfsclone websiteclone
colocation fs_on_drbd inf: webfsclone webdataclone:Master
order webfs-after-webdata inf: webdataclone:promote webfsclone:start
colocation website-with-ip inf: websiteclone clusteripclone
order apache-after-ip inf: clusteripclone websiteclone