2016年11月13日日曜日

LIO Cluster [LIO, DRBD, Pacemaker による冗長化 iSCSI Target] (その9)Pacemaker にさせたいこと


あとは、Pacemaker にリソースを登録するだけですが、登録する前に、Pacemaker にさせたいことを整理する意味で、コマンドで一つ一つのリソースを操作し、スイッチオーバ(手動フェイルオーバ)させてみます。

Active 機で、VIP を削除します。


sudo ip addr del 10.110.88.59/26 dev bond0

ip addr show bond0
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 9000 qdisc noqueue state UNKNOWN
    link/ether 00:0c:29:0b:ab:b0 brd ff:ff:ff:ff:ff:ff
    inet 10.110.88.57/26 brd 10.110.88.63 scope global bond0
       valid_lft forever preferred_lft forever


Active 機で、LIO の設定をクリアします。


sudo targetctl clear

sudo targetcli ls /
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- block .............................................. [Storage Objects: 0]
  | o- fileio ............................................. [Storage Objects: 0]
  | o- pscsi .............................................. [Storage Objects: 0]
  | o- ramdisk ............................................ [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 0]
  o- loopback ..................................................... [Targets: 0]


Active 機で、DRBD 上の LVM ボリュームグループを非活性化します。


sudo vgchange -a n vg1
  0 logical volume(s) in volume group "vg1" now active

sudo lvs
  LV       VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv-drbd0 vg0  -wi-ao----   1.76t
  lv-lun0  vg1  -wi------- 359.98g
  lv-lun1  vg1  -wi------- 359.98g
  lv-lun2  vg1  -wi------- 359.98g
  lv-lun3  vg1  -wi------- 359.98g


Active 機で、DRBD リソースを secondary 化(デモート)します。


sudo drbdadm secondary all

cat /proc/drbd
version: 8.4.5 (api:1/proto:86-101)
srcversion: 1AEFF755B8BD61B81A0AF27
 0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
    ns:0 nr:0 dw:0 dr:2256 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0


Active 機と Stand-by 機で、drbd.service を停止します。


sudo systemctl stop drbd.service

cat /proc/drbd
cat: /proc/drbd: No such file or directory


※ Pacemaker によるスイッチオーバ動作時には、drbd サービスは停止させません。

ここまでの作業で、Pacemaker に登録する全てのリソースが停止できました。

今度は、Stand-by 機側でリソースを起動していきます。

Active 機と Stand-by 機で、drbd.service をほぼ同時に起動します。


sudo systemctl start drbd.service

cat /proc/drbd
version: 8.4.5 (api:1/proto:86-101)
srcversion: 1AEFF755B8BD61B81A0AF27
 0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate 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:f oos:0


※ drbd.service は Active 機だけではなく、Stand-by 機側でも起動する必要があります。HA 構成のクラスタとしては、制御方法が珍しい部類に入るリソースです。

Stand-by 機で、DRBD リソースを primary 化(プロモート)します。


sudo drbdadm primary all

cat /proc/drbd
version: 8.4.5 (api:1/proto:86-101)
srcversion: 1AEFF755B8BD61B81A0AF27
 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
    ns:0 nr:0 dw:0 dr:152 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0


Stand-by 機で、DRBD 上の LVM ボリュームグループを活性化します。


sudo vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg0" using metadata type lvm2
  Found volume group "vg1" using metadata type lvm2

sudo vgchange -a y vg1
  4 logical volume(s) in volume group "vg1" now active

sudo lvs
  LV       VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv-drbd0 vg0  -wi-ao----   1.76t
  lv-lun0  vg1  -wi-a----- 359.98g
  lv-lun1  vg1  -wi-a----- 359.98g
  lv-lun2  vg1  -wi-a----- 359.98g
  lv-lun3  vg1  -wi-a----- 359.98g


Stand-by 機で、LIO 設定をリストアします。


sudo targetctl restore

sudo targetcli ls /
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- block .............................................. [Storage Objects: 4]
  | | o- lun0 ............... [/dev/vg1/lv-lun0 (360.0GiB) write-thru activated]
  | | o- lun1 ............... [/dev/vg1/lv-lun1 (360.0GiB) write-thru activated]
  | | o- lun2 ............... [/dev/vg1/lv-lun2 (360.0GiB) write-thru activated]
  | | o- lun3 ............... [/dev/vg1/lv-lun3 (360.0GiB) write-thru activated]
  | o- fileio ............................................. [Storage Objects: 0]
  | o- pscsi .............................................. [Storage Objects: 0]
  | o- ramdisk ............................................ [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 1]
  | o- iqn.2016-09.com.example:iscsitgt01 ............................ [TPGs: 1]
  |   o- tpg1 ........................................... [no-gen-acls, no-auth]
  |     o- acls ...................................................... [ACLs: 4]
  |     | o- iqn.2016-09.com.example:initiator01 .............. [Mapped LUNs: 4]
  |     | | o- mapped_lun0 .............................. [lun0 block/lun0 (rw)]
  |     | | o- mapped_lun1 .............................. [lun1 block/lun1 (rw)]
  |     | | o- mapped_lun2 .............................. [lun2 block/lun2 (rw)]
  |     | | o- mapped_lun3 .............................. [lun3 block/lun3 (rw)]
  |     | o- iqn.2016-09.com.example:initiator02 .............. [Mapped LUNs: 4]
  |     | | o- mapped_lun0 .............................. [lun0 block/lun0 (rw)]
  |     | | o- mapped_lun1 .............................. [lun1 block/lun1 (rw)]
  |     | | o- mapped_lun2 .............................. [lun2 block/lun2 (rw)]
  |     | | o- mapped_lun3 .............................. [lun3 block/lun3 (rw)]
  |     | o- iqn.2016-09.com.example:initiator03 .............. [Mapped LUNs: 4]
  |     | | o- mapped_lun0 .............................. [lun0 block/lun0 (rw)]
  |     | | o- mapped_lun1 .............................. [lun1 block/lun1 (rw)]
  |     | | o- mapped_lun2 .............................. [lun2 block/lun2 (rw)]
  |     | | o- mapped_lun3 .............................. [lun3 block/lun3 (rw)]
  |     | o- iqn.2016-09.com.example:initiator04 .............. [Mapped LUNs: 4]
  |     |   o- mapped_lun0 .............................. [lun0 block/lun0 (rw)]
  |     |   o- mapped_lun1 .............................. [lun1 block/lun1 (rw)]
  |     |   o- mapped_lun2 .............................. [lun2 block/lun2 (rw)]
  |     |   o- mapped_lun3 .............................. [lun3 block/lun3 (rw)]
  |     o- luns ...................................................... [LUNs: 4]
  |     | o- lun0 .............................. [block/lun0 (/dev/vg1/lv-lun0)]
  |     | o- lun1 .............................. [block/lun1 (/dev/vg1/lv-lun1)]
  |     | o- lun2 .............................. [block/lun2 (/dev/vg1/lv-lun2)]
  |     | o- lun3 .............................. [block/lun3 (/dev/vg1/lv-lun3)]
  |     o- portals ................................................ [Portals: 1]
  |       o- 10.110.88.59:3260 ............................................ [OK]
  o- loopback ..................................................... [Targets: 0]


Stand-by 機で、VIP を追加します。


sudo ip addr add 10.110.88.59/26 dev bond0

ip addr show bond0
6: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 9000 qdisc noqueue state UNKNOWN
    link/ether 00:0c:29:c4:fe:24 brd ff:ff:ff:ff:ff:ff
    inet 10.110.88.58/26 brd 10.110.88.63 scope global bond0
       valid_lft forever preferred_lft forever
    inet 10.110.88.59/26 scope global secondary bond0
       valid_lft forever preferred_lft forever


次回は、Pacemaker にリソースを登録するので、前半の手順を主に Stand-by 機側で実行し、全てのリソースを停止させておきます。

0 件のコメント:

コメントを投稿