- [Show page]
- [Old revisions]
- [[unknown link type]]
- []
Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
linux:skoleni:ha [2015/02/26 01:34] admin |
linux:skoleni:ha [2016/12/05 15:30] (current) admin |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== HA - basics ====== | ||
| Note: Fibre channel - cheap stuff!!! | Note: Fibre channel - cheap stuff!!! | ||
| Line 20: | Line 21: | ||
| Install DRBD: | Install DRBD: | ||
| - | [root@node1 ~]# yum -y install drbd83-utils kmod-drbd83 | + | [root@node1 ~]# yum -y install drbd84-utils kmod-drbd84 |
| - | [root@node2 ~]# yum -y install drbd83-utils kmod-drbd83 | + | [root@node2 ~]# yum -y install drbd84-utils kmod-drbd84 |
| Insert drbd module manually on both machines or reboot: | Insert drbd module manually on both machines or reboot: | ||
| Line 27: | Line 28: | ||
| /sbin/modprobe drbd | /sbin/modprobe drbd | ||
| - | Partition DRBD on both machines: | + | |
| + | ====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@node1 ~]# fdisk -cu /dev/sdb | ||
| [root@node2 ~]# 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 ==== | ||
| + | <file bash 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" | ||
| + | </file> | ||
| + | |||
| + | ==== DRBD config ==== | ||
| + | <code bash> | ||
| + | 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; | ||
| + | } | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | 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. | ||
| + | <code> | ||
| + | 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 | ||
| + | </code> | ||
| + | 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 | ||
| + | <file bash /etc/ucarp.d/vip-001.conf> | ||
| + | VIP_ADDRESS="192.168.5.123" | ||
| + | </file> | ||
| + | |||
| + | <file bash /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" | ||
| + | </file> | ||
| - | drbdadm -- --overwrite-data-of-peer primary repdata | ||
| - | drbdadm -- --overwrite-data-of-peer primary repdata | ||
linux/skoleni/ha.1424910860.txt.gz · Last modified: 2015/02/26 01:34 by admin


