GEOM MULTIPATH でマルチパスを構成する (2)

FreeBSD

GEOM MULTIPATH は,ストレージ IO を複数のインターフェイスで冗長させることができるものです.

前回は「GEOM MULTIPATH でマルチパスを構成する (1)」で iSCSI ターゲットおよびイニシエーターのマルチパスに向けた設定追加を解説しました.

今回は GEOM MULTIPATH について纏めます.

FreeBSD で Multipath を構成する

前回,ターゲットおよびイニシエーターの設定を行い以下のとおりでディスクが見えている状態となっています.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# iscsictl -L
Target name Target portal State
iqn.2023-12.iscsi.org.seichan:target0 172.16.255.254 Connected: da4 da5
iqn.2023-12.iscsi.org.seichan:target1 172.16.255.254 Connected: da3
iqn.2023-12.iscsi.org.seichan:target2 172.16.255.254 Connected: da2
iqn.2023-12.iscsi.org.seichan:target0 172.17.255.254 Connected: da7 da9
iqn.2023-12.iscsi.org.seichan:target1 172.17.255.254 Connected: da8
iqn.2023-12.iscsi.org.seichan:target2 172.17.255.254 Connected: da6
# iscsictl -L Target name Target portal State iqn.2023-12.iscsi.org.seichan:target0 172.16.255.254 Connected: da4 da5 iqn.2023-12.iscsi.org.seichan:target1 172.16.255.254 Connected: da3 iqn.2023-12.iscsi.org.seichan:target2 172.16.255.254 Connected: da2 iqn.2023-12.iscsi.org.seichan:target0 172.17.255.254 Connected: da7 da9 iqn.2023-12.iscsi.org.seichan:target1 172.17.255.254 Connected: da8 iqn.2023-12.iscsi.org.seichan:target2 172.17.255.254 Connected: da6
# iscsictl -L
Target name                          Target portal    State
iqn.2023-12.iscsi.org.seichan:target0 172.16.255.254   Connected: da4 da5
iqn.2023-12.iscsi.org.seichan:target1 172.16.255.254   Connected: da3
iqn.2023-12.iscsi.org.seichan:target2 172.16.255.254   Connected: da2
iqn.2023-12.iscsi.org.seichan:target0 172.17.255.254   Connected: da7 da9
iqn.2023-12.iscsi.org.seichan:target1 172.17.255.254   Connected: da8
iqn.2023-12.iscsi.org.seichan:target2 172.17.255.254   Connected: da6

これらディスクはペア (同じデバイスを指している) の組み合わせと GEOM MULTIPATH で束ねた際の名前を表にまとめます.

GEOM MULTIPATH名iSCSI1上のデバイスiSCSI2上のデバイス
target0_0da4da7
target0_1da5da9
target1_0da3da8
target2_0da2da6

GEOM MULTIPATH は gmultipath というコマンドを通じて利用・管理を行います.簡単に触れますが,詳細はコマンドのオプションの詳細は FreeBSD の マニュアル「gmultipath」を見てください.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gmultipath
usage: gmultipath create [-vAR] name prov ...
gmultipath label [-vAR] name prov ...
gmultipath configure [-vAPR] name
gmultipath add [-v] name prov
gmultipath remove [-v] name prov
gmultipath prefer [-v] prov ...
gmultipath fail [-v] name prov
gmultipath restore [-v] name prov
gmultipath rotate [-v] name
gmultipath getactive [-v] name
gmultipath destroy [-v] name
gmultipath stop [-v] name
gmultipath clear [-v] prov ...
gmultipath help
gmultipath list [-a] [name ...]
gmultipath status [-ags] [name ...]
gmultipath load [-v]
gmultipath unload [-v]
# gmultipath usage: gmultipath create [-vAR] name prov ... gmultipath label [-vAR] name prov ... gmultipath configure [-vAPR] name gmultipath add [-v] name prov gmultipath remove [-v] name prov gmultipath prefer [-v] prov ... gmultipath fail [-v] name prov gmultipath restore [-v] name prov gmultipath rotate [-v] name gmultipath getactive [-v] name gmultipath destroy [-v] name gmultipath stop [-v] name gmultipath clear [-v] prov ... gmultipath help gmultipath list [-a] [name ...] gmultipath status [-ags] [name ...] gmultipath load [-v] gmultipath unload [-v]
# gmultipath
usage: gmultipath create [-vAR] name prov ...
       gmultipath label [-vAR] name prov ...
       gmultipath configure [-vAPR] name
       gmultipath add [-v] name prov
       gmultipath remove [-v] name prov
       gmultipath prefer [-v] prov ...
       gmultipath fail [-v] name prov
       gmultipath restore [-v] name prov
       gmultipath rotate [-v] name
       gmultipath getactive [-v] name
       gmultipath destroy [-v] name
       gmultipath stop [-v] name
       gmultipath clear [-v] prov ...
       gmultipath help
       gmultipath list [-a] [name ...]
       gmultipath status [-ags] [name ...]
       gmultipath load [-v]
       gmultipath unload [-v]

マルチパスでディスクを束ねる

まずは毎度のことながらカーネルモジュールをロードします.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# kldload geom_multipath
# kldstat
Id Refs Address Size Name
1 18 0xffffffff80200000 1f3e2d0 kernel
2 1 0xffffffff8213f000 9290 geom_gate.ko
3 1 0xffffffff82319000 3218 intpm.ko
4 1 0xffffffff8231d000 2180 smbus.ko
5 1 0xffffffff82320000 7490 vmci.ko
6 1 0xffffffff82328000 f0ac iscsi.ko
7 1 0xffffffff82338000 589c geom_multipath.ko
# kldload geom_multipath # kldstat Id Refs Address Size Name 1 18 0xffffffff80200000 1f3e2d0 kernel 2 1 0xffffffff8213f000 9290 geom_gate.ko 3 1 0xffffffff82319000 3218 intpm.ko 4 1 0xffffffff8231d000 2180 smbus.ko 5 1 0xffffffff82320000 7490 vmci.ko 6 1 0xffffffff82328000 f0ac iscsi.ko 7 1 0xffffffff82338000 589c geom_multipath.ko
# kldload geom_multipath

# kldstat
Id Refs Address                Size Name
 1   18 0xffffffff80200000  1f3e2d0 kernel
 2    1 0xffffffff8213f000     9290 geom_gate.ko
 3    1 0xffffffff82319000     3218 intpm.ko
 4    1 0xffffffff8231d000     2180 smbus.ko
 5    1 0xffffffff82320000     7490 vmci.ko
 6    1 0xffffffff82328000     f0ac iscsi.ko
 7    1 0xffffffff82338000     589c geom_multipath.ko

また,再起動後に備えて /boot/loader.conf にも記載します.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /boot/loader.conf
geom_multipath_load="YES"
# cat /boot/loader.conf geom_multipath_load="YES"
# cat /boot/loader.conf
geom_multipath_load="YES"

gmultipath label コマンドでディスクを束ねることが可能です.オプションとして -A と -R が指定可能で,指定しない場合は -P が使用されるとマニュアルにはあります.

  • -A
    Active / Active でアクティブなパスを全て使い IO を処理する。帯域がパスの数分ある状態。
  • -R
    Active / Readonly で通常はアクティブなパスを用いて IO 処理を行う。アクティブパスが切れたら RO として読み取りだけ可能な状態。(これを使うケースはないのでは…)
  • -P
    Active / Passive で通常はアクティブなパスを用いて IO 処理を行う。アクティブパスが切れたらもう一方のパスを利用して IO 処理を行う。

通常は Active / Active か Active / Passive を利用する事になると思います.da4 と da7 を Active / Active で target0_0 として束ねる場合のコマンドは次のとおりとなります。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gmultipath label -A target0_0 da4 da7
# gmultipath label -A target0_0 da4 da7
# gmultipath label -A target0_0 da4 da7

エラーが出なければ成功しています.gmultipath list コマンドで状態を確認してみます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gmultipath list
Geom name: target0_0
Type: AUTOMATIC
Mode: Active/Active
UUID: 42183e3b-996f-11ee-810f-0050568da523
State: OPTIMAL
Providers:
1. Name: multipath/target0_0
Mediasize: 107374181888 (100G)
Sectorsize: 512
Mode: r0w0e0
State: OPTIMAL
Consumers:
1. Name: da4
Mediasize: 107374182400 (100G)
Sectorsize: 512
Mode: r1w1e1
State: ACTIVE
2. Name: da7
Mediasize: 107374182400 (100G)
Sectorsize: 512
Mode: r1w1e1
State: ACTIVE
# gmultipath list Geom name: target0_0 Type: AUTOMATIC Mode: Active/Active UUID: 42183e3b-996f-11ee-810f-0050568da523 State: OPTIMAL Providers: 1. Name: multipath/target0_0 Mediasize: 107374181888 (100G) Sectorsize: 512 Mode: r0w0e0 State: OPTIMAL Consumers: 1. Name: da4 Mediasize: 107374182400 (100G) Sectorsize: 512 Mode: r1w1e1 State: ACTIVE 2. Name: da7 Mediasize: 107374182400 (100G) Sectorsize: 512 Mode: r1w1e1 State: ACTIVE
# gmultipath list
Geom name: target0_0
Type: AUTOMATIC
Mode: Active/Active
UUID: 42183e3b-996f-11ee-810f-0050568da523
State: OPTIMAL
Providers:
1. Name: multipath/target0_0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r0w0e0
   State: OPTIMAL
Consumers:
1. Name: da4
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
2. Name: da7
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE

プロバイダーが target0_0,コンシューマーが da4 と da7 であるということ,モードが Active/Active であることが確認できました.

このデバイスをフォーマットしてマウント,利用をしてみます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# newfs /dev/multipath/target0_0
/dev/multipath/target0_0: 102400.0MB (209715192 sectors) block size 32768, fragment size 4096
using 164 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,
# mount /dev/multipath/target0_0 /mnt
# newfs /dev/multipath/target0_0 /dev/multipath/target0_0: 102400.0MB (209715192 sectors) block size 32768, fragment size 4096 using 164 cylinder groups of 625.22MB, 20007 blks, 80128 inodes. super-block backups (for fsck_ffs -b #) at: 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568, 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944, 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320, # mount /dev/multipath/target0_0 /mnt
# newfs /dev/multipath/target0_0
/dev/multipath/target0_0: 102400.0MB (209715192 sectors) block size 32768, fragment size 4096
        using 164 cylinder groups of 625.22MB, 20007 blks, 80128 inodes.
super-block backups (for fsck_ffs -b #) at:
 192, 1280640, 2561088, 3841536, 5121984, 6402432, 7682880, 8963328, 10243776, 11524224, 12804672, 14085120, 15365568,
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496, 30730944,
 32011392, 33291840, 34572288, 35852736, 37133184, 38413632, 39694080, 40974528, 42254976, 43535424, 44815872, 46096320,

# mount /dev/multipath/target0_0 /mnt

読み書きは普通にできるとして,マルチパスで Active / Active として iSCSI トラフィックが分散されているのかを確認してみたいと思います.
dd を用いて img_X.img ファイルを生成するスクリプトを実行したうえで前後の netstat の結果を見てみました.
vmx1 および vmx2 のカウンターが上がっているため,両方のインターフェイスが利用されている状態が確認できます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# netstat -i -b -n
Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll
vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 188843 0 0 20397284 184083 0 29538342 0
vmx1 - 172.16.255.0/ 172.16.255.1 188298 - - 17728412 191281 - 26959584 -
vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 185433 0 0 18967600 182735 0 24141602 0
vmx2 - 172.17.255.0/ 172.17.255.1 184892 - - 16346652 186394 - 21581828 -
# ls /mnt
.snap img_11.img img_15.img img_19.img img_22.img img_6.img
img_0.img img_12.img img_16.img img_2.img img_3.img img_7.img
img_1.img img_13.img img_17.img img_20.img img_4.img img_8.img
img_10.img img_14.img img_18.img img_21.img img_5.img img_9.img
# netstat -i -b -n
Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll
vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 227611 0 0 22982526 187352 0 139989136 0
vmx1 - 172.16.255.0/ 172.16.255.1 227065 - - 19770856 267128 - 137364612 -
vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 223336 0 0 21524808 186269 0 132049886 0
vmx2 - 172.17.255.0/ 172.17.255.1 222794 - - 18373172 260514 - 129440636 -
# netstat -i -b -n Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 188843 0 0 20397284 184083 0 29538342 0 vmx1 - 172.16.255.0/ 172.16.255.1 188298 - - 17728412 191281 - 26959584 - vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 185433 0 0 18967600 182735 0 24141602 0 vmx2 - 172.17.255.0/ 172.17.255.1 184892 - - 16346652 186394 - 21581828 - # ls /mnt .snap img_11.img img_15.img img_19.img img_22.img img_6.img img_0.img img_12.img img_16.img img_2.img img_3.img img_7.img img_1.img img_13.img img_17.img img_20.img img_4.img img_8.img img_10.img img_14.img img_18.img img_21.img img_5.img img_9.img # netstat -i -b -n Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 227611 0 0 22982526 187352 0 139989136 0 vmx1 - 172.16.255.0/ 172.16.255.1 227065 - - 19770856 267128 - 137364612 - vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 223336 0 0 21524808 186269 0 132049886 0 vmx2 - 172.17.255.0/ 172.17.255.1 222794 - - 18373172 260514 - 129440636 -
# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 <Link#2>      00:50:56:8d:e4:3c   188843     0     0   20397284   184083     0   29538342     0
vmx1      - 172.16.255.0/ 172.16.255.1        188298     -     -   17728412   191281     -   26959584     -
vmx2   1500 <Link#3>      00:50:56:8d:e6:8c   185433     0     0   18967600   182735     0   24141602     0
vmx2      - 172.17.255.0/ 172.17.255.1        184892     -     -   16346652   186394     -   21581828     -


# ls /mnt
.snap           img_11.img      img_15.img      img_19.img      img_22.img      img_6.img
img_0.img       img_12.img      img_16.img      img_2.img       img_3.img       img_7.img
img_1.img       img_13.img      img_17.img      img_20.img      img_4.img       img_8.img
img_10.img      img_14.img      img_18.img      img_21.img      img_5.img       img_9.img


# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 <Link#2>      00:50:56:8d:e4:3c   227611     0     0   22982526   187352     0  139989136     0
vmx1      - 172.16.255.0/ 172.16.255.1        227065     -     -   19770856   267128     -  137364612     -
vmx2   1500 <Link#3>      00:50:56:8d:e6:8c   223336     0     0   21524808   186269     0  132049886     0
vmx2      - 172.17.255.0/ 172.17.255.1        222794     -     -   18373172   260514     -  129440636     -

マルチパスのモードを変更する

先ほどは Active / Active でマルチパスを構成していましたが,これを Active / Passive に変更してみます.

gmultipath configure コマンドでモードの変更が可能です.指定できるオプションは label と変わりません.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gmultipath configure -P target0_0
# gmultipath list
Geom name: target0_0
Type: AUTOMATIC
Mode: Active/Passive
UUID: 42183e3b-996f-11ee-810f-0050568da523
State: OPTIMAL
Providers:
1. Name: multipath/target0_0
Mediasize: 107374181888 (100G)
Sectorsize: 512
Mode: r1w1e1
State: OPTIMAL
Consumers:
1. Name: da4
Mediasize: 107374182400 (100G)
Sectorsize: 512
Mode: r2w2e2
State: ACTIVE
2. Name: da7
Mediasize: 107374182400 (100G)
Sectorsize: 512
Mode: r2w2e2
State: PASSIVE
# gmultipath configure -P target0_0 # gmultipath list Geom name: target0_0 Type: AUTOMATIC Mode: Active/Passive UUID: 42183e3b-996f-11ee-810f-0050568da523 State: OPTIMAL Providers: 1. Name: multipath/target0_0 Mediasize: 107374181888 (100G) Sectorsize: 512 Mode: r1w1e1 State: OPTIMAL Consumers: 1. Name: da4 Mediasize: 107374182400 (100G) Sectorsize: 512 Mode: r2w2e2 State: ACTIVE 2. Name: da7 Mediasize: 107374182400 (100G) Sectorsize: 512 Mode: r2w2e2 State: PASSIVE
# gmultipath configure -P target0_0

# gmultipath list
Geom name: target0_0
Type: AUTOMATIC
Mode: Active/Passive
UUID: 42183e3b-996f-11ee-810f-0050568da523
State: OPTIMAL
Providers:
1. Name: multipath/target0_0
   Mediasize: 107374181888 (100G)
   Sectorsize: 512
   Mode: r1w1e1
   State: OPTIMAL
Consumers:
1. Name: da4
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r2w2e2
   State: ACTIVE
2. Name: da7
   Mediasize: 107374182400 (100G)
   Sectorsize: 512
   Mode: r2w2e2
   State: PASSIVE

この状態で改めて dd のスクリプトを実行した前後の netstat の結果を確認します.
vmx1 のカウンターが上がっているため,vmx1 (Active 側) インターフェイスが利用されている状態が確認できます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# netstat -i -b -n
Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll
vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 233417 0 0 23392392 189912 0 154641112 0
vmx1 - 172.16.255.0/ 172.16.255.1 232868 - - 20099300 277873 - 151980720 -
vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 224383 0 0 21619428 187169 0 132892558 0
vmx2 - 172.17.255.0/ 172.17.255.1 223838 - - 18452996 261812 - 130270680 -
# ls /mnt
.snap img_12.img img_17.img img_21.img img_26.img img_30.img img_6.img
img_0.img img_13.img img_18.img img_22.img img_27.img img_31.img img_7.img
img_1.img img_14.img img_19.img img_23.img img_28.img img_32.img img_8.img
img_10.img img_15.img img_2.img img_24.img img_29.img img_4.img img_9.img
img_11.img img_16.img img_20.img img_25.img img_3.img img_5.img
# netstat -i -b -n
Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll
vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 343298 0 0 30681114 197348 0 469842448 0
vmx1 - 172.16.255.0/ 172.16.255.1 342749 - - 25849688 493649 - 467077952 -
vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 224464 0 0 21627366 187250 0 132900496 0
vmx2 - 172.17.255.0/ 172.17.255.1 223919 - - 18459800 261893 - 130277484 -
# netstat -i -b -n Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 233417 0 0 23392392 189912 0 154641112 0 vmx1 - 172.16.255.0/ 172.16.255.1 232868 - - 20099300 277873 - 151980720 - vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 224383 0 0 21619428 187169 0 132892558 0 vmx2 - 172.17.255.0/ 172.17.255.1 223838 - - 18452996 261812 - 130270680 - # ls /mnt .snap img_12.img img_17.img img_21.img img_26.img img_30.img img_6.img img_0.img img_13.img img_18.img img_22.img img_27.img img_31.img img_7.img img_1.img img_14.img img_19.img img_23.img img_28.img img_32.img img_8.img img_10.img img_15.img img_2.img img_24.img img_29.img img_4.img img_9.img img_11.img img_16.img img_20.img img_25.img img_3.img img_5.img # netstat -i -b -n Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 343298 0 0 30681114 197348 0 469842448 0 vmx1 - 172.16.255.0/ 172.16.255.1 342749 - - 25849688 493649 - 467077952 - vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 224464 0 0 21627366 187250 0 132900496 0 vmx2 - 172.17.255.0/ 172.17.255.1 223919 - - 18459800 261893 - 130277484 -
# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 <Link#2>      00:50:56:8d:e4:3c   233417     0     0   23392392   189912     0  154641112     0
vmx1      - 172.16.255.0/ 172.16.255.1        232868     -     -   20099300   277873     -  151980720     -
vmx2   1500 <Link#3>      00:50:56:8d:e6:8c   224383     0     0   21619428   187169     0  132892558     0
vmx2      - 172.17.255.0/ 172.17.255.1        223838     -     -   18452996   261812     -  130270680     -

# ls /mnt
.snap           img_12.img      img_17.img      img_21.img      img_26.img      img_30.img      img_6.img
img_0.img       img_13.img      img_18.img      img_22.img      img_27.img      img_31.img      img_7.img
img_1.img       img_14.img      img_19.img      img_23.img      img_28.img      img_32.img      img_8.img
img_10.img      img_15.img      img_2.img       img_24.img      img_29.img      img_4.img       img_9.img
img_11.img      img_16.img      img_20.img      img_25.img      img_3.img       img_5.img

# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 <Link#2>      00:50:56:8d:e4:3c   343298     0     0   30681114   197348     0  469842448     0
vmx1      - 172.16.255.0/ 172.16.255.1        342749     -     -   25849688   493649     -  467077952     -
vmx2   1500 <Link#3>      00:50:56:8d:e6:8c   224464     0     0   21627366   187250     0  132900496     0
vmx2      - 172.17.255.0/ 172.17.255.1        223919     -     -   18459800   261893     -  130277484     -

マルチパスの Active / Passive を切り替える

マルチパスで Active / Passive 構成をとろうとした際,複数のデバイス毎にアクティブインターフェイスを変えたい.という場合があると思います.
そんな場合に label でデバイスの指定順番で制御する事ができますが,後ほどでもアクティブパスを変更することが可能です.

パスの変更には gmultipath prefer コマンドを利用します.gmultipath getactive コマンドと共に設定および前後の確認を行ってみます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gmultipath getactive target0_0
da4
# gmultipath prefer target0_0 da7
# gmultipath getactive target0_0
da7
# gmultipath getactive target0_0 da4 # gmultipath prefer target0_0 da7 # gmultipath getactive target0_0 da7
# gmultipath getactive target0_0
da4

# gmultipath prefer target0_0 da7

# gmultipath getactive target0_0
da7

rotate コマンド実行前は da4 がアクティブパスでした.rotate 後は da7 がアクティブパスに変更されていますので,パスが切り替わった事が確認できます.

では先ほどと同様に,dd コマンドを用いたトラフィックの状況を確認してみます.
vmx2 のカウンターが上がっているため,実際の動作としても vmx2 がアクティブに変更されている状態が確認できます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# netstat -i -b -n
Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll
vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 352195 0 0 31310250 200892 0 492213664 0
vmx1 - 172.16.255.0/ 172.16.255.1 351643 - - 26354128 510042 - 489399552 -
vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 225633 0 0 21741846 188412 0 133014532 0
vmx2 - 172.17.255.0/ 172.17.255.1 225085 - - 18557776 263055 - 130375252 -
# ls /mnt
.snap img_13.img img_19.img img_24.img img_3.img img_4.img
img_0.img img_14.img img_2.img img_25.img img_30.img img_5.img
img_1.img img_15.img img_20.img img_26.img img_31.img img_6.img
img_10.img img_16.img img_21.img img_27.img img_32.img img_7.img
img_11.img img_17.img img_22.img img_28.img img_33.img img_8.img
img_12.img img_18.img img_23.img img_29.img img_34.img img_9.img
# netstat -i -b -n
Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll
vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 352262 0 0 31316970 200964 0 492220720 0
vmx1 - 172.16.255.0/ 172.16.255.1 351709 - - 26359864 510114 - 489405600 -
vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 343203 0 0 29539716 196342 0 470304936 0
vmx2 - 172.17.255.0/ 172.17.255.1 342654 - - 24709620 493956 - 467554636 -
# netstat -i -b -n Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 352195 0 0 31310250 200892 0 492213664 0 vmx1 - 172.16.255.0/ 172.16.255.1 351643 - - 26354128 510042 - 489399552 - vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 225633 0 0 21741846 188412 0 133014532 0 vmx2 - 172.17.255.0/ 172.17.255.1 225085 - - 18557776 263055 - 130375252 - # ls /mnt .snap img_13.img img_19.img img_24.img img_3.img img_4.img img_0.img img_14.img img_2.img img_25.img img_30.img img_5.img img_1.img img_15.img img_20.img img_26.img img_31.img img_6.img img_10.img img_16.img img_21.img img_27.img img_32.img img_7.img img_11.img img_17.img img_22.img img_28.img img_33.img img_8.img img_12.img img_18.img img_23.img img_29.img img_34.img img_9.img # netstat -i -b -n Name Mtu Network Address Ipkts Ierrs Idrop Ibytes Opkts Oerrs Obytes Coll vmx1 1500 <Link#2> 00:50:56:8d:e4:3c 352262 0 0 31316970 200964 0 492220720 0 vmx1 - 172.16.255.0/ 172.16.255.1 351709 - - 26359864 510114 - 489405600 - vmx2 1500 <Link#3> 00:50:56:8d:e6:8c 343203 0 0 29539716 196342 0 470304936 0 vmx2 - 172.17.255.0/ 172.17.255.1 342654 - - 24709620 493956 - 467554636 -
# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 <Link#2>      00:50:56:8d:e4:3c   352195     0     0   31310250   200892     0  492213664     0
vmx1      - 172.16.255.0/ 172.16.255.1        351643     -     -   26354128   510042     -  489399552     -
vmx2   1500 <Link#3>      00:50:56:8d:e6:8c   225633     0     0   21741846   188412     0  133014532     0
vmx2      - 172.17.255.0/ 172.17.255.1        225085     -     -   18557776   263055     -  130375252     -

# ls /mnt
.snap           img_13.img      img_19.img      img_24.img      img_3.img       img_4.img
img_0.img       img_14.img      img_2.img       img_25.img      img_30.img      img_5.img
img_1.img       img_15.img      img_20.img      img_26.img      img_31.img      img_6.img
img_10.img      img_16.img      img_21.img      img_27.img      img_32.img      img_7.img
img_11.img      img_17.img      img_22.img      img_28.img      img_33.img      img_8.img
img_12.img      img_18.img      img_23.img      img_29.img      img_34.img      img_9.img

# netstat -i -b -n
Name    Mtu Network       Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll
vmx1   1500 <Link#2>      00:50:56:8d:e4:3c   352262     0     0   31316970   200964     0  492220720     0
vmx1      - 172.16.255.0/ 172.16.255.1        351709     -     -   26359864   510114     -  489405600     -
vmx2   1500 <Link#3>      00:50:56:8d:e6:8c   343203     0     0   29539716   196342     0  470304936     0
vmx2      - 172.17.255.0/ 172.17.255.1        342654     -     -   24709620   493956     -  467554636     -

prefer は明示的にアクティブにするパス(デバイス) を指定しましたが,二つのパスの場合は gmultipath rotate でも十分に利用可能です.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gmultipath rotate target0_0
# gmultipath getactive target0_0
da4
# gmultipath rotate target0_0 # gmultipath getactive target0_0 da4
# gmultipath rotate target0_0

# gmultipath getactive target0_0
da4

マルチパスを停止する

マルチパスを停止したい場合 gmultipath destroy コマンドを利用してマルチパスの解除,メタデータの削除ができます.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# gmultipath destroy target0_0
# gmultipath status
Name Status Components
multipath/target1_0 OPTIMAL da2 (ACTIVE)
da7 (ACTIVE)
multipath/target2_0 OPTIMAL da3 (ACTIVE)
da5 (ACTIVE)
multipath/target0_1 OPTIMAL da6 (ACTIVE)
da9 (ACTIVE)
# gmultipath destroy target0_0 # gmultipath status Name Status Components multipath/target1_0 OPTIMAL da2 (ACTIVE) da7 (ACTIVE) multipath/target2_0 OPTIMAL da3 (ACTIVE) da5 (ACTIVE) multipath/target0_1 OPTIMAL da6 (ACTIVE) da9 (ACTIVE)
# gmultipath destroy target0_0

# gmultipath status
               Name   Status  Components
multipath/target1_0  OPTIMAL  da2 (ACTIVE)
                              da7 (ACTIVE)
multipath/target2_0  OPTIMAL  da3 (ACTIVE)
                              da5 (ACTIVE)
multipath/target0_1  OPTIMAL  da6 (ACTIVE)
                              da9 (ACTIVE)

他にも,一時的なパスの停止なども gmultipath コマンドで実施可能ですが,フェイルオーバーしてくれますし明示的にやるケースは少ないと思いますので紹介からは省いています.

以上 GEOM MULTIPATH の解説でした.

コメント

タイトルとURLをコピーしました