RHEL8 多路徑配置詳解(二)

前言

在企業(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è)施漠酿。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市谎亩,隨后出現(xiàn)的幾起案子炒嘲,更是在濱河造成了極大的恐慌,老刑警劉巖匈庭,帶你破解...
    沈念sama閱讀 218,525評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件夫凸,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡阱持,警方通過查閱死者的電腦和手機(jī)夭拌,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,203評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來衷咽,“玉大人鸽扁,你說我怎么就攤上這事∠馄” “怎么了桶现?”我有些...
    開封第一講書人閱讀 164,862評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)鼎姊。 經(jīng)常有香客問我骡和,道長(zhǎng)相赁,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,728評(píng)論 1 294
  • 正文 為了忘掉前任慰于,我火速辦了婚禮钮科,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘婆赠。我一直安慰自己绵脯,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,743評(píng)論 6 392
  • 文/花漫 我一把揭開白布页藻。 她就那樣靜靜地躺著桨嫁,像睡著了一般。 火紅的嫁衣襯著肌膚如雪份帐。 梳的紋絲不亂的頭發(fā)上璃吧,一...
    開封第一講書人閱讀 51,590評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音废境,去河邊找鬼畜挨。 笑死,一個(gè)胖子當(dāng)著我的面吹牛噩凹,可吹牛的內(nèi)容都是我干的巴元。 我是一名探鬼主播,決...
    沈念sama閱讀 40,330評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼驮宴,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼逮刨!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起堵泽,我...
    開封第一講書人閱讀 39,244評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤修己,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后迎罗,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體睬愤,經(jīng)...
    沈念sama閱讀 45,693評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,885評(píng)論 3 336
  • 正文 我和宋清朗相戀三年纹安,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了尤辱。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,001評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡厢岂,死狀恐怖光督,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情塔粒,我是刑警寧澤可帽,帶...
    沈念sama閱讀 35,723評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站窗怒,受9級(jí)特大地震影響映跟,放射性物質(zhì)發(fā)生泄漏蓄拣。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,343評(píng)論 3 330
  • 文/蒙蒙 一努隙、第九天 我趴在偏房一處隱蔽的房頂上張望球恤。 院中可真熱鬧,春花似錦荸镊、人聲如沸咽斧。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,919評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)张惹。三九已至,卻和暖如春岭洲,著一層夾襖步出監(jiān)牢的瞬間宛逗,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,042評(píng)論 1 270
  • 我被黑心中介騙來泰國(guó)打工盾剩, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留雷激,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,191評(píng)論 3 370
  • 正文 我出身青樓告私,卻偏偏與公主長(zhǎng)得像屎暇,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子驻粟,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,955評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容