共計(jì) 5654 個(gè)字符,預(yù)計(jì)需要花費(fèi) 15 分鐘才能閱讀完成。
這篇文章主要介紹“Linux MultiPath 多路徑軟件如何實(shí)施”,在日常操作中,相信很多人在 Linux MultiPath 多路徑軟件如何實(shí)施問(wèn)題上存在疑惑,丸趣 TV 小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”Linux MultiPath 多路徑軟件如何實(shí)施”的疑惑有所幫助!接下來(lái),請(qǐng)跟著丸趣 TV 小編一起來(lái)學(xué)習(xí)吧!
Multipath 的工作原理
當(dāng) multipath 啟動(dòng)的時(shí)候,它通過(guò)系統(tǒng)命令 scsi_id -eg -s /block/sdX 得到 proc/partitions 里面所有塊設(shè)備的 UUID(universally unique identify),然后把所有具有同一個(gè) UUID 的塊設(shè)備組成一個(gè) Group,在 /dev/mapper 生產(chǎn)一個(gè)對(duì)應(yīng)的單獨(dú)的設(shè)備。當(dāng)設(shè)備生成后就可以使用 fdisk 或者 parted 進(jìn)行分區(qū),分區(qū)可以使用 kpartx 命令進(jìn)行注冊(cè),然后就可以是用系統(tǒng)命令進(jìn)行創(chuàng)建文件系統(tǒng)和 mount。
一般在系列安裝過(guò)程中都會(huì)同時(shí)安裝 device-mapper 軟件包,使用 linux 自帶命令 rpm 查詢一下是否已經(jīng)安裝次軟件包。使用命令 rpm –ivh 進(jìn)行安裝,安裝以下 rpm 包:
device-mapper-*
device-mapper-multipath-*
device-mapper-1*
啟動(dòng)多路徑及配置多路徑
啟動(dòng)多路徑,通過(guò) mpathconf 命令創(chuàng)建默認(rèn)模板。創(chuàng)建默認(rèn)配置,啟動(dòng)和激活 multipathd 進(jìn)程,可以使用以下命令:
mpathconf –enable –with_multipathd y
配置完成后建議重新啟動(dòng)多路徑軟件:
/etc/init.d/multipathd restart
備注:?jiǎn)?dòng)完成后會(huì)在 /etc/ 下生成 multipath.conf 文件以及在 /etc/multipath 下生成 bindings 及 wwid,其中 wwid 記錄了系統(tǒng)中所有掛載盤的盤唯一 ID,Bindings 記錄了 ID 對(duì)應(yīng)的映射盤一般綁定完后會(huì)在 /dev/mapper 下產(chǎn)生類似于 mpathx 等文件
備注 ——————————————————
如果沒(méi)有沒(méi)有生成可以按照 Deploying Oracle RAC 11g R2 Database on Red Hat EnterpriseLinux 6
的如下方式來(lái)進(jìn)行操作:
1. As the root user, install the device-mapper-multipath package using the yum package
manager.
# yum -y install device-mapper-multipath
2. Copy the multipath.conf file found within /usr/share/doc/device-mapper-multipath-0.4.9/ to /etc/
# cp /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf /etc/
3. Capture the scsi id of the local disk(s) on the system.
# scsi_id –whitelisted –replace-whitespace –-device=/dev/sda
3600508b1001030353434363646301200
4. Uncomment and modify the blacklist section within the /etc/multipath.conf file to include
the scsi id of the local disk on the system. Once complete, save the changes made to
the multipath.conf file.
blacklist {
wwid 3600508b1001030353434363646301200
devnode ^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*
devnode ^hd[a-z]
}
5. Start the multipath daemon.
# service multipathd start
Starting multipathd daemon: [OK]
6. Enable the multipath daemon to ensure it is started upon boot time.
# chkconfig multipathd on
7. Identify the dm- device, size, and WWID of each device mapper volume for Oracle
OCR and voting disks, data disks and recovery disks. In this example, volume mpathb
is identified via the following command:
# multipath -ll
Figure Multipath Device (mpathb)
8. Uncomment the defaults section found within the /etc/multipath.conf file.
defaults {
udev_dir /dev
polling_interval 10
path_selector round-robin 0
path_grouping_policy multibus
getuid_callout /lib/udev/scsi_id –whitelisted –device=/dev/%n
prio alua
path_checker readsector0
rr_min_io 100
max_fds 8192
rr_weight priorities
failback immediate
no_path_retry fail
user_friendly_names yes
}
NOTE: The standard options can be customized to better fit your storage array s
capabilities. Check with your storage vendor for details.
9. Un-comment the multipath section found within the /etc/multipath.conf file and create an alias for each device mapper volume in order to enable persistent naming of those volumes. Once complete, save the changes made to the multipath.conf file. The output should resemble the example below. For reference, refer the Oracle data volumes created for the reference environment as displayed in Table 2.4.3: Oracle OCR,Voting Disk, Data File Sizes.
/etc/multipath.conf
multipaths {
multipath {
wwid 3600c0ff000d7e7a854a0f65101000000
alias db1
}
multipath {
wwid 3600c0ff000dabfe562a0f65101000000
alias db2
}
multipath {
wwid 3600c0ff000d7e7a874a0f65101000000
alias fra
}
multipath {
wwid 3600c0ff000dabfe585a0f65101000000
alias redo
}
multipath {
wwid 3600c0ff000dabfe596a0f65101000000
alias ocrvote1
}
multipath {
wwid 3600c0ff000dabfe5a2a0f65101000000
alias ocrvote2
}
multipath {
wwid 3600c0ff000dabfe5b4a0f65101000000
alias ocrvote3
}
}
10.Restart the device mapper multipath daemon.
# service multipathd restart
ok
Stopping multipathd daemon: [OK]
Starting multipathd daemon: [OK]
11.Verify the device mapper paths and aliases are displayed properly. Below is an example of one device mapper device labeled fra.
# multipath -ll
fra (3600c0ff000d7e7a89e85ac5101000000) dm-10 HP,MSA2324fc
size=186G features= 1 queue_if_no_path hwhandler= 0 wp=rw
|-+- policy= round-robin 0 prio=130 status=active
| |- 3:0:0:3 sdd 8:48 active ready running
| |- 3:0:1:3 sdh 8:112 active ready running
| |- 4:0:0:3 sdt 65:48 active ready running
| `- 4:0:1:3 sdx 65:112 active ready running
`-+- policy= round-robin 0 prio=10 status=enabled
|- 3:0:2:3 sdl 8:176 active ready running
|- 3:0:3:3 sdp 8:240 active ready running
|- 4:0:2:3 sdab 65:176 active ready running
`- 4:0:3:3 sdaf 65:240 active ready running
———————————————————————————————-
配置文件
默認(rèn)情況下,DM-Multipath 為大多數(shù)多路徑的使用提供配置值。另外,DM-Multipath 支持大多數(shù)常見(jiàn)的、支持 DM-Multipath 的存儲(chǔ)陣列。默認(rèn)配置值和支持的設(shè)備請(qǐng)參考 /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults 件。可以編輯 /etc/multipath.conf 覆蓋 DM-Multipath 的默認(rèn)配置。如果有必要,您還可以默認(rèn)配置文件不支持的存儲(chǔ)陣列。
多路徑配置文件可分為以下幾個(gè)部分:
blacklist
不被視為多路徑的具體設(shè)備列表。
blacklist_exceptions
根據(jù) blacklist 部分中的參數(shù)列出不在黑名單中的多路徑設(shè)備。
defaults
DM-Multipath 的常規(guī)默認(rèn)設(shè)置。
multipaths
各個(gè)獨(dú)立多路徑設(shè)備的特性設(shè)置。這些數(shù)值覆蓋了在配置文件的 defaults 和 devices 部分中指定的數(shù)值。
devices
各個(gè)存儲(chǔ)控制器的設(shè)置。這些數(shù)值覆蓋了在配置文件的 defaults 部分指定的數(shù)值。如果您要使用不是默認(rèn)支持的存儲(chǔ)陣列,您可能需要為您的陣列創(chuàng)建 devices 子部分。
當(dāng)系統(tǒng)決定多路徑設(shè)備的屬性時(shí),首先它會(huì)檢查多路徑設(shè)置,然后是每個(gè)設(shè)備的設(shè)置,然后才是多路徑系統(tǒng)默認(rèn)設(shè)置。
以上配置完成后,啟動(dòng) multipathd 進(jìn)程,進(jìn)程啟動(dòng)后會(huì)自動(dòng) scan 設(shè)備,在 /dev/mapper 目錄下可以看到 生成的設(shè)備 如:mapth5
1. 使用命令 multipath 可以查看路徑狀態(tài)是否正常,
[root@dbserv1 mapper]# multipath -d -l
2. 使用系統(tǒng) fdisk 命令分區(qū)后,使用命令 kpartx l /dev/mapper/mpath5 查看分區(qū)信息
3. 如果未發(fā)現(xiàn)可以使用 kpartx d /dev/mapper/mpath5 命令進(jìn)行注冊(cè)分區(qū)
4. 如果下使用 ASM 磁盤管理,則下一步就是通過(guò) udev 進(jìn)行配置分區(qū)權(quán)限和別名,以便讓 Oracle 在 ASM 配置過(guò)程中能夠看到這些分區(qū)。關(guān)于 udev 的具體配置過(guò)程在下篇文章中會(huì)進(jìn)行說(shuō)明。
5. 當(dāng)然也可以使用 Oracle ASMLib 來(lái)配置 ASM 磁盤,這個(gè)相對(duì) udev 方式來(lái)時(shí)稍微麻煩,但是也有相應(yīng)的好處,即,在 ASM 里多余出來(lái)空間通過(guò)配置能夠讓 OS 文件系統(tǒng)識(shí)別到。
6. 如果不用 Rac, 在單節(jié)點(diǎn)環(huán)境,則使用 mke2fs –j /dev/mapper/mapth5p1 在相對(duì)應(yīng)的分區(qū)上創(chuàng)建文件系統(tǒng)
7. 使用 mount 的命令掛載文件系統(tǒng)就可以用。
多路徑基本維護(hù)命令
1. 啟停多路徑:
/etc/init.d/multipathd stop/start/reatart
2. 查看當(dāng)前多路徑鏈路狀態(tài)及盤情況:
multipath –ll
3. 刪除多路徑設(shè)備:
multipath –F
4. 重新掃描設(shè)備:
multipath –v3
5. 當(dāng)在 DM-Multipath 中添加新設(shè)備時(shí),這些新設(shè)備會(huì)位于 /dev 目錄的兩個(gè)不同位置:
/dev/mapper/mpathn
/dev/dm-n
/dev/mapper 中的設(shè)備是在引導(dǎo)過(guò)程中生成的。可使用這些設(shè)備訪問(wèn)多路徑設(shè)備,例如在生成邏輯卷時(shí)
所有 /dev/dm- n 格式的設(shè)備都只能是作為內(nèi)部使用,請(qǐng)不要使用它們
到此,關(guān)于“Linux MultiPath 多路徑軟件如何實(shí)施”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注丸趣 TV 網(wǎng)站,丸趣 TV 小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!