1,首先安装iscsi-initiator-utils软件包
然后执行下面的命令,启动服务并且设置为开机自动启动
2,用iscsiadm命令检查网络存储服务器上的所有可用目标
[root@node1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.114.138
192.168.114.138:3260,1 iqn.2006-01.com.openfiler.vote
192.168.114.138:3260,1 iqn.2006-01.com.openfiler.ocr
192.168.114.138:3260,1 iqn.2006-01.com.openfiler.flash
192.168.114.138:3260,1 iqn.2006-01.com.openfiler.data
可以看到我们刚才配置的逻辑卷,然后进行手动挂载
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.data -p 192.168.114.138 -l
Logging in to [iface: default, target: iqn.2006-01.com.openfiler.data, portal: 192.168.114.138,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler.data, portal: 192.168.114.138,3260]: successful
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.vote -p 192.168.114.138 -l
Logging in to [iface: default, target: iqn.2006-01.com.openfiler.vote, portal: 192.168.114.138,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler.vote, portal: 192.168.114.138,3260]: successful
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.ocr -p 192.168.114.138 -l
Logging in to [iface: default, target: iqn.2006-01.com.openfiler.ocr, portal: 192.168.114.138,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler.ocr, portal: 192.168.114.138,3260]: successful
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.flash -p 192.168.114.138 -l
Logging in to [iface: default, target: iqn.2006-01.com.openfiler.flash, portal: 192.168.114.138,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler.flash, portal: 192.168.114.138,3260]: successful
配置自动挂载
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.data -p 192.168.114.138 --op update -n node.startup -v automatic
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.vote -p 192.168.114.138 --op update -n node.startup -v automatic
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.ocr -p 192.168.114.138 --op update -n node.startup -v automatic
[root@node1 ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler.flash -p 192.168.114.138 --op update -n node.startup -v automatic
查看/dev/disk/by-path 文件,来确定文件被映射到了哪个文件上
[root@node1 ~]# ll /dev/disk/by-path/
total 0
lrwxrwxrwx 1 root root 9 Feb 10 10:37 ip-192.168.114.138:3260-iscsi-iqn.2006-01.com.openfiler.data-lun-0 -> ../../sdc
lrwxrwxrwx 1 root root 9 Feb 10 10:37 ip-192.168.114.138:3260-iscsi-iqn.2006-01.com.openfiler.flash-lun-0 -> ../../sdf
lrwxrwxrwx 1 root root 9 Feb 10 10:37 ip-192.168.114.138:3260-iscsi-iqn.2006-01.com.openfiler.ocr-lun-0 -> ../../sde
lrwxrwxrwx 1 root root 9 Feb 10 10:37 ip-192.168.114.138:3260-iscsi-iqn.2006-01.com.openfiler.vote-lun-0 -> ../../sdd
lrwxrwxrwx 1 root root 9 Feb 10 10:24 pci-0000:00:10.0-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root 10 Feb 10 10:24 pci-0000:00:10.0-scsi-0:0:0:0-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Feb 10 10:24 pci-0000:00:10.0-scsi-0:0:0:0-part2 -> ../../sda2
lrwxrwxrwx 1 root root 9 Feb 10 10:24 pci-0000:00:10.0-scsi-0:0:1:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Feb 10 10:24 pci-0000:02:05.0-scsi-1:0:0:0 -> ../../scd0
格式化映射过来的磁盘
[root@node1 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 20480.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-20480, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-20480, default 20480):
Using default value 20480
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
同理将剩余的三块进行格式化,格式化完成后在另外一个节点执行partprobe
查看结果
[root@node1 ~]# cat /proc/partitions
major minor #blocks name
8 0 41943040 sda
8 1 104391 sda1
8 2 41833260 sda2
8 16 62914560 sdb
253 0 39714816 dm-0
253 1 2097152 dm-1
8 32 20971520 sdc
8 33 20971504 sdc1
8 48 2097152 sdd
8 49 2095662 sdd1
8 64 2097152 sde
8 65 2095662 sde1
8 80 4194304 sdf
8 81 4193060 sdf1
两个节点上查看的应该相同
编辑/etc/multipath.conf文件修改后的内容如下:
[root@node1 ~]# grep -v ^# /etc/multipath.conf
defaults {
user_friendly_names yes
}
defaults {
udev_dir /dev
polling_interval 10
selector "round-robin 0"
path_grouping_policy failover
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
prio_callout /bin/true
path_checker readsector0
rr_min_io 100
rr_weight priorities
failback immediate
#no_path_retry fail
user_friendly_name yes
}
devnode_blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
devnode "^sda"
devnode "^cciss!c[0-9]d[0-9]*"
}
multipaths {
multipath {
wwid 14f504e46494c45524d4962564e432d463364702d75305076
alias data
}
multipath {
wwid 14f504e46494c45523777524d59472d687134762d3954304d
alias vote
}
multipath {
wwid 14f504e46494c4552546b414f64582d387957792d66565641
alias ocr
}
multipath {
wwid 14f504e46494c455233455a796b532d675a4f4b2d70786130
alias flash
}
}
启动multipath服务
# service multipathd status
将multipathd设置为开机自动启动
chkconfig multipathd on
检验是否生效
[root@node1 ~]# multipath -ll
flash (14f504e46494c455233455a796b532d675a4f4b2d70786130) dm-5 OPNFILER,VIRTUAL-DISK
[size=4.0G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 34:0:0:0 sdf 8:80 [active][ready]
data (14f504e46494c45524d4962564e432d463364702d75305076) dm-2 OPNFILER,VIRTUAL-DISK
[size=20G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 31:0:0:0 sdc 8:32 [active][ready]
ocr (14f504e46494c4552546b414f64582d387957792d66565641) dm-4 OPNFILER,VIRTUAL-DISK
[size=2.0G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 33:0:0:0 sde 8:64 [active][ready]
vote (14f504e46494c45523777524d59472d687134762d3954304d) dm-3 OPNFILER,VIRTUAL-DISK
[size=2.0G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=0][active]
\_ 32:0:0:0 sdd 8:48 [active][ready]
继续检查
[root@node1 ~]# dmsetup ls | sort
data (253, 2)
datap1 (253, 9)
flash (253, 5)
flashp1 (253, 6)
ocr (253, 4)
ocrp1 (253, 8)
VolGroup00-LogVol00 (253, 0)
VolGroup00-LogVol01 (253, 1)
vote (253, 3)
votep1 (253, 7)
[root@node1 ~]# ll /dev/dm
dm-2 dm-3 dm-4 dm-5 dm-6 dm-7 dm-8 dm-9 dmmidi
[root@node1 ~]# ll /dev/dm*
brw-rw---- 1 root root 253, 2 Feb 10 11:01 /dev/dm-2
brw-rw---- 1 root root 253, 3 Feb 10 11:01 /dev/dm-3
brw-rw---- 1 root root 253, 4 Feb 10 11:01 /dev/dm-4
brw-rw---- 1 root root 253, 5 Feb 10 11:01 /dev/dm-5
brw-rw---- 1 root root 253, 6 Feb 10 11:01 /dev/dm-6
brw-rw---- 1 root root 253, 7 Feb 10 11:01 /dev/dm-7
brw-rw---- 1 root root 253, 8 Feb 10 11:01 /dev/dm-8
brw-rw---- 1 root root 253, 9 Feb 10 11:01 /dev/dm-9
crw-rw---- 1 root root 14, 9 Feb 10 10:24 /dev/dmmidi
[root@node1 ~]# ll /dev/mpath/
total 0
lrwxrwxrwx 1 root root 7 Feb 10 11:01 data -> ../dm-2
lrwxrwxrwx 1 root root 7 Feb 10 11:01 datap1 -> ../dm-9
lrwxrwxrwx 1 root root 7 Feb 10 11:01 flash -> ../dm-5
lrwxrwxrwx 1 root root 7 Feb 10 11:01 flashp1 -> ../dm-6
lrwxrwxrwx 1 root root 7 Feb 10 11:01 ocr -> ../dm-4
lrwxrwxrwx 1 root root 7 Feb 10 11:01 ocrp1 -> ../dm-8
lrwxrwxrwx 1 root root 7 Feb 10 11:01 vote -> ../dm-3
lrwxrwxrwx 1 root root 7 Feb 10 11:01 votep1 -> ../dm-7
[root@node1 ~]# ll /dev/mapper/
total 0
crw------- 1 root root 10, 63 Feb 10 10:24 control
brw-rw---- 1 root disk 253, 2 Feb 10 11:01 data
brw-rw---- 1 root disk 253, 9 Feb 10 11:01 datap1
brw-rw---- 1 root disk 253, 5 Feb 10 11:01 flash
brw-rw---- 1 root disk 253, 6 Feb 10 11:01 flashp1
brw-rw---- 1 root disk 253, 4 Feb 10 11:01 ocr
brw-rw---- 1 root disk 253, 8 Feb 10 11:01 ocrp1
brw------- 1 root root 253, 0 Feb 10 10:24 VolGroup00-LogVol00
brw------- 1 root root 253, 1 Feb 10 10:24 VolGroup00-LogVol01
brw-rw---- 1 root disk 253, 3 Feb 10 11:01 vote
brw-rw---- 1 root disk 253, 7 Feb 10 11:01 votep1
创建raw设备(两个节点都要执行)
# raw /dev/raw/raw1 /dev/mapper/votep1
/dev/raw/raw1: bound to major 253, minor 6
# raw /dev/raw/raw2 /dev/mapper/ocrp1
/dev/raw/raw2: bound to major 253, minor 7
# raw /dev/raw/raw3 /dev/mapper/flashp1
/dev/raw/raw3: bound to major 253, minor 8
# raw /dev/raw/raw4 /dev/mapper/datap1
/dev/raw/raw4: bound to major 253, minor 9
# ll /dev/raw
total 0
crw------- 1 root root 162, 1 Feb 10 11:10 raw1
crw------- 1 root root 162, 2 Feb 10 11:10 raw2
crw------- 1 root root 162, 3 Feb 10 11:10 raw3
crw------- 1 root root 162, 4 Feb 10 11:10 raw4
将raw 的配置信息, 直接写入: /etc/rc.d/rc.local。 这样启动自动加载。 没有使用udev来管理
[root@node1 ~]# cat /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
modprobe hangcheck-timer
chown oracle:oinstall /dev/mapper/data
chown oracle:oinstall /dev/mapper/datap1
chown oracle:oinstall /dev/mapper/flash
chown oracle:oinstall /dev/mapper/flashp1
chmod 660 /dev/mapper/data
chmod 660 /dev/mapper/flashp1
# Oracle Cluster Registry (OCR) devices#####
chown root:oinstall /dev/mapper/ocr*
chmod 660 /dev/mapper/ocr*
raw /dev/raw/raw2 /dev/mapper/ocrp1
sleep 2
chown root:oinstall /dev/raw/raw2
chmod 660 /dev/raw/raw2
# Oracle Cluster Voting disks#####
chown oracle:oinstall /dev/mapper/vote
raw /dev/raw/raw1 /dev/mapper/votep1
sleep 2
chown oracle:oinstall /dev/raw/raw1
chmod 660 /dev/raw/raw1
安装asm软件包(注意版本号)
oracleasm-2.6.18-164.el5-2.0.5-1.el5.i686.rpm
oracleasm-2.6.18-164.el5PAE-2.0.5-1.el5.i686.rpm
oracleasm-support-2.1.8-1.el5.i386.rpm
oracleasm-2.6.18-164.el5debug-2.0.5-1.el5.i686.rpm
oracleasm-2.6.18-164.el5xen-2.0.5-1.el5.i686.rpm
oracleasm-2.6.18-164.el5-debuginfo-2.0.5-1.el5.i686.rpm
oracleasmlib-2.0.4-1.el5.i386.rpm
配置oracleasm
[root@node1 oracle]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
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
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
在一个节点上创建需要的磁盘
/etc/init.d/oracleasm createdisk data /dev/mapper/datap1
/etc/init.d/oracleasm createdisk fra /dev/mapper/flashp1
在另外一个节点上面进行扫面
[root@node1 ~]# /etc/init.d/oracleasm listdisks
DATA
FRA
阅读(3397) | 评论(0) | 转发(1) |