zoukankan      html  css  js  c++  java
  • 转://Linux MultiPath多路径软件实施说明

    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

    本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-04/1

    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格式的设备都只能是作为内部使用,请不要使用它们

  • 相关阅读:
    【转】Elasticsearch 聚合数据结果不精确,怎么破?
    C# ling to sql group by分组查询
    c# JArray将返回json字符串集合 转为集合
    .netcore 获取请求客户端IP
    IP转long与string相互转化方法
    C# 操作datatable校验重复行,并显示行号
    springboot 以多模块形式集成Dubbo部署RPC服务
    windows 下搭建dubbo环境搭建
    spring 创建多模块项目,找不到jar包
    使用ZKUI Web页面管理zookeeper
  • 原文地址:https://www.cnblogs.com/zfox2017/p/6929905.html
Copyright © 2011-2022 走看看