前言
在企業(yè)級(jí)數(shù)據(jù)中心中锨推,F(xiàn)ibre Channel (FC) 技術(shù)因其高速度、低延遲和高可靠性而廣泛應(yīng)用于存儲(chǔ)網(wǎng)絡(luò)煌张。然而早歇,單一的FC鏈路存在單點(diǎn)故障風(fēng)險(xiǎn)焰檩,一旦鏈路或相關(guān)硬件出現(xiàn)故障憔涉,可能導(dǎo)致數(shù)據(jù)訪問中斷,影響業(yè)務(wù)連續(xù)性析苫。
為了解決這一問題兜叨,多路徑和雙鏈路策略成為構(gòu)建高可用性FC存儲(chǔ)網(wǎng)絡(luò)的關(guān)鍵技術(shù)穿扳,本文將模擬FC雙鏈路存儲(chǔ)網(wǎng)絡(luò)。
一国旷、環(huán)境配置
操作系統(tǒng)主機(jī)名IP地址
rhel8iscsi-server192.168.2.115
192.168.2.125
rhel8iscsi-client192.168.2.116
1.1 iscsi-server
網(wǎng)絡(luò)配置
[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
存儲(chǔ)配置
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作為存儲(chǔ)設(shè)備對(duì)外提供服務(wù)
1.2 iscsi-client網(wǎng)絡(luò)配置
[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
由于我們沒有存儲(chǔ)設(shè)備,所以選擇使用ISCSI塊存儲(chǔ)服務(wù)來模擬存儲(chǔ)設(shè)備跪但,通過在iscsi-server主機(jī)上綁定兩個(gè)ip地址履羞,來模擬存儲(chǔ)設(shè)備到主機(jī)client的雙鏈路。
2.1 關(guān)閉防火墻和selinux
--關(guān)閉防火墻
systemctl stop firewalld
systemctl disabled firewalld
--編輯/etc/selinux/config?
設(shè)置SELINUX=disabled
reboot
2.2 安裝ISCSI塊存儲(chǔ)服務(wù)
[root@db1 ]# yum install -y targetcli
2.3 配置ISCSI塊存儲(chǔ)服務(wù)
[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 啟動(dòng)服務(wù)
[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認(rèn)證
[root@db2 ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2024-08.com.example:iscsi-server
3.3 發(fā)現(xiàn)服務(wù)端ISCSI設(shè)備
[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 登陸設(shè)備
[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
本質(zhì)上兩個(gè)存儲(chǔ)設(shè)備為同一個(gè)忆首,但被識(shí)別成了兩塊磁盤
[root@db2 ~]# /usr/lib/udev/scsi_id --whitelisted --device=/dev/sdd
360014059ca320028d97460499522865b
[root@db2 ~]# /usr/lib/udev/scsi_id --whitelisted --device=/dev/sde
360014059ca320028d97460499522865b
四、配置多路徑
安裝在上篇已經(jīng)介紹過被环,這里不再贅述糙及。
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
結(jié)語
通過實(shí)施多路徑和雙鏈路策略,企業(yè)數(shù)據(jù)中心可以構(gòu)建高可用性FC存儲(chǔ)網(wǎng)絡(luò)筛欢,確保數(shù)據(jù)的連續(xù)訪問和高性能傳輸浸锨,從而支撐關(guān)鍵業(yè)務(wù)的連續(xù)運(yùn)行。隨著技術(shù)的不斷發(fā)展版姑,多路徑和雙鏈路策略將繼續(xù)在存儲(chǔ)網(wǎng)絡(luò)中發(fā)揮重要作用揣钦,助力企業(yè)構(gòu)建更加強(qiáng)健、靈活的IT基礎(chǔ)設(shè)施漠酿。