前言
在企业级数据中心中,Fibre Channel (FC) 技术因其高速度、低延迟和高可靠性而广泛应用于存储网络。然而,单一的FC链路存在单点故障风险,一旦链路或相关硬件出现故障,可能导致数据访问中断,影响业务连续性。
为了解决这一问题,多路径和双链路策略成为构建高可用性FC存储网络的关键技术,本文将模拟FC双链路存储网络。
一、环境配置
操作系统 |
主机名 |
IP地址 |
rhel8 |
iscsi-server |
192.168.2.115 |
192.168.2.125 | ||
rhel8 |
iscsi-client |
192.168.2.116 |
1.1 iscsi-server
- 网络配置
[root@db1 ~]# ip a
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:1d:d3:ac brd ff:ff:ff:ff:ff:ff
inet 192.168.2.115/24 brd 192.168.2.255 scope global noprefixroute ens160
valid_lft forever preferred_lft forever
inet6 fe80::890c:e836:972e:6de/64 scope link dadfailed tentative noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::5a22:4f3f:10e4:92bb/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:1d:d3:b6 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.125/24 brd 192.168.2.255 scope global noprefixroute ens224
valid_lft forever preferred_lft forever
inet6 fe80::a48a:2770:ffb9:a2e2/64 scope link noprefixroute
valid_lft forever preferred_lft forever
- 存储配置
Disk /dev/sda: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
/dev/sda作为存储设备对外提供服务
1.2 iscsi-client网络配置
[root@db2 ~]# ip a
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:0c:29:87:45:61 brd ff:ff:ff:ff:ff:ff
inet 192.168.2.116/24 brd 192.168.2.255 scope global noprefixroute ens160
valid_lft forever preferred_lft forever
inet6 fe80::890c:e836:972e:6de/64 scope link noprefixroute
valid_lft forever preferred_lft forever
二、配置iscsi-server
由于我们没有存储设备,所以选择使用ISCSI块存储服务来模拟存储设备,通过在iscsi-server主机上绑定两个ip地址,来模拟存储设备到主机client的双链路。
2.1 关闭防火墙和selinux
--关闭防火墙
systemctl stop firewalld
systemctl disabled firewalld
--编辑/etc/selinux/config
设置SELINUX=disabled
reboot
2.2 安装ISCSI块存储服务
[root@db1 ]# yum install -y targetcli
2.3 配置ISCSI块存储服务
[root@db1 network-scripts]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> /backstores/block create dream:storage1 /dev/sda
Created block storage object dream:storage1 using /dev/sda.
/> /iscsi create iqn.2024-08.com.example:iscsi-server
Created target iqn.2024-08.com.example:iscsi-server.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> cd iqn.2024-08.com.example:iscsi-server/tpg1/acls
/iscsi/iqn.20...ver/tpg1/acls> /iscsi/iqn.2024-08.com.example:iscsi-server/tpg1/acls create iqn.2024-08.com.example:iscsi-server
Created Node ACL for iqn.2024-08.com.example:iscsi-server
/iscsi/iqn.20...ver/tpg1/acls> ls
o- acls ...................................................................... [ACLs: 1]
o- iqn.2024-08.com.example:iscsi-server ............................. [Mapped LUNs: 0]
/iscsi/iqn.20...ver/tpg1/acls> /iscsi/iqn.2024-08.com.example:iscsi-server/tpg1/luns create /backstores/block/dream:storage1
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.2024-08.com.example:iscsi-server
/iscsi/iqn.20...ver/tpg1/acls> ls
o- acls ...................................................................... [ACLs: 1]
o- iqn.2024-08.com.example:iscsi-server ............................. [Mapped LUNs: 1]
o- mapped_lun0 .................................... [lun0 block/dream:storage1 (rw)]
/iscsi/iqn.20...ver/tpg1/acls> exit
Global pref auto_save_on_exit=true
Configuration saved to /etc/target/saveconfig.json
2.4 启动服务
[root@db1 network-scripts]# systemctl start target
[root@db1 network-scripts]# systemctl status target
● target.service - Restore LIO kernel target configuration
Loaded: loaded (/usr/lib/systemd/system/target.service; disabled; vendor preset: dis>
Active: active (exited) since Wed 2024-07-31 10:36:30 CST; 3s ago
Process: 9009 ExecStart=/usr/bin/targetctl restore (code=exited, status=0/SUCCESS)
Main PID: 9009 (code=exited, status=0/SUCCESS
三、配置iscsi客户端
3.1 安装 iscsi-initiator-utils
[root@db2 ~]# yum install -y iscsi-initiator-utils
3.2 加入iscsi认证
[root@db2 ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2024-08.com.example:iscsi-server
3.3 发现服务端ISCSI设备
[root@db2 ~]# iscsiadm -m discovery -t st -p 192.168.2.115
192.168.2.115:3260,1 iqn.2024-08.com.example:iscsi-server
[root@db2 ~]# iscsiadm -m discovery -t st -p 192.168.2.125
192.168.2.125:3260,1 iqn.2024-08.com.example:iscsi-server
3.4 登陆设备
[root@db2 ~]# iscsiadm -m node -T iqn.2024-08.com.example:iscsi-server -p 192.168.2.115 -l
Logging in to [iface: default, target: iqn.2024-08.com.example:iscsi-server, portal: 192.168.2.115,3260]
Login to [iface: default, target: iqn.2024-08.com.example:iscsi-server, portal: 192.168.2.115,3260] successful.
[root@db2 ~]#
[root@db2 ~]# iscsiadm -m node -T iqn.2024-08.com.example:iscsi-server -p 192.168.2.125 -l
Logging in to [iface: default, target: iqn.2024-08.com.example:iscsi-server, portal: 192.168.2.125,3260]
Login to [iface: default, target: iqn.2024-08.com.example:iscsi-server, portal: 192.168.2.125,3260] successful.
3.5 查看磁盘信息
Disk /dev/sdd: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes
Disk /dev/sde: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes
本质上两个存储设备为同一个,但被识别成了两块磁盘
[root@db2 ~]# /usr/lib/udev/scsi_id --whitelisted --device=/dev/sdd
360014059ca320028d97460499522865b
[root@db2 ~]# /usr/lib/udev/scsi_id --whitelisted --device=/dev/sde
360014059ca320028d97460499522865b
四、配置多路径
安装在上篇已经介绍过,这里不再赘述。
4.1 多路径配置文件
[root@db2 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths yes
}
blacklist {
}
multipaths {
multipath {
wwid 360014059ca320028d97460499522865b
alias mpsda
}
4.2 重启生效
[root@db2 ~]# multipath -r
[root@db2 ~]# multipath -ll
mpsda (360014059ca320028d97460499522865b) dm-4 LIO-ORG,dream:storage1
size=2.0G features='0' hwhandler='1 alua' wp=rw
|-+- policy='service-time 0' prio=50 status=active
| `- 33:0:0:0 sdd 8:48 active ready running
`-+- policy='service-time 0' prio=50 status=enabled
`- 34:0:0:0 sde 8:64 active ready running
结语
通过实施多路径和双链路策略,企业数据中心可以构建高可用性FC存储网络,确保数据的连续访问和高性能传输,从而支撑关键业务的连续运行。随着技术的不断发展,多路径和双链路策略将继续在存储网络中发挥重要作用,助力企业构建更加强健、灵活的IT基础设施。