多路径配置

http://blog.itpub.net/31397003/viewspace-2143390/

  1. 挂盘/配置好yum源
    2.程序包的安装
    device-mapper-1.02.95-2.el6.x86_64.rpm
    device-mapper-event-1.02.95-2.el6.x86_64.rpm
    device-mapper-event-libs-1.02.95-2.el6.x86_64.rpm
    device-mapper-libs-1.02.95-2.el6.x86_64.rpm
    device-mapper-multipath-0.4.9-87.el6.x86_64.rpm
    device-mapper-multipath-libs-0.4.9-87.el6.x86_64.rpm
    device-mapper-persistent-data-0.3.2-1.el6.x86_64.rpm
    yum install -y device-mapper*
    3.启动multipath,并修改为自启动。
    /etc/init.d/multipathd
    start,执行这个命令,启动multipath。
    chkconfig
    --level 345 multipathd on,执行这个命令修为自启动。
    4.配置/etc/multipath.conf文件。
    该文件的模板,我们可以在/usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf这里找到,然后把这个文件复制到/etc目录下,可以执行如下命令,
    cp  /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf
     /etc/multipath.conf
    然后编辑/etc/mulitpath.conf文件,进行如下的修改:
    [root@dbrac1 etc]# vi multipath.conf 
    # This
    is a basic configuration file with some examples, for device mapper
    #
    multipath.
    # For a
    complete list of the default configuration values, see
    #
    /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults
    # For a
    list of configuration options with descriptions, see
    #
    /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.annotated
    #
    #
    REMEMBER: After updating multipath.conf, you must run
    #
    #
    service multipathd reload
    #
    # for
    the changes to take effect in multipathd

    ## By
    default, devices with vendor = "IBM" and product =
    "S/390.*" are
    ##
    blacklisted. To enable mulitpathing on these devies, uncomment the
    ##
    following lines.
    #blacklist_exceptions
    {
    #      
    device {
    #              
    vendor  "IBM"
    #              
    product "S/390.*"
    #      
    }
    #}

    ## Use
    user friendly names, instead of using WWIDs as names.
    #defaults {
    #      
    user_friendly_names yes
    #}
    ##
    ## Here
    is an example of how to configure some standard options.
    ##
    #
    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
    }
    ##
    ## The
    wwid line in the following blacklist section is shown as an example
    ## of
    how to blacklist devices by wwid.  The 2 devnode lines are the
    ##
    compiled in default blacklist. If you want to blacklist entire types
    ## of
    devices, such as all scsi devices, you should use a devnode line.
    ##
    However, if you want to blacklist specific devices, you should use
    ## a
    wwid line.  Since there is no guarantee that a specific device will
    ## not
    change names on reboot (from /dev/sda to /dev/sdb for example)
    ##
    devnode lines are not recommended for blacklisting specific devices.
    ##
    blacklist {
           wwid
    26353900f02796769
           
    devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
           
    devnode "^hd[a-z]"
    }
    #multipaths
    {
    #      
    multipath {
    #              
    wwid                   
    3600508b4000156d700012000000b0000
    #              
    alias                  
    yellow
    #              
    path_grouping_policy    multibus
    #              
    path_checker           
    readsector0
    #              
    path_selector          
    "round-robin 0"
    #              
    failback               
    manual
    #              
    rr_weight              
    priorities
    #              
    no_path_retry           5
    #      
    }
    #      
    multipath {
    #              
    wwid                   
    1DEC_____321816758474
    #              
    alias                  
    red
    #      
    }
    #}
    #devices
    {
    #      
    device {
    #              
    vendor                 
    "COMPAQ  "
    #              
    product                
    "HSV110 (C)COMPAQ"
    #              
    path_grouping_policy    multibus
    #              
    getuid_callout         
    "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
    #              
    path_checker           
    readsector0
    #              
    path_selector          
    "round-robin 0"
    #              
    hardware_handler        "0"
    #              
    failback               
    15
    #              
    rr_weight              
    priorities
    #              
    no_path_retry           queue
    #      
    }
    #      
    device {
    #              
    vendor                 
    "COMPAQ  "
    #              
    product                
    "MSA1000         "
    #              
    path_grouping_policy    multibus
    #      
    }
    #}
    "multipath.conf"
    96L, 2722C written

    其中,blacklist用来添加设备的黑名单,也就是说,设置某些设备,不让它多路径化。比如,我们可以把某些设备的wwid加入在这里

    5.执行如下命令
    modprobe dm-multipath   
    multipath
    -F            
    multipath dm-multipath
     
    multipath dm-round-robin
    /etc/init.d/multipathd
    restart

    执行完成上述命令之后,会在/etc/multipath目录下生成一个bindings这的一个文件,如下:
    [root@dbrac1 etc]#
    modprobe dm-multipath   
    WARNING:
    Deprecated config file /etc/modprobe.conf, all config files belong into
    /etc/modprobe.d/.
    [root@dbrac1
    etc]# multipath -F          
     
    [root@dbrac1
    etc]# multipath dm-multipath  
    Aug 10
    22:39:40 | sda: alua not supported
    Aug 10
    22:39:40 | sdb: alua not supported
    Aug 10
    22:39:40 | sdc: alua not supported
    Aug 10
    22:39:40 | sdd: alua not supported
    Aug 10
    22:39:40 | sde: alua not supported
    Aug 10
    22:39:40 | sdf: alua not supported
    Aug 10
    22:39:40 | sdg: alua not supported
    Aug 10
    22:39:40 | sdh: alua not supported
    [root@dbrac1
    etc]# 
    [root@dbrac1
    etc]# multipath dm-round-robin
    Aug 10
    22:39:49 | sda: alua not supported
    Aug 10
    22:39:49 | sdb: alua not supported
    Aug 10
    22:39:49 | sdc: alua not supported
    Aug 10
    22:39:49 | sdd: alua not supported
    Aug 10
    22:39:49 | sde: alua not supported
    Aug 10
    22:39:49 | sdf: alua not supported
    Aug 10
    22:39:49 | sdg: alua not supported
    Aug 10
    22:39:49 | sdh: alua not supported
    [root@dbrac1
    etc]# /etc/init.d/multipathd restart
    ok
    Stopping
    multipathd daemon: [  OK  ]
    Starting
    multipathd daemon: [  OK  ]
    [root@dbrac1
    etc]# 
    [root@dbrac1 etc]# cd /etc/multipath
    [root@dbrac1 multipath]# ls
    bindings
    [root@dbrac1 multipath]# cat bindings 
    #
    Multipath bindings, Version : 1.0
    # NOTE:
    this file is automatically maintained by the multipath program.
    # You
    should not need to edit this file in normal circumstances.
    #
    #
    Format:
    # alias
    wwid
    #
    mpatha
    1ATA     VBOX
    HARDDISK                          
    VBebc3bf35-371818d2 
    mpathb
    1ATA     VBOX
    HARDDISK                          
    VB403dd68a-b8a5a8be 
    mpathc
    1ATA     VBOX
    HARDDISK                          
    VBcb1b0d8b-1ee73ac2 
    mpathd
    1ATA     VBOX
    HARDDISK                          
    VB5eb6b908-65677cda 
    mpathe
    1ATA     VBOX
    HARDDISK                          
    VBb020940b-4a482e15 
    mpathf
    1ATA     VBOX
    HARDDISK                          
    VBd60d065d-37d1710d 
    mpathg
    1ATA     VBOX
    HARDDISK                          
    VBf71eae83-8c806c3b 
    mpathh
    1ATA     VBOX
    HARDDISK                          
    VBd46e23c6-7ece6a6e 
    [root@dbrac1
    multipath]#  
    这里存放的是多路径的磁盘名称和对应的ID。这时,我们可以使用fdisk -l这个命令查看到这些设备,比如/dev/mapper/mpatha。

    6.再次修改 vi
    /etc/multipath.conf   文件,对应ID对应设备的别名。
    由于上述的设备名称的可读性不是很好,所以我们要加入方便我们快速读的名称。修改/etc/multipath.conf文件,内容如下:

    multipaths {
           
    multipath {
                   
    wwid                   
    VB403dd68a-b8a5a8be 
                   
    alias                  
    ocrvotedisk1
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBcb1b0d8b-1ee73ac2
                   
    alias                  
    ocrvotedisk2
                   
    path_grouping_policy    multibus
            }
           
    multipath {
                   
    wwid                   
    VB5eb6b908-65677cda
                   
    alias                  
    ocrvotedisk3
                   
    path_grouping_policy    multibus
            }
           
    multipath {
                   
    wwid                   
    VBb020940b-4a482e15
                   
    alias                  
    fra1
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBd60d065d-37d1710d
                   
    alias                  
    fra2
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBf71eae83-8c806c3b
                   
    alias                  
    data1
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBd46e23c6-7ece6a6e
                   
    alias                  
    data2
                   
    path_grouping_policy    multibus
            }
    }

    [root@dbrac1
    multipath]# cat  /etc/multipath.conf
    # This
    is a basic configuration file with some examples, for device mapper
    #
    multipath.
    # For a
    complete list of the default configuration values, see
    #
    /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.defaults
    # For a
    list of configuration options with descriptions, see
    #
    /usr/share/doc/device-mapper-multipath-0.4.9/multipath.conf.annotated
    #
    #
    REMEMBER: After updating multipath.conf, you must run
    #
    #
    service multipathd reload
    #
    # for
    the changes to take effect in multipathd

    ## By
    default, devices with vendor = "IBM" and product =
    "S/390.*" are
    ##
    blacklisted. To enable mulitpathing on these devies, uncomment the
    ##
    following lines.
    #blacklist_exceptions
    {
    #      
    device {
    #              
    vendor  "IBM"
    #              
    product "S/390.*"
    #      
    }
    #}

    ## Use
    user friendly names, instead of using WWIDs as names.
    #defaults
    {
    #      
    user_friendly_names yes
    #}
    ##
    ## Here
    is an example of how to configure some standard options.
    ##
    #
    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
    }
    ##
    ## The
    wwid line in the following blacklist section is shown as an example
    ## of
    how to blacklist devices by wwid.  The 2 devnode lines are the
    ##
    compiled in default blacklist. If you want to blacklist entire types
    ## of
    devices, such as all scsi devices, you should use a devnode line.
    ##
    However, if you want to blacklist specific devices, you should use
    ## a
    wwid line.  Since there is no guarantee that a specific device will
    ## not
    change names on reboot (from /dev/sda to /dev/sdb for example)
    ##
    devnode lines are not recommended for blacklisting specific devices.
    ##
    blacklist {
           wwid
    26353900f02796769
           
    devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
           
    devnode "^hd[a-z]"
    }

    multipaths {
           
    multipath {
                   
    wwid                   
    VB403dd68a-b8a5a8be 
                   
    alias                  
    ocrvotedisk1
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBcb1b0d8b-1ee73ac2
                   
    alias                  
    ocrvotedisk2
                   
    path_grouping_policy    multibus
            }
           
    multipath {
                   
    wwid                   
    VB5eb6b908-65677cda
                   
    alias                  
    ocrvotedisk3
                   
    path_grouping_policy    multibus
            }
           
    multipath {
                   
    wwid                   
    VBb020940b-4a482e15
                   
    alias                  
    fra1
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBd60d065d-37d1710d
                   
    alias                  
    fra2
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBf71eae83-8c806c3b
                   
    alias                  
    data1
                   
    path_grouping_policy    multibus
            }
            
    multipath {
                   
    wwid                   
    VBd46e23c6-7ece6a6e
                   
    alias                  
    data2
                   
    path_grouping_policy    multibus
            }

    #multipaths
    {
    #      
    multipath {
    #              
    wwid                   
    3600508b4000156d700012000000b0000
    #              
    alias                  
    yellow
    #              
    path_grouping_policy    multibus
    #              
    path_checker           
    readsector0
    #              
    path_selector          
    "round-robin 0"
    #              
    failback               
    manual
    #              
    rr_weight              
    priorities
    #              
    no_path_retry           5
    #      
    }
    #      
    multipath {
    #              
    wwid                   
    1DEC_____321816758474
    #              
    alias                  
    red
    #      
    }
    #}
    #devices
    {
    #      
    device {
    #              
    vendor                 
    "COMPAQ  "
    #              
    product                
    "HSV110 (C)COMPAQ"
    #              
    path_grouping_policy    multibus
    #              
    getuid_callout         
    "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
    #              
    path_checker           
    readsector0
    #              
    path_selector          
    "round-robin 0"
    #              
    hardware_handler        "0"
    #              
    failback               
    15
    #              
    rr_weight              
    priorities
    #              
    no_path_retry           queue
    #      
    }
    #      
    device {
    #              
    vendor                 
    "COMPAQ  "
    #              
    product                
    "MSA1000         "
    #              
    path_grouping_policy    multibus
    #      
    }
    #}
    [root@dbrac1
    multipath]# 
    修改完成以后,重启机器即可(注意,在FC存储环境下不需要重新启动机器,直接执行service multipathd reload命令即可)。

    7.重启完成以后查看对应的设备。
    重启完成以后,使用fdisk -l命令再次查看,会看到如下的形式的设备。
    fdisk
    -l

    8.完成多路径的配置以后,我们还不能直接安装grid,因为多路径对应的设备的权限需要更改。这个时候,我们还需要借助udev来完成
    下面,我们来修改多路径的权限,对于多路径操作的有两个位置,/dev/mapper目录对应的文件与/dev/dm-*开头对应的文件。我们只需要修改/dev/dm-*应对的权限就可以了.

    第一种方法:我们需要用root修改  disk为grid asmadmin。直接修改,grid还是无法识别,所以,可以通过udev来完成。
    在/etc/udev/rules.d目录下,加入如下的文件与内容,
    [root@dbrac1 rules.d]# cat 99-asm.rules
    KERNEL=="dm-[0-6]",
    OWNER="grid", GROUP="asmadmin", MODE="0660"
    [root@dbrac1 rules.d]#

    第二种方法:编辑另外一个udev的配置文件,为12-.rules这样的一个udev的配置文件,比如文件名为12-mulitpath-privs.rules,其内容如下:
    [root@dbrac1 rules.d]# vi /etc/udev/rules.d/12-mulitpath-privs.rules
    ENV{DM_NAME}=="ocr*",
    OWNER:="grid", GROUP:="asmadmin", MODE:="660"
    ENV{DM_NAME}=="fra*",
    OWNER:="grid", GROUP:="asmadmin", MODE:="660"
    ENV{DM_NAME}=="data*",
    OWNER:="grid", GROUP:="asmadmin", MODE:="660"

    第三种方法:以上是使用name来进行的,也可以使用uuid,比如如下:
    [root@dbrac1 rules.d]# cat 12-mulitpath-privs.rules
    ENV{DM_UUID}=="mpath-?*", OWNER:="grid",
    GROUP:="asmadmin", MODE:="660"
    ................................
    [root@dbrac1 rules.d]#

    每个磁盘的uuid可以在/dev/disk/by-id目录下找到,用ls -l命令就可以详细看到。
    该udev的配置文件,可以在/usr/share/doc/device-mapper-/12-dm-permissions.rules中找到,这里有详细的模板。
    推荐使用第二种方法来修改多路径设备的权限。

    至此多路径配置完成了!

    ----------补充------------------------
    #查看是否安装了multipath
    rpm -qa
    | grep device-mapper

    #查看本地存储wwid
    /lib/udev/scsi_id
    --whitelisted --device=/dev/sda
    36141877030bcca001d9c4d52106b9d90

    #查看存储参数
    cat
    /sys/block/sdb/device/vendor 
    3PARdata

    cat
    /sys/block/sdb/device/model
    VV

    #清空已有的multipath记录
    multipath
    -F
    #打印诊断信息
    multipath
    -v3
    #启用多路径守护程序以在引导时启动
    mpathconf
    --enable
    #启动多路径服务
    service multipathd start
    #如果在启动 multipath 守护程序后更改多路径配置文件,请运行以下命令以使更改生效。
    service multipathd reload 
    systemctl reload multipath

#重启系统测试
init 6

#查看多路径当前状态

multipath -ll

ls -l /dev/dm-*

cd /dev/mapper

ll

RAC_多路径配置的更多相关文章

  1. java 错误 classes路径配置错误

    1. 错误显示页 2. 解决步骤 2.1. 查看 root cause 信息 org.springframework.beans.factory.BeanCreationException: Erro ...

  2. Spring扫面路径配置不全导致异常 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): 的原因

    运行Junit测试类 package cn.bgodata.x.zero.service; import org.junit.Test; import org.junit.runner.RunWith ...

  3. webpack插件配置(一) webpack-dev-server 路径配置

    本文的路径配置主要涉及到webpack.config.js文件中devServer与output两个选项的配置 webpack-dev-server定义 webpack-dev-server主要是启动 ...

  4. nodejs安装及npm模块插件安装路径配置

    在学习完js后,我们就要进入nodejs的学习,因此就必须配置nodejs和npm的属性了. 我相信,个别人在安装时会遇到这样那样的问题,看着同学都已装好,难免会焦虑起来.于是就开始上网查找解决方案, ...

  5. Java虚拟机性能管理神器 - VisualVM(3) 插件安装与更新路径配置

    Java虚拟机性能管理神器 - VisualVM(3)  插件安装与更新路径配置 插件路径地址配置方法: VisualVM打开后,会发现功能比较单一,只有概述.监视.线程.抽样器.Profiler五个 ...

  6. vue-cli 3.0之跨域请求代理配置及axios路径配置

    vue-cli 3.0之跨域请求代理配置及axios路径配置 问题:在前后端分离的跨域请求中,报跨域问题 配置: vue.config.js: module.exports = { runtimeCo ...

  7. jmeter安装部署、maven路径配置

    jmeter下载地址: https://jmeter.apache.org/download_jmeter.cgi 解压文件 配置jmeter环境变量 (1)设置jmeter解压目录的JMETER_H ...

  8. JD路径配置及myeclipse主题和提示设置

    1. JDKAN安装及环境变量配置 安装jdk,注意记住安装路径(F:\Java\jdk1.8.0_121 )(个人爱好) 系统变量→新建 JAVA_HOME 变量 . 变量值填写jdk的安装目录(F ...

  9. weblogic虚拟路径配置

    首发地址 https://blog.leapmie.com/archives/344/ 前言 weblogic的虚拟路径配置有两种: 一种是在项目下配置,即在weblogic.xml中配置,该方法配置 ...

随机推荐

  1. 用python爬虫简单爬取 笔趣网:类“起点网”的小说

    首先:文章用到的解析库介绍 BeautifulSoup: Beautiful Soup提供一些简单的.python式的函数用来处理导航.搜索.修改分析树等功能. 它是一个工具箱,通过解析文档为用户提供 ...

  2. HttpRunner学习1--Windows&Linux安装httprunner

    最近在学习HttpRunner,这是一款开源的接口测试框架,可用于HTTP(S)协议的接口测试.通过该框架,我们只需维护一份 YAML/JSON 脚本,即可轻松的进行接口自动化. 更多的介绍,大家可以 ...

  3. 一起学SpringMVC之文件上传

    概述 在Web系统开发过程中,文件上传是普遍的功能,本文主要以一个简单的小例子,讲解SpringMVC中文件上传的使用方法,仅供学习分享使用,如有不足之处,还请指正. 文件上传依赖包 如下所示,文件上 ...

  4. MFC程序出现uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)解决办法

    在同一个地方摔倒两次之后,决定记录下来这个东西. 问题 1>uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl opera ...

  5. javascript中常见的几种循环遍历

    项目开发中,不管是建立在哪个框架基础上,对数据的处理都是必须的,而处理数据离不开各种遍历循环.javascript中循环遍历有很多种方式,记录下几种常见的js循环遍历. 一.for循环 for循环应该 ...

  6. Android开发之OkHttp介绍

    要论时下最火的网络请求框架,当属OkHttp了.自从Android4.4开始,google已经开始将源码中的HttpURLConnection替换为OkHttp,而在Android6.0之后的SDK中 ...

  7. 云K8S - AWS容器库ECR(ERS)编排ECS-EKS以及阿里云编排ACS-ACK

    云K8S相关 AWS 部分-ECR(ERS) ECS EKS 20180824 Chenxin AWS的容器编排目前分为 ECS 和 EKS 两种. AWS价格说明 Fargate模式的ECS,换算成 ...

  8. Windows系统Git配置教程(Git配置git config)

    Windows系统Git配置教程(Git配置git config)   在很多Git配置教程中,多是安装完毕后就告诉大家要配置用户名和邮箱,但是这个配置是保存在哪里呢,配置后面的参数有什么不同呢,下面 ...

  9. windows命令行pip报错解决的方法

    今天在新电脑安装python,发现pip无效了,于是乎百度了很多方法,发现原因是pip升级导致的 解决办法,卸载pip重新安装 可以首先执行  python -m ensurepip  然后执行 py ...

  10. MySQL常用DDL、DML、DCL语言整理

    DDL ----Data Definition Language 数据库定义语言 如 create procedure之类 创建数据库 CREATE DATABASE [IF NOT EXISTS] ...