「waku2とらふぃっくすHAクラスタ化プロジェクト」のひとつです。 本日は、「DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその3[DRBDの設定]」についてです。
こんにちは。猫ITソリューションズ広報の齊藤メイ(♀)です。 本日は、「DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその3[DRBDの設定]」についてです。
関連記事:
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその1[基本設定・LVM/ネットワーク]
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその2[DRBD/GFSのインストール]
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその3[DRBDの設定]
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその4[GFS2の設定]
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその5[LVM Clusterの設定]
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその6[GFS2でフォーマット]
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその7[動作テスト]
- DRBD(Primary/Primary) + GFS2によるネットワークミラーリングその8[起動・終了]
貴重な情報をありがとうございます。深く感謝の意を表します。
参考サイト:
- ウノウラボ Unoh Labs: DRBDによるコンテンツの相互バックアップ
- CentOS 5.2でPrimary/Primary構成のDRBD+GFSを組む
- DRBD+GFS2でPrimary/Primary構成 on CentOS での起動スクリプト - なんとなく日記
- DRBD+GFS2 - ネットワークでミラーリング + 共有ディスク
- DRBD (Primary/Primary) + GFS2で1ノード落としても大丈夫に
- 負荷分散システム上でのハードディスクデータの同期をDRBDで実現する
- GFSフォーマットする前に。 (4) RedHat Cluster と Quorum
- 検閲Tech: Xen DomU上でDRBDを使う・その0・概要
- gfsとiscsiを使ったファイル共有をやってみた(構築編)
- ほげほげぐだぐだまったり DRBDでStandAloneにしないために
- drbdのスプリットブレイン訓練 - お仕事日記。
ここでの構成は以下の通り。(xenが前提です。洒落のつもりはないです)
- (Domain-0)mikeneko.waku2traffics.com
- (Domain-U)buchineko.waku2traffics.com
- (Domain-U)sabineko.waku2traffics.com
- (Domain-0)toraneko.waku2traffics.com
- (Domain-U)shironeko.waku2traffics.com
- (Domain-U)kuroneko.waku2traffics.com
- (eth0)192.168.1.20/(eth1)10.0.0.20 mikeneko.waku2traffics.com
- (eth0)192.168.1.21/(eth1)10.0.0.21 buchineko.waku2traffics.com
- (eth0)192.168.1.22/(eth1)10.0.0.22 sabineko.waku2traffics.com
- (eth0)192.168.1.30/(eth1)10.0.0.30 toraneko.waku2traffics.com
- (eth0)192.168.1.31/(eth1)10.0.0.31 shironeko.waku2traffics.com
- (eth0)192.168.1.32/(eth1)10.0.0.32 kuroneko.waku2traffics.com
OS:CentOS5.2 x86_64版
なお、構成についてですが、正直こんな文字だけでは分からないと思います。 申し訳ありませんが図は用意できませんのでご了承願います。構成を自分なりの図にすることをオススメしますが、さっぱりわからないと思いますので、この本を参考に作る事を強くオススメします。
【中古】 Linuxアドバンストネットワークサーバ構築ガイド HAサーバ構築編/デージーネット(著者)
【中古】Xen徹底入門 オ-プンソ-スで実現するOS仮想化環境 第2版/翔泳社/宮本久仁男(大型本)
各アプリケーションのなんとなくの仕様の理解、上記構成をなんとなく図解できる程の把握、Xenでの仮想化完了が前提となります。 以下の記事も合わせてお読みください。
Xen(Domain-0)のインストール
Xen(Domain-U)のインストール
Xenマスターイメージ作成
Xen(Domain-U)の複製(LVMベース)
Xen(Domain-U)で複数のネットワークインターフェイスを使う
DRBDの設定
DRBDの設定ファイルを編集
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# vi /etc/drbd.conf # At most ONE global section is allowed. # It must precede any resource section. global { usage-count no; } # The common section can have all the sections a resource can have but # not the host section (started with the "on" keyword). # The common section must precede all resources. # All resources inherit the settings from the common section. # Whereas settings in the resources have precedence over the common # setting. common { protocol C; syncer { rate 10M; al-extents 257; } startup { wfc-timeout 0; degr-wfc-timeout 15; } disk { on-io-error detach; } net { sndbuf-size 512k; timeout 60; connect-int 10; ping-int 10; ping-timeout 5; max-buffers 8192; max-epoch-size 8192; cram-hmac-alg "sha1"; shared-secret "xxxxxxxx"; allow-two-primaries; } } # # this need not be r#, you may use phony resource names, # like "resource web" or "resource mail", too # resource r0 { on sabineko.waku2traffics.com { device /dev/drbd0; disk /dev/xvdb; address 10.0.0.22:7788; meta-disk internal; } on kuroneko.waku2traffics.com { device /dev/drbd0; disk /dev/xvdb; address 10.0.0.32:7788; meta-disk internal; } } |
sabineko/kuroneko両方で、 ここまで再起動を何回か「してしまった」が、何度やってもコマンドが通らなかった。
なので、
1 |
#chkconfig drbd off |
として再起動し、drbdを起動せずに実行。 そのあと、
1 |
# cp /etc/drbd.conf /etc/drbd.conf.bk |
としてdrbd.confの内容をまっさらに戻して更に再起動。
sabineko/kuronekoで実行。
ファイアーウォールを一時的に無効にする。
1 |
# iptables -F |
SELinuxを一時的に無効にする。
1 |
# setenforce 0 |
インストール後(特にdrbd.confを設定した後)には、 DRBDセットアップが完了するまで再起動しない方がいいのかしら、、、
sabinekoで実行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# drbdadm create-md r0 md_offset 5368705024 al_offset 5368672256 bm_offset 5368508416 Found some data ==> This might destroy existing data! <== Do you want to proceed? [need to type 'yes' to confirm] yes v07 Magic number not found v07 Magic number not found You want me to create a v08 style flexible-size internal meta data block. There apears to be a v08 flexible-size internal meta data block already in place on /dev/xvdb at byte offset 5368705024 Do you really want to overwrite the existing v08 meta-data? [need to type 'yes' to confirm] yes Writing meta data... initialising activity log NOT initialized bitmap New drbd meta data block sucessfully created. # drbdadm attach r0 drbd0: No usable activity log found. ←ここが気になるが無視した drbd0: Barriers not supported on meta data device - disabling # drbdadm connect r0 # cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:32 0: cs:WFConnection st:Secondary/Unknown ds:Inconsistent/DUnknown C r--- ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 oos:5242684 |
kuronekoで実行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# drbdadm create-md r0 v07 Magic number not found v07 Magic number not found You want me to create a v08 style flexible-size internal meta data block. There apears to be a v08 flexible-size internal meta data block already in place on /dev/xvdb at byte offset 5368705024 Do you really want to overwrite the existing v08 meta-data? [need to type 'yes' to confirm] yes Writing meta data... initialising activity log NOT initialized bitmap New drbd meta data block sucessfully created. # drbdadm attach r0 drbd0: No usable activity log found. ←ここが気になるが無視した drbd0: Barriers not supported on meta data device - disabling # drbdadm connect r0 # cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:32 0: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent C r--- ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 oos:5242684 |
初期同期を実行。
初期同期コマンドは、sabineko/kuronekoどちらか一方で実行すればいい。今回はsabinekoで実行した。 /proc/drbdで進行状況がわかる。
1 |
# drbdadm -- --overwrite-data-of-peer primary r0 |
cat /proc/drbd で進行状況がわかる。しばし待つ。 ・・・てゆーかヤバイくらい待つ事になった。 コレのせいかと思われるが、コレで良しとする。5時間くらいかかった? とりあえず転送速度については後で何とかするとする。
drbd.conf
1 2 3 4 5 6 7 |
# cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:32 0: cs:SyncSource st:Primary/Secondary ds:UpToDate/Inconsistent C r--- ns:14640 nr:0 dw:0 dr:14640 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 oos:5228044 [>....................] sync'ed: 0.4% (5105/5119)M ←コレ finish: 3:37:50 speed: 140 (244) K/sec |
同期が終わったら以下のようになる。状況確認。 sabinekoで実行。
1 2 3 4 5 |
# cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:32 0: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r--- ns:5242684 nr:0 dw:0 dr:5242684 al:0 bm:320 lo:0 pe:0 ua:0 ap:0 oos:0 |
kuronekoで実行。
1 2 3 4 5 |
# cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:32 0: cs:Connected st:Secondary/Primary ds:UpToDate/UpToDate C r--- ns:0 nr:5242684 dw:5242684 dr:0 al:0 bm:320 lo:0 pe:0 ua:0 ap:0 oos:0 |
今回はPrimary/Primary構成のため、kuroneko(Secondary) を Primary に昇格させる。 kuronekoで実行。
1 |
# drbdadm primary r0 |
確認。
sabinekoで実行。
1 2 3 4 5 |
# cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:32 0: cs:Connected st:Primary/Primary ds:UpToDate/UpToDate C r--- ← Primaryになった。 ns:5242684 nr:0 dw:0 dr:5242684 al:0 bm:320 lo:0 pe:0 ua:0 ap:0 oos:0 |
kuronekoで実行。
1 2 3 4 5 |
# cat /proc/drbd version: 8.2.6 (api:88/proto:86-88) GIT-hash: 3e69822d3bb4920a8c1bfdf7d647169eba7d2eb4 build by buildsvn@c5-x8664-build, 2008-10-03 11:30:32 0: cs:Connected st:Primary/Primary ds:UpToDate/UpToDate C r--- ← Primaryになった。 ns:0 nr:5242684 dw:5242684 dr:0 al:0 bm:320 lo:0 pe:0 ua:0 ap:0 oos:0 |
次回は、GFS2の設定についてです。