歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux MultiPath多路徑軟件實施說明

Linux MultiPath多路徑軟件實施說明

日期:2017/2/28 14:02:24   编辑:Linux教程

Multipath的工作原理

當multipath啟動的時候,它通過系統命令scsi_id -eg -s /block/sdX得到proc/partitions 裡面所有塊設備的 UUID(universally unique identify),然後把所有具有同一個UUID的塊設備組成一個Group,在/dev/mapper 生產一個對應的單獨的設備。當設備生成後就可以使用fdisk或者parted進行分區,分區可以使用kpartx命令進行注冊,然後就可以是用系統命令進行創建文件系統和mount 。

一般在系列安裝過程中都會同時安裝device-mapper軟件包,使用linux自帶命令rpm查詢一下是否已經安裝次軟件包。使用命令 rpm –ivh 進行安裝,安裝以下rpm包:

device-mapper-*

device-mapper-multipath-*

device-mapper-1*

啟動多路徑及配置多路徑

啟動多路徑,通過mpathconf命令創建默認模板。創建默認配置,啟動和激活multipathd進程,可以使用以下命令:

mpathconf --enable --with_multipathd y

配置完成後建議重新啟動多路徑軟件:

/etc/init.d/multipathd restart

備注:啟動完成後會在/etc/下生成multipath.conf 文件以及在/etc/multipath下生成bindings 及wwid,其中wwid記錄了系統中所有掛載盤的盤唯一ID,Bindings記錄了ID對應的映射盤一般綁定完後會在/dev/mapper下產生類似於mpathx等文件

備注------------------------------------------------------

如果沒有沒有生成可以按照Deploying Oracle RAC 11g R2 Database on Red Hat EnterpriseLinux 6

的如下方式來進行操作:

1. As the root user, install the device-mapper-multipath package using the yum package

manager.

# yum 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

----------------------------------------------------------------------------------------------

配置文件

默認情況下,DM-Multipath 為大多數多路徑的使用提供配置值。另外,DM-Multipath 支持大多數常見的、支持 DM-Multipath 的存儲陣列。默認配置值和支持的設備請參考 /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults 文件。

您可以編輯 /etc/multipath.conf 覆蓋 DM-Multipath 的默認配置。如果有必要,您還可以默認配置文件不支持的存儲陣列。

多路徑配置文件可分為以下幾個部分:

blacklist

不被視為多路徑的具體設備列表。

blacklist_exceptions

根據 blacklist 部分中的參數列出不在黑名單中的多路徑設備。

defaults

DM-Multipath 的常規默認設置。

multipaths

各個獨立多路徑設備的特性設置。這些數值覆蓋了在配置文件的 defaults 和 devices 部分中指定的數值。

devices

各個存儲控制器的設置。這些數值覆蓋了在配置文件的 defaults 部分指定的數值。如果您要使用不是默認支持的存儲陣列,您可能需要為您的陣列創建 devices 子部分。

當系統決定多路徑設備的屬性時,首先它會檢查多路徑設置,然後是每個設備的設置,然後才是多路徑系統默認設置。

以上配置完成後,啟動multipathd 進程,進程啟動後會自動scan設備,在/dev/mapper目錄下可以看到 生成的設備 如:mapth4
1. 使用命令multipath 可以查看路徑狀態是否正常,

[root@dbserv1 mapper]# multipath -d -l


2. 使用系統fdisk 命令分區後,使用命令 kpartx l /dev/mapper/mpath4查看分區信息


3. 如果未發現可以使用kpartx d /dev/mapper/mpath4命令進行注冊分區
4. 如果下使用ASM磁盤管理,則下一步就是通過udev進行配置分區權限和別名,以便讓Oracle在ASM配置過程中能夠看到這些分區。關於udev的具體配置過程在下篇文章中會進行說明。
5. 當然也可以使用Oracle ASMLib來配置ASM磁盤,這個相對udev方式來時稍微麻煩,但是也有相應的好處,即,在ASM裡多余出來空間通過配置能夠讓OS文件系統識別到。


6. 如果不用Rac,在單節點環境,則使用mke2fs –j /dev/mapper/mapth4p1 在相對應的分區上創建文件系統
7. 使用mount的命令掛載文件系統就可以用。

多路徑基本維護命令

1.啟停多路徑:

/etc/init.d/multipathd stop/start/reatart

2.查看當前多路徑鏈路狀態及盤情況:

multipath –ll

3.刪除多路徑設備:

multipath –F

4.重新掃描設備:

multipath –v3

5. 當在 DM-Multipath中添加新設備時,這些新設備會位於 /dev目錄的兩個不同位置:

/dev/mapper/mpathn

/dev/dm-n

/dev/mapper中的設備是在引導過程中生成的。可使用這些設備訪問多路徑設備,例如在生成邏輯卷時

所有 /dev/dm-n格式的設備都只能是作為內部使用,請不要使用它們

Copyright © Linux教程網 All Rights Reserved