温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

使用multipath创建asm磁盘

发布时间:2020-08-11 07:42:13 来源:ITPUB博客 阅读:179 作者:icclu 栏目:关系型数据库

使用multipath创建asm磁盘

创建asm磁盘的方法格式各样,本文主要为了标准化,统一采用multipath与udev结合管理asm磁盘.适用于linux6 ,linux7,多路径或者单一路径.

以下操作使用oracle linux 7为例.

1.安装multipath软件

yum源使用oracle官方源或者本地iso源

[root@oel7 ~]# yum provides multipath

Loaded plugins: ulninfo

device-mapper-multipath-0.4.9-119.el7.x86_64 : Tools to manage multipath devices using device-mapper

Repo        : dbinstall

Matched from:

Filename    : /usr/sbin/multipath

# yum install device-mapper-multipath-0.4.9-119.el7.x86_64

2.加载模块&创建配置文件

初次安装需要加载dm模块

# modprobe dm-multipath

# modprobe dm-round-robin

# cp /usr/share/doc/device-mapper-multipath-*/multipath.conf  /etc/multipath.conf

3.编辑配置文件 /etc/multipath.conf

devices {

    device {

        vendor            "VMware, "

        product            "VMware Virtual S"

        path_grouping_policy    multibus

        path_checker        readsector0

        path_selector        "round-robin 0"

        hardware_handler    "0"

        failback        15

        rr_weight        priorities

        no_path_retry        queue

    }

}

multipaths {

       multipath {

               wwid                    36000c29b9e405c3d07021157ace9ab9f

               alias                   asm_data01

       }

       multipath {

               wwid                    36000c2933be13ffabcb0ce90806ea5dd

               alias                   asm_fra01

       }

}

4.查看multipath设备

重启服务

# systemctl restart multipathd

# multipath -ll

由于是虚拟机且非多路径,并没有生成相关设备.此时我们手动添加wwid到multipath信息库.若为真实多路径,无需手动添加

multipath -a /dev/sdb

multipath -a /dev/sdc

再次重启服务

# systemctl restart multipathd

查看设备

# multipath -ll

asm_fra01 (36000c2933be13ffabcb0ce90806ea5dd) dm-3 VMware, ,VMware Virtual S

size=10G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  `- 0:0:2:0 sdc             8:32  active ready running

asm_data01 (36000c29b9e405c3d07021157ace9ab9f) dm-2 VMware, ,VMware Virtual S

size=30G features='1 queue_if_no_path' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

  `- 0:0:1:0 sdb             8:16  active ready running

5.配置udev规则

前面做了这么多工作主要为了udev规则配置简单

来看下multipath管理的设备特点

[root@oel7 ~]# udevadm info -q all -n /dev/mapper/asm_data01

P: /devices/virtual/block/dm-2

N: dm-2

L: 10

S: disk/by-id/dm-name-asm_data01

S: disk/by-id/dm-uuid-mpath-36000c29b9e405c3d07021157ace9ab9f

S: disk/by-label/DATA1

S: mapper/asm_data01

E: DEVLINKS=/dev/disk/by-id/dm-name-asm_data01 /dev/disk/by-id/dm-uuid-mpath-36000c29b9e405c3d07021157ace9ab9f /dev/disk/by-label/DATA1 /dev/mapper/asm_data01

E: DEVNAME=/dev/dm-2

E: DEVPATH=/devices/virtual/block/dm-2

E: DEVTYPE=disk

E: DM_MULTIPATH_TIMESTAMP=1536682254

E: DM_NAME=asm_data01

E: DM_SUSPENDED=0

E: DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1

E: DM_UDEV_PRIMARY_SOURCE_FLAG=1

E: DM_UDEV_RULES_VSN=2

E: DM_UUID=mpath-36000c29b9e405c3d07021157ace9ab9f

E: ID_FS_LABEL=DATA1

E: ID_FS_LABEL_ENC=DATA1

E: ID_FS_TYPE=oracleasm

E: ID_FS_USAGE=filesystem

E: MAJOR=249

E: MINOR=2

E: MPATH_SBIN_PATH=/sbin

E: SUBSYSTEM=block

E: TAGS=:systemd:

E: USEC_INITIALIZED=83840

利用着色部分做udev规则

cat >> /etc/udev/rules.d/99-oracle-asmdevices.rules <<END

KERNEL=="dm-*",ENV{DM_UUID}=="mpath-?*",ENV{DM_NAME}=="asm_?*",OWNER="grid",GROUP="asmadmin",MODE="0660"

END

启动udev

# udevadm trigger -c change

linux6用start_udev

查看权限

[root@oel7 ~]# ll /dev/dm*

brw-rw----. 1 root disk     249, 0 Sep 12 00:33 /dev/dm-0

brw-rw----. 1 root disk     249, 1 Sep 12 00:33 /dev/dm-1

brw-rw----. 1 grid asmadmin 249, 2 Sep 12 00:33 /dev/dm-2

brw-rw----. 1 grid asmadmin 249, 3 Sep 12 00:33 /dev/dm-3

至此asm磁盘就创建成功了.


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI