Install and Configure Multipath on Centos
Server 1 : test1
The same target will show like two disks on test2.
[root@test ~]# tgt-admin --show
Target 1: iqn.2008-09.com.example:first
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 5
Initiator: iqn.1994-05.com.redhat:test2
Connection: 0
IP Address: 31.x.x.x
I_T nexus: 6
Initiator: iqn.1994-05.com.redhat:test2
Connection: 0
IP Address: 10.50.68.16
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 4295 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/vgsrv/storage
Backing store flags:
Account information:
ACL information:
31.x.x.x
10.50.68.16
On test2:
Testing Multipath,
[root@test ~]# multipath -ll
1IET_00010001 dm-0 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 6:0:0:1 sda 8:0 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 5:0:0:1 sdb 8:16 active ready running
[root@test ~]# ifdown eth1
[root@test ~]# multipath -ll
1IET_00010001 dm-0 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| `- 6:0:0:1 sda 8:0 active faulty running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 5:0:0:1 sdb 8:16 active ready running
[root@test ~]# ifup eth1
[root@test ~]# multipath -ll
1IET_00010001 dm-0 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 6:0:0:1 sda 8:0 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 5:0:0:1 sdb 8:16 active ready running
Now If one path fails [e.g sda] but still the storage will accessible by another path[e.g sdb].
213.x.x.x - eth0
10.50.68.15 - eth1
Server 2 : test2
31.x.x.x - eth0
10.50.68.16 - eth1
Step 1:
Create an LVM on test1 and make this LVM as target.
Step 2:
On test2, Login to target you created on test1 using both ip's.
iscsiadm -m discovery -t sendtargets -p 213.x.x.x
iscsiadm -m node -T iqn.2008-09.com.example:first -p 213.x.x.x -l
iscsiadm -m discovery -t sendtargets -p 10.50.68.15
iscsiadm -m node -T iqn.2008-09.com.example:first -p 10.50.68.15 -l
iscsiadm -m node -T iqn.2008-09.com.example:first -p 10.50.68.15 -l
[root@test ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda1 202:1 0 15G 0 disk /
xvda2 202:2 0 2G 0 disk [SWAP]
sda 8:0 0 4G 0 disk
sdb 8:16 0 4G 0 disk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda1 202:1 0 15G 0 disk /
xvda2 202:2 0 2G 0 disk [SWAP]
sda 8:0 0 4G 0 disk
sdb 8:16 0 4G 0 disk
The same target will show like two disks on test2.
On test1:
[root@test ~]# tgt-admin --show
Target 1: iqn.2008-09.com.example:first
System information:
Driver: iscsi
State: ready
I_T nexus information:
I_T nexus: 5
Initiator: iqn.1994-05.com.redhat:test2
Connection: 0
IP Address: 31.x.x.x
I_T nexus: 6
Initiator: iqn.1994-05.com.redhat:test2
Connection: 0
IP Address: 10.50.68.16
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 4295 MB, Block size: 512
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: rdwr
Backing store path: /dev/vgsrv/storage
Backing store flags:
Account information:
ACL information:
31.x.x.x
10.50.68.16
On test2:
[root@test ~]# iscsiadm -m session -P3
iSCSI Transport Class version 2.0-870
version 6.2.0-873.13.el6
Target: iqn.2008-09.com.example:first (non-flash)
Current Portal: 213.x.x.x:3260,1
Persistent Portal: 213.x.x.x:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1994-05.com.redhat:test2
Iface IPaddress: 31.x.x.x
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 6
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
*********
Timeouts:
*********
Recovery Timeout: 2
Target Reset Timeout: 2
LUN Reset Timeout: 2
Abort Timeout: 2
*****
CHAP:
*****
username: <empty>
password: ********
username_in: <empty>
password_in: ********
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 8192
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
************************
Attached SCSI devices:
************************
Host Number: 5 State: running
scsi5 Channel 00 Id 0 Lun: 0
scsi5 Channel 00 Id 0 Lun: 1
Attached scsi disk sdb State: running
Current Portal: 10.50.68.15:3260,1
Persistent Portal: 10.50.68.15:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1994-05.com.redhat:test2
Iface IPaddress: 10.50.68.16
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 7
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
*********
Timeouts:
*********
Recovery Timeout: 2
Target Reset Timeout: 2
LUN Reset Timeout: 2
Abort Timeout: 2
*****
CHAP:
*****
username: <empty>
password: ********
username_in: <empty>
password_in: ********
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 8192
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
************************
Attached SCSI devices:
************************
Host Number: 6 State: running
scsi6 Channel 00 Id 0 Lun: 0
scsi6 Channel 00 Id 0 Lun: 1
Attached scsi disk sda State: running
Step 4:
iSCSI Transport Class version 2.0-870
version 6.2.0-873.13.el6
Target: iqn.2008-09.com.example:first (non-flash)
Current Portal: 213.x.x.x:3260,1
Persistent Portal: 213.x.x.x:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1994-05.com.redhat:test2
Iface IPaddress: 31.x.x.x
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 6
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
*********
Timeouts:
*********
Recovery Timeout: 2
Target Reset Timeout: 2
LUN Reset Timeout: 2
Abort Timeout: 2
*****
CHAP:
*****
username: <empty>
password: ********
username_in: <empty>
password_in: ********
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 8192
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
************************
Attached SCSI devices:
************************
Host Number: 5 State: running
scsi5 Channel 00 Id 0 Lun: 0
scsi5 Channel 00 Id 0 Lun: 1
Attached scsi disk sdb State: running
Current Portal: 10.50.68.15:3260,1
Persistent Portal: 10.50.68.15:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1994-05.com.redhat:test2
Iface IPaddress: 10.50.68.16
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 7
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
*********
Timeouts:
*********
Recovery Timeout: 2
Target Reset Timeout: 2
LUN Reset Timeout: 2
Abort Timeout: 2
*****
CHAP:
*****
username: <empty>
password: ********
username_in: <empty>
password_in: ********
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 8192
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
************************
Attached SCSI devices:
************************
Host Number: 6 State: running
scsi6 Channel 00 Id 0 Lun: 0
scsi6 Channel 00 Id 0 Lun: 1
Attached scsi disk sda State: running
Step 4:
Install & configure multipath on test2,
yum install device-mapper-multipath
mpathconf --user_friendly_names n
service multipathd start
Then,
[root@test ~]# ls -la /dev/mapper/1IET_00010001
lrwxrwxrwx 1 root root 7 Apr 2 00:01 /dev/mapper/1IET_00010001 -> ../dm-0
[root@test ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda1 202:1 0 15G 0 disk /
xvda2 202:2 0 2G 0 disk [SWAP]
sda 8:0 0 4G 0 disk
└─1IET_00010001 (dm-0) 253:0 0 4G 0 mpath
sdb 8:16 0 4G 0 disk
└─1IET_00010001 (dm-0) 253:0 0 4G 0 mpath
lrwxrwxrwx 1 root root 7 Apr 2 00:01 /dev/mapper/1IET_00010001 -> ../dm-0
[root@test ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda1 202:1 0 15G 0 disk /
xvda2 202:2 0 2G 0 disk [SWAP]
sda 8:0 0 4G 0 disk
└─1IET_00010001 (dm-0) 253:0 0 4G 0 mpath
sdb 8:16 0 4G 0 disk
└─1IET_00010001 (dm-0) 253:0 0 4G 0 mpath
Testing Multipath,
[root@test ~]# multipath -ll
1IET_00010001 dm-0 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 6:0:0:1 sda 8:0 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 5:0:0:1 sdb 8:16 active ready running
[root@test ~]# ifdown eth1
[root@test ~]# multipath -ll
1IET_00010001 dm-0 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| `- 6:0:0:1 sda 8:0 active faulty running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 5:0:0:1 sdb 8:16 active ready running
[root@test ~]# ifup eth1
[root@test ~]# multipath -ll
1IET_00010001 dm-0 IET,VIRTUAL-DISK
size=4.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 6:0:0:1 sda 8:0 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 5:0:0:1 sdb 8:16 active ready running
Now If one path fails [e.g sda] but still the storage will accessible by another path[e.g sdb].
Comments
Post a Comment