cd /usr/local/src
wget http://oss.linbit.com/drbd/8.3/drbd-8.3.8.1.tar.gz
tar xvf drbd-8.3.8.1.tar.gz
cd drbd-8.3.8.1
./configure --with-km --prefix=/usr/local/drbd-8.3.8.1
make
make install
#drbdのモジュールを読み込むので再起動
/sbin/init 6
vim /etc/drbd.conf
#protocol Cはデータを自分と相手のディスクに送った時点で完了
#rate は同期の転送速度
#on-io-errot detach は、障害時、ディスクレスモードで動作(推奨らしい)
global {
usage-count no;
}
common {
syncer { rate 10M; }
}
resource yatta {
protocol C;
startup {
wfc-timeout 0;
degr-wfc-timeout 120;
become-primary-on yatta01;
}
disk {
on-io-error detach;
}
net {
timeout 60; # 6s
connect-int 10; # 10s
ping-int 10; # 10s
ping-timeout 5; # 500ms
max-buffers 2048; # 2048PAGE_SIZE
max-epoch-size 2048; # max data block size
}
syncer { rate 10M; # sync when r0 and r1 are finished syncing.
}
on yatta01 {
device /dev/drbd0;
disk /dev/sda4;
address XXX.XXX.XXX.XXX:7789;
meta-disk internal;
}
on yatta02 {
device /dev/drbd0;
disk /dev/sda4;
address XXX.XXX>XXX.XXX:7789;
meta-disk internal;
}
}
メタデータの作成(プライマリ・セカンダリで)
/sbin/drbdadm create-md yatta01
You want me to create a v08 style flexible-size internal meta data block.
There appears to be a v08 flexible-size internal meta data block
already in place on /dev/sda4 at byte offset 225216385024
Do you really want to overwrite the existing v08 meta-data?
[need to type 'yes' to confirm] yes
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.
#起動(プライマリ)
/etc/init.d/drbd start
Starting DRBD resources: [
yatta
Found valid meta data in the expected location, 225216385024 bytes into /dev/sda4.
d(yatta) s(yatta) n(yatta) ]..........
***************************************************************
DRBD's startup script waits for the peer node(s) to appear.
- In case this node was already a degraded cluster before the
reboot the timeout is 120 seconds. [degr-wfc-timeout]
- If the peer was available before the reboot the timeout will
expire after 0 seconds. [wfc-timeout]
(These values are for resource 'yatta'; 0 sec -> wait forever)
To abort waiting enter 'yes' [ 35]:
0: State change failed: (-2) Need access to UpToDate data
Command '/sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (-2) Need access to UpToDate data
Command '/sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (-2) Need access to UpToDate data
Command '/sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (-2) Need access to UpToDate data
Command '/sbin/drbdsetup 0 primary' terminated with exit code 17
0: State change failed: (-2) Need access to UpToDate data
Command '/sbin/drbdsetup 0 primary' terminated with exit code 17
#statusを見てみる
/etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.3.8.1 (api:88/proto:86-94)
GIT-hash: 0d8589fcc32c874df57c930ca1691399b55ec893 build by root@yatta, 2011-06-23 21:26:45
m:res cs ro ds p mounted fstype
0:??not-found?? Connected Secondary/Secondary Inconsistent/Inconsistent C
#起動(セカンダリ プライマリを起動してから120秒以内にやること)
/etc/init.d/drbd start
#プライマリ側から同期開始
/sbin/drbdadm -- --overwrite-data-of-peer primary yatta
#statusを見てみる(プライマリ)
/etc/init.d/drbd status
drbd driver loaded OK; device status:
version: 8.3.8.1 (api:88/proto:86-94)
GIT-hash: 0d8589fcc32c874df57c930ca1691399b55ec893 build by root@yatta01, 2011-06-23 21:26:45
m:res cs ro ds p mounted fstype
0:??not-found?? SyncSource Primary/Secondary UpToDate/Inconsistent C
... sync'ed: 0.1% (214576/214776)M
cat /proc/drbd
version: 8.3.8.1 (api:88/proto:86-94)
GIT-hash: 0d8589fcc32c874df57c930ca1691399b55ec893 build by root@yatta01, 2011-06-23 21:26:45
0: cs:SyncSource ro:Primary/Secondary ds:UpToDate/Inconsistent C r----
ns:445440 nr:0 dw:0 dr:445440 al:0 bm:27 lo:0 pe:32 ua:0 ap:0 ep:1 wo:b oos:219486716
[>....................] sync'ed: 0.3% (214340/214776)M
finish: 5:30:33 speed: 11,048 (10,332) K/sec
#同期終わったらファイルシステム作成
/sbin/mkfs.ext3 /dev/drbd0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
27492352 inodes, 54982783 blocks
2749139 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
1678 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
#テストしてみる
#マウント(プライマリ)
mount /dev/drbd0 /opt/yattarou
#ファイル作る
umount /opt/yattarou
#プライマリをセカンダリに
/sbin/drbdadm secondary yatta
cat /proc/drbd
version: 8.3.8.1 (api:88/proto:86-94)
GIT-hash: 0d8589fcc32c874df57c930ca1691399b55ec893 build by root@yatta01, 2011-06-23 21:26:45
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r----
ns:223517604 nr:0 dw:3586472 dr:219931361 al:1730 bm:13548 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
#セカンダリ昇格
/sbin/drbdadm primary yatta
version: 8.3.8.1 (api:88/proto:86-94)
GIT-hash: 0d8589fcc32c874df57c930ca1691399b55ec893 build by root@yatta02, 2011-06-23 21:31:01
0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----
ns:0 nr:223517604 dw:223517604 dr:0 al:0 bm:13424 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
2011年6月30日木曜日
DRBD太郎
#まずprimary、secondaryのサーバでパーティションきっておく(ファイルシステムはまだ)
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿