配置Multipath多路径环境

iscsi服务器      eth0:192.168.4.5/24

        eth1:192.168.2.5/24

iscsi客户端      eth0:192.168.4.100/24

        eth3:201.1.2.100/24

 

iscsi服务器端:   软件(targetcli)

1).定义后端存储

[root@proxy ~]# targetcli
/> backstores/block create store /dev/vdb1

2).创建iqn对象

/> /iscsi create iqn.2018-01.cn.tedu:server1

3).授权客户机访问

/> iscsi/iqn.2018-01.cn.tedu:server1/tpg1/acls create iqn.2018-01.cn.tedu:client1

4).绑定存储

/>iscsi/iqn.2018-01.cn.tedu:server1/tpg1/luns create /backstores/block/store 

5).绑定存储绑定监听地址,并保存配置

/> iscsi/iqn.2018-01.cn.tedu:server1/tpg1/portals/ create 0.0.0.0
/> saveconfig 
/> exit

 

iscsi客户端:   软件 ( iscsi-initiator-utils)

1).发现存储服务器的共享磁盘

[root@web1 ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.2.5 --discover
192.168.2.5:3260,1 iqn.2018-01.cn.tedu:client1
[root@web1 ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.4.5 --discover
192.168.4.5:3260,1 iqn.2018-01.cn.tedu:client1

2).登陆共享存储

[root@web1 ~]# iscsiadm --mode node --targetname iqn.2018-01.cn.tedu:server1 --portal 192.168.2.5:3260 --login

3).重启

[root@web1 ~]# service iscsi restart
[root@web1 ~]# lsblk 

4).开机自启

[root@web1 ~]# systemctl enable iscsid
[root@web1 ~]# systemctl enable iscsi

 

 

配置Multipath多路径

1).安装多路径软件包

[root@web1 ~]# yum list | grep multipath

[root@web1 ~]# yum install -y device-mapper-multipath

2).生成配置文件

[root@web1 ~]# cd /usr/share/doc/device-mapper-multipath-0.4.9/
[root@web1 ~]# cp multipath.conf  /etc/multipath.conf

3).获取wwid

[root@web1 ~]# /usr/lib/udev/scsi_id --whitelisted --device=/dev/sdb 

4).修改配置文件

[root@web1 ~]# vim /etc/multipath.conf
defaults {
        user_friendly_names yes
find_multipaths yes
}


multipaths {
    multipath {
        wwid    "360014059e8ba68638854e9093f3ba3a0"
        alias   mpatha
    }
}

 

启动Multipath多路径并测试

1).启动Multipath,并设置为开机自启

[root@web1 ~]# systemctl start multipathd
[root@web1 ~]# systemctl enable multipathd

2).检查多路径设备文件

[root@web1 ~]# ls /dev/mapper/

 

3).对多路径设备文件执行分区、格式化、挂载操作

...
[root@web1 ~]# mkfs.xfs /dev/mapper/mpatha1 [root@web1 ~]# mkdir /data [root@web1 ~]# mount /dev/mapper/mpatha1 /data/

 

4).验证多路径

[root@web1 ~]# multipath -rr
[root@web1 ~]# multipath -ll

 

posted @ 2018-12-28 20:24  Ray_chen  阅读(1079)  评论(0编辑  收藏  举报