全部博文(573)
分类: LINUX
2015-12-07 15:37:11
1)检查当前的session数目
[root@snowdog ~]# iscsiadm --mode session
tcp: [1] 192.168.98.101:3260,2 iqn.1986-03.com.sun:02:9934b71a-aeb0-e4a6-a8c3-eefbef32b87a (non-flash)、
2)添加任意多个session
[root@snowdog ~]# iscsiadm --mode session -r 1 --op new
Logging in to [iface: default, target: iqn.1986-03.com.sun:02:9934b71a-aeb0-e4a6-a8c3-eefbef32b87a, portal: 192.168.98.101,3260] (multiple)
Login to [iface: default, target: iqn.1986-03.com.sun:02:9934b71a-aeb0-e4a6-a8c3-eefbef32b87a, portal: 192.168.98.101,3260] successful.
注,这个命令只是添加一个session.如果想要添加更多,就重复执行上面的命令。-r后面跟的1是session的id。
再次检查session是否添加成功
[root@snowdog ~]# iscsiadm --mode session
tcp: [1] 192.168.98.101:3260,2 iqn.1986-03.com.sun:02:9934b71a-aeb0-e4a6-a8c3-eefbef32b87a (non-flash)
tcp: [2] 192.168.98.101:3260,2 iqn.1986-03.com.sun:02:9934b71a-aeb0-e4a6-a8c3-eefbef32b87a (non-flash)
3)如果想使以上新创建的session永久生效,需要执行以下命令
[root@snowdog ~]# iscsiadm -m node -T iqn.1986-03.com.sun:02:9934b71a-aeb0-e4a6-a8c3-eefbef32b87a -p 192.168.98.101 --op update -n node.session.nr_sessions -v 4
介绍完了multiple sessions之后,我们来看一下,在只有一个target的情况下,如何配置multiple path。
4)session创建好之后,察看iscsi LUs,你会看到通过每个session都可以看到配置的LUs,但我们知道他们是同一个,这就需要接着配置multipath了。
[root@localhost etc]# lsscsi
[0:2:0:0] disk LSI MR9261-8i 2.12 /dev/sda
[1:0:0:0] disk ORACLE SSM PMAP /dev/sdb
[6:0:0:0] cd/dvd TEAC DV-W28SS-W 1.0A /dev/sr0
[8:0:0:0] cd/dvd AMI Virtual CDROM 1.00 /dev/sr1
[10:0:0:0] disk SUN ZFS Storage 7330 1.0 /dev/sdc
[10:0:0:1] disk SUN ZFS Storage 7330 1.0 /dev/sdd
[10:0:0:2] disk SUN ZFS Storage 7330 1.0 /dev/sde
[10:0:0:3] disk SUN ZFS Storage 7330 1.0 /dev/sdf
[10:0:0:4] disk SUN ZFS Storage 7330 1.0 /dev/sdg
[10:0:0:5] disk SUN ZFS Storage 7330 1.0 /dev/sdh
[10:0:0:6] disk SUN ZFS Storage 7330 1.0 /dev/sdi
[10:0:0:7] disk SUN ZFS Storage 7330 1.0 /dev/sdj
[10:0:0:8] disk SUN ZFS Storage 7330 1.0 /dev/sdk
[10:0:0:9] disk SUN ZFS Storage 7330 1.0 /dev/sdl
[10:0:0:10] disk SUN ZFS Storage 7330 1.0 /dev/sdm
[10:0:0:11] disk SUN ZFS Storage 7330 1.0 /dev/sdn
[10:0:0:12] disk SUN ZFS Storage 7330 1.0 /dev/sdo
[10:0:0:13] disk SUN ZFS Storage 7330 1.0 /dev/sdp
[10:0:0:14] disk SUN ZFS Storage 7330 1.0 /dev/sdq
[10:0:0:15] disk SUN ZFS Storage 7330 1.0 /dev/sdr
[10:0:0:16] disk SUN ZFS Storage 7330 1.0 /dev/sds
[10:0:0:17] disk SUN ZFS Storage 7330 1.0 /dev/sdt
[10:0:0:18] disk SUN ZFS Storage 7330 1.0 /dev/sdu
[10:0:0:19] disk SUN ZFS Storage 7330 1.0 /dev/sdv
[10:0:0:20] disk SUN ZFS Storage 7330 1.0 /dev/sdw
[10:0:0:21] disk SUN ZFS Storage 7330 1.0 /dev/sdx
[10:0:0:22] disk SUN ZFS Storage 7330 1.0 /dev/sdy
[10:0:0:23] disk SUN ZFS Storage 7330 1.0 /dev/sdz
[10:0:0:24] disk SUN ZFS Storage 7330 1.0 /dev/sdaa
[10:0:0:25] disk SUN ZFS Storage 7330 1.0 /dev/sdab
[10:0:0:26] disk SUN ZFS Storage 7330 1.0 /dev/sdac
[10:0:0:27] disk SUN ZFS Storage 7330 1.0 /dev/sdad
[10:0:0:28] disk SUN ZFS Storage 7330 1.0 /dev/sdae
[10:0:0:29] disk SUN ZFS Storage 7330 1.0 /dev/sdaf
[10:0:0:30] disk SUN ZFS Storage 7330 1.0 /dev/sdag
[10:0:0:31] disk SUN ZFS Storage 7330 1.0 /dev/sdah
[11:0:0:0] disk SUN ZFS Storage 7330 1.0 /dev/sdai
[11:0:0:1] disk SUN ZFS Storage 7330 1.0 /dev/sdaj
[11:0:0:2] disk SUN ZFS Storage 7330 1.0 /dev/sdak
[11:0:0:3] disk SUN ZFS Storage 7330 1.0 /dev/sdal
[11:0:0:4] disk SUN ZFS Storage 7330 1.0 /dev/sdam
[11:0:0:5] disk SUN ZFS Storage 7330 1.0 /dev/sdan
[11:0:0:6] disk SUN ZFS Storage 7330 1.0 /dev/sdao
[11:0:0:7] disk SUN ZFS Storage 7330 1.0 /dev/sdap
[11:0:0:8] disk SUN ZFS Storage 7330 1.0 /dev/sdaq
[11:0:0:9] disk SUN ZFS Storage 7330 1.0 /dev/sdar
[11:0:0:10] disk SUN ZFS Storage 7330 1.0 /dev/sdas
[11:0:0:11] disk SUN ZFS Storage 7330 1.0 /dev/sdat
[11:0:0:12] disk SUN ZFS Storage 7330 1.0 /dev/sdau
[11:0:0:13] disk SUN ZFS Storage 7330 1.0 /dev/sdav
[11:0:0:14] disk SUN ZFS Storage 7330 1.0 /dev/sdaw
[11:0:0:15] disk SUN ZFS Storage 7330 1.0 /dev/sdax
[11:0:0:16] disk SUN ZFS Storage 7330 1.0 /dev/sday
[11:0:0:17] disk SUN ZFS Storage 7330 1.0 /dev/sdaz
[11:0:0:18] disk SUN ZFS Storage 7330 1.0 /dev/sdba
[11:0:0:19] disk SUN ZFS Storage 7330 1.0 /dev/sdbb
[11:0:0:20] disk SUN ZFS Storage 7330 1.0 /dev/sdbc
[11:0:0:21] disk SUN ZFS Storage 7330 1.0 /dev/sdbd
[11:0:0:22] disk SUN ZFS Storage 7330 1.0 /dev/sdbe
[11:0:0:23] disk SUN ZFS Storage 7330 1.0 /dev/sdbf
[11:0:0:24] disk SUN ZFS Storage 7330 1.0 /dev/sdbg
[11:0:0:25] disk SUN ZFS Storage 7330 1.0 /dev/sdbh
[11:0:0:26] disk SUN ZFS Storage 7330 1.0 /dev/sdbi
[11:0:0:27] disk SUN ZFS Storage 7330 1.0 /dev/sdbj
[11:0:0:28] disk SUN ZFS Storage 7330 1.0 /dev/sdbk
[11:0:0:29] disk SUN ZFS Storage 7330 1.0 /dev/sdbl
[11:0:0:30] disk SUN ZFS Storage 7330 1.0 /dev/sdbm
[11:0:0:31] disk SUN ZFS Storage 7330 1.0 /dev/sdbn
[12:0:0:0] disk SUN ZFS Storage 7330 1.0 /dev/sdbo
[12:0:0:1] disk SUN ZFS Storage 7330 1.0 /dev/sdbp
[12:0:0:2] disk SUN ZFS Storage 7330 1.0 /dev/sdbq
[12:0:0:3] disk SUN ZFS Storage 7330 1.0 /dev/sdbr
[12:0:0:4] disk SUN ZFS Storage 7330 1.0 /dev/sdbs
[12:0:0:5] disk SUN ZFS Storage 7330 1.0 /dev/sdbt
[12:0:0:6] disk SUN ZFS Storage 7330 1.0 /dev/sdbu
[12:0:0:7] disk SUN ZFS Storage 7330 1.0 /dev/sdbv
[12:0:0:8] disk SUN ZFS Storage 7330 1.0 /dev/sdbw
[12:0:0:9] disk SUN ZFS Storage 7330 1.0 /dev/sdbx
[12:0:0:10] disk SUN ZFS Storage 7330 1.0 /dev/sdby
[12:0:0:11] disk SUN ZFS Storage 7330 1.0 /dev/sdbz
[12:0:0:12] disk SUN ZFS Storage 7330 1.0 /dev/sdca
[12:0:0:13] disk SUN ZFS Storage 7330 1.0 /dev/sdcb
[12:0:0:14] disk SUN ZFS Storage 7330 1.0 /dev/sdcc
[12:0:0:15] disk SUN ZFS Storage 7330 1.0 /dev/sdcd
[12:0:0:16] disk SUN ZFS Storage 7330 1.0 /dev/sdce
[12:0:0:17] disk SUN ZFS Storage 7330 1.0 /dev/sdcf
[12:0:0:18] disk SUN ZFS Storage 7330 1.0 /dev/sdcg
[12:0:0:19] disk SUN ZFS Storage 7330 1.0 /dev/sdch
[12:0:0:20] disk SUN ZFS Storage 7330 1.0 /dev/sdci
[12:0:0:21] disk SUN ZFS Storage 7330 1.0 /dev/sdcj
[12:0:0:22] disk SUN ZFS Storage 7330 1.0 /dev/sdck
[12:0:0:23] disk SUN ZFS Storage 7330 1.0 /dev/sdcl
[12:0:0:24] disk SUN ZFS Storage 7330 1.0 /dev/sdcm
[12:0:0:25] disk SUN ZFS Storage 7330 1.0 /dev/sdcn
[12:0:0:26] disk SUN ZFS Storage 7330 1.0 /dev/sdco
[12:0:0:27] disk SUN ZFS Storage 7330 1.0 /dev/sdcp
[12:0:0:28] disk SUN ZFS Storage 7330 1.0 /dev/sdcq
[12:0:0:29] disk SUN ZFS Storage 7330 1.0 /dev/sdcr
[12:0:0:30] disk SUN ZFS Storage 7330 1.0 /dev/sdcs
[12:0:0:31] disk SUN ZFS Storage 7330 1.0 /dev/sdct
[13:0:0:0] disk SUN ZFS Storage 7330 1.0 /dev/sdcu
[13:0:0:1] disk SUN ZFS Storage 7330 1.0 /dev/sdcv
[13:0:0:2] disk SUN ZFS Storage 7330 1.0 /dev/sdcw
[13:0:0:3] disk SUN ZFS Storage 7330 1.0 /dev/sdcx
[13:0:0:4] disk SUN ZFS Storage 7330 1.0 /dev/sdcy
[13:0:0:5] disk SUN ZFS Storage 7330 1.0 /dev/sdcz
[13:0:0:6] disk SUN ZFS Storage 7330 1.0 /dev/sdda
[13:0:0:7] disk SUN ZFS Storage 7330 1.0 /dev/sddb
[13:0:0:8] disk SUN ZFS Storage 7330 1.0 /dev/sddc
[13:0:0:9] disk SUN ZFS Storage 7330 1.0 /dev/sddd
[13:0:0:10] disk SUN ZFS Storage 7330 1.0 /dev/sdde
[13:0:0:11] disk SUN ZFS Storage 7330 1.0 /dev/sddf
[13:0:0:12] disk SUN ZFS Storage 7330 1.0 /dev/sddg
[13:0:0:13] disk SUN ZFS Storage 7330 1.0 /dev/sddh
[13:0:0:14] disk SUN ZFS Storage 7330 1.0 /dev/sddi
[13:0:0:15] disk SUN ZFS Storage 7330 1.0 /dev/sddj
[13:0:0:16] disk SUN ZFS Storage 7330 1.0 /dev/sddk
[13:0:0:17] disk SUN ZFS Storage 7330 1.0 /dev/sddl
[13:0:0:18] disk SUN ZFS Storage 7330 1.0 /dev/sddm
[13:0:0:19] disk SUN ZFS Storage 7330 1.0 /dev/sddn
[13:0:0:20] disk SUN ZFS Storage 7330 1.0 /dev/sddo
[13:0:0:21] disk SUN ZFS Storage 7330 1.0 /dev/sddp
[13:0:0:22] disk SUN ZFS Storage 7330 1.0 /dev/sddq
[13:0:0:23] disk SUN ZFS Storage 7330 1.0 /dev/sddr
[13:0:0:24] disk SUN ZFS Storage 7330 1.0 /dev/sdds
[13:0:0:25] disk SUN ZFS Storage 7330 1.0 /dev/sddt
[13:0:0:26] disk SUN ZFS Storage 7330 1.0 /dev/sddu
[13:0:0:27] disk SUN ZFS Storage 7330 1.0 /dev/sddv
[13:0:0:28] disk SUN ZFS Storage 7330 1.0 /dev/sddw
[13:0:0:29] disk SUN ZFS Storage 7330 1.0 /dev/sddx
[13:0:0:30] disk SUN ZFS Storage 7330 1.0 /dev/sddy
[13:0:0:31] disk SUN ZFS Storage 7330 1.0 /dev/sddz
5)安装device-mapper-multipath
[root@localhost vdbench504]# yum install device-mapper-multipath
Loaded plugins: langpacks
ol7_UEKR3 | 1.2 kB 00:00:00
ol7_latest | 1.4 kB 00:00:00
(1/2): ol7_latest/x86_64/updateinfo | 89 kB 00:00:01
(2/2): ol7_latest/x86_64/primary | 6.9 MB 00:00:16
ol7_latest 7417/7417
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-multipath.x86_64 0:0.4.9-66.el7 will be installed
--> Processing Dependency: device-mapper-multipath-libs = 0.4.9-66.el7 for package: device-mapper-multipath-0.4.9-66.el7.x86_64
--> Processing Dependency: libmpathpersist.so.0()(64bit) for package: device-mapper-multipath-0.4.9-66.el7.x86_64
--> Processing Dependency: libmultipath.so.0()(64bit) for package: device-mapper-multipath-0.4.9-66.el7.x86_64
--> Running transaction check
---> Package device-mapper-multipath-libs.x86_64 0:0.4.9-66.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
device-mapper-multipath x86_64 0.4.9-66.el7 ol7_latest 106 k
Installing for dependencies:
device-mapper-multipath-libs x86_64 0.4.9-66.el7 ol7_latest 200 k
Transaction Summary
=============================================================================================================================
Install 1 Package (+1 Dependent package)
Total download size: 306 k
Installed size: 713 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): device-mapper-multipath-0.4.9-66.el7.x86_64.rpm | 106 kB 00:00:01
(2/2): device-mapper-multipath-libs-0.4.9-66.el7.x86_64.rpm | 200 kB 00:00:02
-----------------------------------------------------------------------------------------------------------------------------
Total 122 kB/s | 306 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : device-mapper-multipath-libs-0.4.9-66.el7.x86_64 1/2
Installing : device-mapper-multipath-0.4.9-66.el7.x86_64 2/2
Verifying : device-mapper-multipath-0.4.9-66.el7.x86_64 1/2
Verifying : device-mapper-multipath-libs-0.4.9-66.el7.x86_64 2/2
Installed:
device-mapper-multipath.x86_64 0:0.4.9-66.el7
Dependency Installed:
device-mapper-multipath-libs.x86_64 0:0.4.9-66.el7
Complete!
6)安装完device-mapper-multipath之后,需要修改/etc/multipath.conf文件来配置multipath。一般来说,这个文件默认是不存在的,你可以通过mpathconf来生成配置文件。具体如下:
[root@localhost etc]# mpathconf --enable --user_friendly_names y
7)启动multipathd。
[root@localhost etc]# service multipathd restart
Redirecting to /bin/systemctl restart multipathd.service
8)察看系统multipath的状态。
[root@localhost etc]# multipath -ll
mpathr (3600144f0f68eecf8000054aa012c0017) dm-20 SUN ,ZFS Storage 7330
size=256M features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 10:0:0:22 sdy 65:128 active ready running
|-+- policy='service-time 0' prio=1 status=enabled
| `- 11:0:0:22 sdbe 67:128 active ready running
|-+- policy='service-time 0' prio=1 status=enabled
| `- 12:0:0:22 sdck 69:128 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
`- 13:0:0:22 sddq 71:128 active ready running
mpathe (3600144f0f68eecf8000054aa011f000b) dm-7 SUN ,ZFS Storage 7330
size=256M features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 10:0:0:10 sdm 8:192 active ready running
|-+- policy='service-time 0' prio=1 status=enabled
| `- 11:0:0:10 sdas 66:192 active ready running
|-+- policy='service-time 0' prio=1 status=enabled
| `- 12:0:0:10 sdby 68:192 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
`- 13:0:0:10 sdde 70:192 active ready running
从输出中可以看出,系统默认使用的path-grouping-policy是service-time,path之间是独立的,没有group起来,接下来,我们来做进一步的配置。
9)设置path_selector以及path_grouping_policy,具体做法是在multipath.conf文件中的defaults定义中加入如下定义,然后重启multipathd service。
defaults {
user_friendly_names yes
find_multipaths yes
path_selector "round-robin 0"
failback immediate
no_path_retry fail
path_grouping_policymultibus
}
10)做完上述操作之后,配置基本完成了,我们通过multiplepath 命令再察看一下系统中的path状态,bingo!done!
[root@localhost ~]# multipath -ll
mpathr (3600144f0f68eecf8000054aa012c0017) dm-27 SUN ,ZFS Storage 7330
size=256M features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 10:0:0:22 sdbe 67:128 active ready running
|- 11:0:0:22 sdck 69:128 active ready running
|- 12:0:0:22 sddq 71:128 active ready running
`- 9:0:0:22 sdy 65:128 active ready running
mpathe (3600144f0f68eecf8000054aa011f000b) dm-16 SUN ,ZFS Storage 7330
size=256M features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
|- 10:0:0:10 sdas 66:192 active ready running
|- 11:0:0:10 sdby 68:192 active ready running
|- 12:0:0:10 sdde 70:192 active ready running
`- 9:0:0:10 sdm 8:192 active ready running