三、在所有RAC节点上配置iSCSI卷(iSCSI Volumes)
在前面的操作中,已经把共享存储设备建立好了并建立了8个逻辑卷及相对应的IQN Target,在这一步中就是要在RAC节点上发现这些IQN,并把其引入作为本地磁盘使用。完成这一步要分几个小的步骤,首先要检查Solaris系统是否安装了iscsi-target驱动,其次是配置iscsi initiator服务,最后把引入的磁盘格式化并分区。
1.安装iscsi-target驱动(两个RAC节点都执行)
我们在安装Solaris10系统时选择安装了全部包,所以该服务就自动安装好了,并自动启动了;如果没有全部安装所以包,就要检查是否安装了以下4个包SUNWiscsir、SUNWiscsitgtr、SUNWiscsitgtu、SUNWiscsiu。使用命令 -bash-3.00#pkginfo -i 包名 来检测4个包是否都安装了
执行以下命令添加包
-bash-3.00# pkgadd -d /cdrom/SOL_10_1009_X86/SOLARIS_10/PRODUCT SUNWiscsir
把4个包都安装好后,服务自动启动。
2.配置iscsi initiator服务
在每个RAC节点上都执行以下命令,用来发现共享存储
-bash-3.00# iscsiadm add discovery-address 192.168.2.195:3260 (添加发现的地址,写Openfiler共享存储的私网地址,端口号:3260)
-bash-3.00# iscsiadm modify discovery --sendtargets enable (启用sendtargets功能)
-bash-3.00# iscsiadm modify discovery --static enable
-bash-3.00# iscsiadm list target -S
如果要删除发现地址,使用命令
-bash-3.00# iscsiadm remove discovery-address 192.168.2.195 (在Solaris系统中只敲入iscsiadm命令,系统会显示相关的用法。)
输入完第4个命令后回车,应立即显示出以下内容,为节省篇幅把其写在表格中
Target: iqn.2010.com.openfiler:rac.crs1 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t10d0s2 | Target: iqn.2010.com.openfiler:rac.crs2 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t11d0s2 | Target: iqn.2010.com.openfiler:rac.asm1 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t12d0s2 |
Target: iqn.2010.com.openfiler:rac.asm2 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t13d0s2 | Target: iqn.2010.com.openfiler:rac.asm3 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t14d0s2 | Target: iqn.2010.com.openfiler:rac.asm4 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t15d0s2 |
Target: iqn.2010.com.openfiler:rac.fra1 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t16d0s2 | Target: iqn.2010.com.openfiler:rac.fra2 Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t17d0s2 | Target: iqn.2010.com.openfiler:rac.spfile Alias: - TPGT: 1 ISID: 4000002a0000 Connections: 1 LUN: 0 Vendor: OPNFILER Product: VIRTUAL-DISK OS Device Name: /dev/rdsk/c3t18d0s2 |
最后一个命令录入完后回车,系统会把在Openfiler共享存储中建好的9个IQN Target依次列出,其中加粗标红显示的就是在本地的裸设备名称,在Solaris系统中系统每次重启后IQN Target的顺序不会改变,不用象Linux系统中那样建立规则脚本,有一种特殊情况提一下,如果两个RAC节点对同一个IQN分配的磁盘号不同,就需要通过建立软连接解决了,把不同的设备号映射为相同的名称问题就解决了,这会在后面介绍。
注意:如果输入完iscsiadm list target -S 命令后系统没有显示任何内容,代表设置有错误存在,RAC节点没有成功发现共享存储设备,请检查以下4点:
①如果是在VMWare中安装部署,所有主机的网卡连接方式一定要选择“Bridged”桥接方式(使用物理网络)。
②Openfiler中访问控制的网段或IP地址的掩码要写对,如果写的是网段如192.168.2.0则对应255.255.255.0(注意是3个255和1个零);如果写的是IP地址如192.168.2.151则对应255.255.255.255(注意是4个255)。
③在Openfiler中建立的iSCSI Target中的“Network ACL”页面中网段或IP一定要设置为“Allow”允许访问。
④Openfiler共享存储中的“Services”页面中的“iSCSI target server”和“iSCSI initiator”两个服务必须启动。
如果以上4点有一个设置不对,共享存储都是不能被发现的,如有问题,请在这4个方面检查。
3.把共享盘格式化并分区 (只在一个RAC节点执行即可)
(下面红色字为系统显示内容)
在格式化前先说一下Solaris系统中对磁盘的管理,Solaris中每个磁盘分为6个片(slice),上面列出的如:/dev/rdsk/c3t10d0s2,其中s2代表整个磁盘,所以6个片是s1到s7,下面配合截图说明格式化和分区。分区使用以下命令
-bash-3.00# /usr/sbin/format (直接写format也可以)
系统会显示以下内容,其中包括系统盘和9个网络共享磁盘(1到9是共享磁盘)
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0d0
/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c3t10d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.crs10001,0
2. c3t11d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.crs20001,0
3. c3t12d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.asm10001,0
4. c3t13d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.asm20001,0
5. c3t14d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.asm30001,0
6. c3t15d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.asm40001,0
7. c3t16d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.fra10001,0
8. c3t17d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.fra20001,0
9. c3t18d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.spfile0001,0
Specify disk (enter its number): 1 (回车)
我们首先把rac.crs1盘格式化分区,根据提示输入盘号“1”,进入格式化,系统显示
selecting c3t10d0
[disk formatted]
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
fdisk - run the fdisk program
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
volname - set 8-character volume name
! - execute , then return
quit
format> p (回车)
WARNING - This disk may be in use by an application that has
modified the fdisk table. Ensure that this disk is
not currently in use before proceeding to use fdisk.
由于是新磁盘,没有使用过,所以要先执行“fdisk”命令,否则会报错
执行fdisk命令
format>fdisk
系统显示以下内容,并根据提示输入“y”
No fdisk table exists. The default partition for the disk is:
a 100% "SOLARIS System" partition
Type "y" to accept the default partition, otherwise type "n" to edit the
partition table.
y (回车)
接下来在foramt>提示符下输入“p”,进入分区程序(红字为系统显示,黑字为用户录入):
format> p (进入分区程序)
PARTITION MENU:
0 - change `0' partition
1 - change `1' partition
2 - change `2' partition
3 - change `3' partition
4 - change `4' partition
5 - change `5' partition
6 - change `6' partition
7 - change `7' partition
select - select a predefined table
modify - modify a predefined partition table
name - name the current table
print - display the current table
label - write partition map and label to the disk
! - execute , then return
quit
partition> p (再次录入“p”,显示一下分区情况)
Current partition table (original):
Total disk cylinders available: 2044 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 2043 3.99GB (2044/0/0) 8372224
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0
partition> 6 (给片6分配空间)
Part Tag Flag Cylinders Size Blocks
6 unassigned wm 0 0 (0/0/0) 0
Enter partition id tag[unassigned]: usr (写分区标识为“usr”)
Enter partition permission flags[wm]: (按默认设置,直接回车)
Enter new starting cyl[1]: 3 (这里特别注意:绝对不能写0,柱面由3开始,如起始柱面设置不对,当安装Clusterware或Grid做格式化voting disk时会报错)
Enter partition size[0b, 0c, 3e, 0.00mb, 0.00gb]: 2g (大小设置为2G)
partition> label (分区完毕后要执行一下“label”命令,做分区标识,注意这是必须步骤)
Ready to label disk, continue? yes
partition> p (再次查看一下分区情况)
Current partition table (unnamed):
Total disk cylinders available: 2044 + 2 (reserved cylinders)
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 2043 3.99GB (2044/0/0) 8372224
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 usr wm 3 - 1026 2.00GB (1024/0/0) 4194304
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 - 0 2.00MB (1/0/0) 4096
9 unassigned wm 0 0 (0/0/0) 0
partition> q (“q”退出)
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
current - describe the current disk
format - format and analyze the disk
fdisk - run the fdisk program
repair - repair a defective sector
label - write label to the disk
analyze - surface analysis
defect - defect list management
backup - search for backup labels
verify - read and display labels
save - save new disk/partition definitions
inquiry - show vendor, product and revision
volname - set 8-character volume name
! - execute , then return
quit
format>
接下来把其它8个共享磁盘也格式化并分区,分区时也把磁盘的空间分到s6(片6)上,不同的地方只是分配空间大小不同,4个ASM盘都是190G,2个FRA都是90G,1个spfile盘分800M。
4.给共享磁盘建立软连接
建立软连接的目的是:如果同一个IQN Target在两个RAC节点上的本地设备名不一致,就必须在两个节点都创建一个软连接,把不同的本地磁盘名称映射为相同的名称;还有一个好处是,映射之后的设备名称比较直观,便与管理。在root用户下输入format命令,就可以看到IQN与本地设备的对应关系(在Solaris系统中裸设备的路径是/dev/rdsk/)。
-bash-3.00# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0d0
/pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
1. c3t10d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.crs10001,0
2. c3t11d0
/iscsi/disk@0000iqn.2010.com.openfiler%3Arac.crs20001,0
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26712/viewspace-1031700/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26712/viewspace-1031700/