DRBD
Постановка задачи
Требуется создать отказоустойчивый кластер с общим хранилищем данных. Область применения - кластера www-серверов (с распределением запросов round-robin-dns или аппаратными load-balancer).
Установка (gentoo)
Конфиг ядра
Для DRBD требуется connector.
Linux Kernel Configuration: Поддержка DRBD |
Device Drivers ---> <*> Connector - unified userspace <-> kernelspace linker ---> |
Установка модулей ядра и ПО для работы с DRBD
ПО для работы с DRBD и модули помечены как нестабильные. Добавить в /etc/portage/package.unmask:
sys-cluster/drbd sys-cluster/drbd-kernel
и, соответвенно, для архитектуры которая используется в /etc/portage/package.keywords
sys-cluster/drbd ~amd64 sys-cluster/drbd-kernel ~amd64
Простой конфиг
global { usage-count no; } common { protocol C; } resource r0 { on sirmax { device /dev/drbd1; disk /dev/sda7; address 10.1.1.31:7789; meta-disk internal; } on nightmare { device /dev/drbd1; disk /dev/sda7; address 10.1.1.32:7789; meta-disk internal; } }
- modprobe drbd
- drbdadm create-md drbd0
drbdadm create-md r0 md_offset 41883086848 al_offset 41883054080 bm_offset 41881772032
Found some data
==> This might destroy existing data! <==
Do you want to proceed? [need to type 'yes' to confirm] yes
Writing meta data... initializing activity log NOT initialized bitmap New drbd meta data block successfully created.
- drbdadm attach drbd0
- drbdadm connect drbd0
dmesg [86352.936619] drbd1: disk( Diskless -> Attaching ) [86352.936625] drbd1: Starting worker thread (from cqueue [20959]) [86352.937639] drbd1: No usable activity log found. [86352.937644] drbd1: max_segment_size ( = BIO size ) = 32768 [86352.937648] drbd1: drbd_bm_resize called with capacity == 81800336 [86352.938477] drbd1: resync bitmap: bits=10225042 words=159767 [86352.938482] drbd1: size = 39 GB (40900168 KB) [86352.938494] drbd1: Writing the whole bitmap, size changed [86352.977094] drbd1: 39 GB (10225042 bits) marked out-of-sync by on disk bit-map. [86353.006166] drbd1: recounting of set bits took additional 1 jiffies [86353.006171] drbd1: 39 GB (10225042 bits) marked out-of-sync by on disk bit-map. [86353.006178] drbd1: disk( Attaching -> Inconsistent ) [86381.994378] drbd1: conn( StandAlone -> Unconnected ) [86381.994398] drbd1: Starting receiver thread (from drbd1_worker [21012]) [86381.994459] drbd1: receiver (re)started [86381.994469] drbd1: conn( Unconnected -> WFConnection )
drbdadm -- --overwrite-data-of-peer primary r0
cat /proc/drbd version: 8.0.16 (api:86/proto:86) GIT-hash: d30881451c988619e243d6294a899139eed1183d build by root@nightmare, 2009-08-31 14:34:25 1: cs:SyncSource st:Primary/Secondary ds:UpToDate/Inconsistent C r--- ns:5408 nr:0 dw:0 dr:5408 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 [>....................] sync'ed: 0.1% (39936/39940)M finish: 28:23:56 speed: 360 (336) K/sec resync: used:0/61 hits:337 misses:1 starving:0 dirty:0 changed:1 act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0
Ссылки
http://www.netup.ru/articles.php?n=13
http://habrahabr.ru/blogs/hi/50143/
http://wiki.samba.org/index.php/6.0._DRBD
http://xgu.ru/wiki/DRBD
http://b2d.kiev.ua/blog/?p=7
http://sources.redhat.com/cluster/doc/usage.txt
http://blog.sozinov.eu/2008/10/gfs-global-file-system.html