четверг, 19 февраля 2009 г.

Настройка Multipath on Linux

Подготовить ASM disk для Grid Infrastructure


http://docs.oracle.com/database/121/LADBI/app_manual.htm#LADBI8065
http://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1202

Note: Oracle recommends that you create a single whole-disk PRIMARY partition
on each disk to use.

$ fdisk /dev/sdc

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p < -  Enter p
Partition number (1-4): 1
First cylinder (1-16709, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-16709, default 16709): 16709

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.


$ ls -al /dev/sdc*
brw-rw---- 1 root disk 8, 32 Jan 29 16:40 /dev/sdc
brw-rw---- 1 root disk 8, 33 Jan 29 16:40 /dev/sdc1

$ partprobe -s /dev/sdc

/dev/sdc: msdos partitions 1


Настройка ПО Multipath



To work on VMware Fusion, set the following on the .vmx file;
without this entry, the scsi_id command does not return any values by default.
disk.EnableUUID = "TRUE"

# su - root
# yum install device-mapper-multipath
# mpathconf
# mpathconf --enable --user_friendly_names y --with_module y --with_multipathd y --with_chkconfig y

# multipath -ll


mpathc (36000c298b7d4d54eb873153d6254bcae) dm-4 VMware,Virtual disk
size=128G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  `- 2:0:2:0 sdc 8:32 active ready running
mpathb (36000c2914cdc65086c8f424e512044ec) dm-3 VMware,Virtual disk
size=128G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  `- 2:0:1:0 sdb 8:16 active ready running


Ignoring Local Disks when Generating Multipath Devices


/dev/sda is the internal disk
/dev/sdb is the internal disk


# su – root

# /lib/udev/scsi_id --whitelisted --device=/dev/sda
36000c291ecbd84c5b584072ef62c2b0b

#  /lib/udev/scsi_id --whitelisted --device=/dev/sdb
36000c2914cdc65086c8f424e512044ec

vi /etc/multipath.conf


blacklist {
  wwid 36000c291ecbd84c5b584072ef62c2b0b
  wwid 36000c2914cdc65086c8f424e512044ec
}

# service multipathd reload

Create Alias


# su - root
# /lib/udev/scsi_id --whitelisted --device=/dev/sdc

36000c298b7d4d54eb873153d6254bcae

# vi /etc/multipath.conf
multipaths {
multipath {
  wwid 36000c298b7d4d54eb873153d6254bcae
  alias DATA_disk01
  }
}

# service multipathd reload

# multipath –ll


DATA_disk01 (36000c298b7d4d54eb873153d6254bcae) dm-4 VMware,Virtual disk
size=128G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=active
  `- 2:0:2:0 sdc 8:32 active ready running

List config Multipath


# cat /etc/multipath.conf

defaults {
        user_friendly_names yes
        find_multipaths     yes
}

multipaths {
multipath {
  wwid 36000c298b7d4d54eb873153d6254bcae
  alias DATA_disk01
  }
}

blacklist {
  wwid 36000c291ecbd84c5b584072ef62c2b0b
  wwid 36000c2914cdc65086c8f424e512044ec
}


# ls -al /dev/mapper

total 0
drwxr-xr-x  2 root root     160 Jan 29 23:12 .
drwxr-xr-x 20 root root    4280 Jan 29 23:12 ..
crw-rw----  1 root root 10, 236 Jan 29 17:45 control
lrwxrwxrwx  1 root root       7 Jan 29 23:13 DATA_disk01 -> ../dm-4
lrwxrwxrwx  1 root root       7 Jan 29 23:13 DATA_disk01p1 -> ../dm-5 -> Наш ASM диск
lrwxrwxrwx  1 root root       7 Jan 29 17:45 orabinvg-orabinlv -> ../dm-2
lrwxrwxrwx  1 root root       7 Jan 29 17:45 vg_dc1oel67-lv_root -> ../dm-0
lrwxrwxrwx  1 root root       7 Jan 29 17:45 vg_dc1oel67-lv_swap -> ../dm-1


Установка ASMLib


http://www.oracle.com/technetwork/server-storage/linux/asmlib/ol6-1709075.html
http://docs.oracle.com/database/121/LADBI/app_manual.htm#LADBI8065


$ su - root
$ yum install kmod-oracleasm
$ yum install oracleasm-support
$ download http://download.oracle.com/otn_software/asmlib/oracleasmlib-2.0.12-1.el6.x86_64.rpm
$ rpm -Uhv /tmp/oracleasmlib-2.0.12-1.el6.x86_64.rpm


-- Проверка

$ rpm -qa | grep asm
oracleasmlib-2.0.12-1.el6.x86_64
oracleasm-support-2.1.8-1.el6.x86_64
kmod-oracleasm-2.0.8-6.el6_7.x86_64


Configure ASMLib using the following command

$ /usr/sbin/oracleasm configure -i

Default user to own the driver interface []:        oracle
Default group to own the driver interface []:       oinstall
Start Oracle ASM library driver on boot (y/n) [n]:  y
Scan for Oracle ASM disks on boot (y/n) [y]:        y
Writing Oracle ASM library driver configuration:    done

Within /etc/sysconfig/oracleasm,
set the ORACLEASM_SCANORDER and ORACLEASM_SCANEXCLUDE parameters as follows:

# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER="dm"

# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE="sd"


Run the following oracleasm command to ensure that oracleasm is enabled.


# /etc/init.d/oracleasm enable

Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]

# /usr/sbin/oracleasm scandisks
# /usr/sbin/oracleasm listdisks


Создать ASM Disk


--Run the following oracleasm command to create and label all Oracle related volumes
--as an ASM disk. The example below creates an ASM disk labeled DATA_DISK01_P1.

# su - root
# /usr/sbin/oracleasm createdisk DATA_DISK01_P1 /dev/mapper/DATA_disk01p1

# /usr/sbin/oracleasm querydisk /dev/mapper/DATA_disk01p1

Device "/dev/mapper/DATA_disk01p1" is marked an ASM disk with the label "DATA_DISK01_P1"

# ls -al /dev/oracleasm/disks/*
brw-rw---- 1 oracle oinstall 252, 3 Jan 29 23:59 /dev/oracleasm/disks/DATA_DISK01_P1


How to map device name to ASMLIB disk (Doc ID 1098682.1)

su - root

#!/bin/bash
for asmlibdisk in `ls /dev/oracleasm/disks/*`
  do
    echo "ASMLIB disk name: $asmlibdisk"
    asmdisk=`kfed read $asmlibdisk | grep dskname | tr -s ' '| cut -f2 -d' '`
    echo "ASM disk name: $asmdisk"
    majorminor=`ls -l $asmlibdisk | tr -s ' ' | cut -f5,6 -d' '`
    device=`ls -l /dev | tr -s ' ' | grep -w "$majorminor" | cut -f10 -d' '`
    echo "Device path: /dev/$device"
done



ASMLIB disk name: /dev/oracleasm/disks/DATA_DISK01_P1
ASM disk name: DATA_DISK01_P1
Device path: /dev/dm-4





Комментариев нет:

Отправить комментарий