FC-NVMe 主機的多重路徑配置

遵循 FC-NVMe 多路徑配置建議,以順利將 Linux 主機連接至系統。

可以將主機配置為使用傳統「裝置對映器」或「原生 NVMe 多重路徑」。若為 SCSI 裝置,主機會在任何情況下繼續使用「裝置對映器」。「原生 NVMe 多重路徑」只在 SLES12SP4 和 SLES15 上受支援。Red Hat Enterprise Linux 不支援「原生 NVMe 多重路徑」。「原生 NVMe 多重路徑」支援 NVMe ANA(NVMe 等同於 SCSI ALUA),而「裝置對映器」目前不支援 ANA。在「原生 NVMe 多重路徑」中,每個名稱空間都會顯示為一個實例。

開啟或關閉原生 NVMe 多重路徑

在 SLES15 上,依預設會開啟「原生 NVMe 多重路徑」。在 SLES12SP4 上,依預設不會開啟「原生 NVMe 多重路徑」。

如果要檢查「原生 NVMe 多重路徑」是否開啟,請輸入:
# systool -m nvme_core -A multipath
Module = "nvme_core"

    multipath           = "Y"
如果 multipath = "N",且您想要開啟它,請輸入:

echo "options nvme_core multipath=Y" > /etc/modprobe.d/50-nvme_core.conf
dracut -freboot
如果您選擇使用「裝置對映器」,請輸入:
echo "options nvme_core multipath=N" > /etc/modprobe.d/50-nvme_core.confdracut -freboot

裝置對映器或原生 NVMe 多重路徑配置

有兩個架構選項可用來配置多重路徑配置檔:「裝置對映器」或「原生 NVMe 多重路徑」。

如果要配置「裝置對映器」,請完成下列步驟:
  1. 編輯 /etc/multipath.conf 檔以併入下列程式碼:
    devices {
        device {
            vendor "NVME"
            product "IBM     2145"
            path_grouping_policy "multibus"
            path_selector "round-robin 0"
            prio "const"
            path_checker "none"
            failback "immediate"
            no_path_retry "queue"
            rr_weight uniform
            rr_min_io_rq "1"
            fast_io_fail_tmo 15
            dev_loss_tmo 600
        }
    }
    defaults {
        user_friendly_names yes
        path_grouping_policy    group_by_prio
    }
  2. 執行下列指令,以驗證多重路徑常駐程式是否正在執行:
    systemctl enable multipathd.service
    systemctl start multipathd.service
    
    # ps -ef | grep -v grep | grep multipath
    root      1616     1  0 Nov21 ?        00:01:14 /sbin/multipathd -d -s
    
    為 SLES12SP4 啟用多重路徑服務之後,使用多重路徑支援來重建 initrd
    dracut --force --add multipath
  3. 執行下列指令以套用配置:
    multipath -F
    multipath
    multipath -ll
如果您使用「原生 NVMe 多重路徑」,請將下列程式碼新增至多重路徑配置檔:
blacklist {
    device {
        vendor "NVME"
        product "IBM\s+2145"
    }
}

裝置對映器效能

測試會顯示當您使用多重佇列 I/O 排程時,效能更優,如下列步驟所述。
註: 在套用這些步驟之前,請聯絡 SUSE 代表,以驗證是否支援此選項。
如需效能改進,請使用 blk-mq 套用多重佇列 I/O 排程(在 SLES 中):
  1. 編輯 /etc/default/grub 檔和下列文字:
    GRUB_CMDLINE_LINUX_DEFAULT="BOOTPTimeout=20 BootpWait=20 
    biosdevname=0 powersaved=off resume=/dev/system/swap splash=silent 
    quiet showopts crashkernel=175M,high dm_mod.use_blk_mq=y 
    scsi_mod.use_blk_mq=1 transparent_hugepage=never"
  2. 套用新的配置:
    swfc178:~ # grub2-mkconfig -o /boot/grub2/grub.cfg
    Generating grub configuration file ...
    Found theme: /boot/grub2/themes/SLE/theme.txt
    Found linux image: /boot/vmlinuz-4.12.14-25.19-default
    Found initrd image: /boot/initrd-4.12.14-25.19-default
    Found linux image: /boot/vmlinuz-4.12.14-23-default
    Found initrd image: /boot/initrd-4.12.14-23-default
    done
    
  3. 重新開機。
  4. 驗證是否在多重路徑中啟用多重佇列特性:
    mpatho (eui.880000000000000b0050760071c60044) dm-3 NVME,IBM     2145
    size=1.5G features='3 queue_if_no_path queue_mode mq' hwhandler='0' wp=rw