- [Show pagesource]
- [Old revisions]
- [[unknown link type]]
- []
Table of Contents
HA - basics
Note: Fibre channel - cheap stuff!!!
Requirements
- Two disks (preferably same size and my lovely LVM)
- Networking between machines (node1 & node2), Tip: VMPlayer LAN Segments
- Working DNS resolution (/etc/hosts file)
- Selinux disabled
- Iptables ports (7788) allowed
- and lot of patience
Install ELRepo repository on your both system:
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
Update both repo:
yum update -y
Install DRBD:
[root@node1 ~]# yum -y install drbd84-utils kmod-drbd84 [root@node2 ~]# yum -y install drbd84-utils kmod-drbd84
Insert drbd module manually on both machines or reboot:
/sbin/modprobe drbd
Partition DRBD on both machines (the ugly way):
If your linux box doesn't detect new disk automaticly, you can try rescanning the scsi bus
echo "- - -" >/sys/class/scsi_host/host0/scan
[root@node1 ~]# fdisk -cu /dev/sdb [root@node2 ~]# fdisk -cu /dev/sdb
and the right way:
[root@node1 ~]# lvcreate -L 4GB -n mail_disk vg_jahoda [root@node2 ~]# lvcreate -L 4GB -n mail_disk vg_boruvka
Setup the network
- ifcfg-eth1
DEVICE="eth1" BOOTPROTO="none" HWADDR="00:0C:29:DA:26:E9" IPADDR="10.1.1.1" NETMASK="255.255.255.252" IPV6INIT="yes" NM_CONTROLLED="no" ONBOOT="yes" TYPE="Ethernet"
DRBD config
resource mail_disk { protocol C; startup { wfc-timeout 30; outdated-wfc-timeout 20; degr-wfc-timeout 30; } net { cram-hmac-alg sha1; shared-secret sync_disk; } syncer { rate 100M; al-extents 257; on-no-data-accessible io-error; } on node1 { device /dev/drbd0; disk /dev/jahoda/mail; address 10.1.1.1:7788; flexible-meta-disk internal; } on node2 { device /dev/drbd0; disk /dev/boruvka/mail; address 10.1.1.2:7788; meta-disk internal; } }
Initialize devices (very similar to pvcreate or mkfs.ext4):
[root@node1 ~]# drbdadm create-dm mail_disk [root@node2 ~]# drbdadm create-dm mail_disk
It is time to start the services. And be careful Jimm, you have 30 seconds to start both.
[root@node1 ~]# service drbd restart [root@node2 ~]# /etc/init.d/drbd restart
Check cat /proc/drbd
, we should be both Secondary/Secondary and data Inconsistent/Inconsistent. The rest is garbage for geeks.
version: 8.4.5 (api:1/proto:86-101) GIT-hash: 1d360bde0e095d495786eaeb2a1ac76888e4db96 build by phil@Build64R6, 2014-10-28 10:32:53 0: cs:Connected ro:Secondary/Secondary ds:Diskless/Inconsistent C r----- ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
Careful reader could have notices we are having Diskless/Inconsistent. Initialize (create-dm) the disk again or zero it (dd if=/dev/zero) and initialize again and thing should be fine.
[root@node1 ~]# drbdadm -- --overwrite-data-of-peer primary mail_disk
UCARP (VRRP)
Open the page and install epel http://mirror.hosting90.cz/epel/6/x86_64/repoview/epel-release.html Or try using this direct link, but might be unavailable later
yum install http://mirror.hosting90.cz/epel/6/x86_64/epel-release-6-8.noarch.rpm
Install ucarp
yum install ucarp
config
- /etc/ucarp.d/vip-001.conf
VIP_ADDRESS="192.168.5.123"
- /etc/ucarp.d/vip-common.conf
PASSWORD="love" BIND_INTERFACE="eth0" SOURCE_ADDRESS="192.168.5.39" # If you have extra options to add, see "ucarp --help" output OPTIONS="--shutdown --preempt"