|
|
楼主 |
发表于 2021-7-9 17:25:52
|
显示全部楼层
12.在 Oracle RAC 节点上配置 iSCSI 卷
, _& ~* f" {& v2 x# s+ F( I在集群中的两个 Oracle RAC 节点上配置 iSCSI 启动器。但是,应当仅在 RAC 集群中的节点之一上执行创建分区的操作。
& e0 x% L0 b. p# m. z wiSCSI 客户端可以是任何提供 iSCSI 支持(驱动程序)的系统(Linux、Unix、MS Windows、Apple Mac 等)。在本例中,客户端是两个 Linux 服务器,即 racnode1 和 racnode2,运行 Oracle Enterprise Linux 5.4。
( {) s% r0 o. W1 }6 M1 R在本节中,我们将在两个 Oracle RAC 节点上配置 iSCSI 软件启动器。Oracle Enterprise Linux 5.4 包含 Open-iSCSI iSCSI 软件启动器,可从 iscsi-initiator-utils RPM 中获取该软件启动器。这与之前版本的 Oracle Enterprise Linux (4.x) 有所不同,该版本包含作为 Linux-iSCSI 项目中的一部分而开发的 Linux iscsi-sfnet 软件驱动程序。所有 iSCSI 管理任务(如发现和登录)都将使用 Open-iSCSI 中包含的命令行界面 iscsiadm。# J" m$ I1 B4 O/ }' a0 n) Y. d! T
iSCSI 软件启动器将被配置为自动登录至网络存储服务器 (openfiler1) 并发现上一节中创建的 iSCSI 卷。随后,我们将使用 udev 为所发现的每一个 iSCSI 目标名称创建持久本地 SCSI 设备名称(即 /dev/iscsi/crs1)。拥有一致的本地 SCSI 设备名称和所映射到的 iSCSI 目标,有助于在配置 ASM 时区分三个不同的卷。但是,在此之前,我们需要先安装 iSCSI 启动器软件。- @8 r9 J7 v6 D3 i. R
注意: 本指南使用 ASMLib 2.0,它是 Oracle 数据库的自动存储管理 (ASM) 特性的支持库。ASMLib 将用于标记本指南中使用的所有 iSCSI 卷。默认情况下,ASMLib 已经为与 ASM 一起使用的存储设备提供了持久路径和权限。此功能消除了使用存储设备路径和权限更新 udev 或 devlabel 文件的需要。在本文和实践中,我仍然选择为使用 udev 发现的每一个 iSCSI 目标名称创建持久本地 SCSI 设备名称。这提供了一种自我归档方法,有助于快速识别每一个卷的名称和位置。2 y) [5 o0 X5 U, ^5 F" g; x* Q8 X/ {
安装 iSCSI(启动器)服务
6 r3 _6 J0 P. R+ _' \( r对于 Oracle Enterprise Linux 5.4,默认情况下不会安装 Open-iSCSI iSCSI 软件启动器。该软件包含在 iscsi-initiator-utils 软件包中,可从 CD #1 中找到该软件包。要确定是否安装了此软件包(大多数情况下未安装),请在两个 Oracle RAC 节点上执行以下操作:9 j5 b1 K+ v& a
复制
. _$ M' u+ y6 R8 ]8 L1 U6 {" rCopied to ClipboardError: Could not Copy0 c% N9 `" U6 t6 }7 F
[root@racnode1 ~]#
" |+ w2 L0 _: o$ |- Y7 A rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n"| grep iscsi-initiator-utils' V L; {: J' ^# X) X
[root@racnode1 ~]#
+ R& C" [& j$ T+ I: t rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n"| grep iscsi-initiator-utils. E( C( N0 w) ]. K
如果未安装 iscsi-initiator-utils 软件包,则将 CD #1 加载到每一个 Oracle RAC 节点中,然后执行以下操作:
; y _5 Q$ s" h8 ~/ K; H复制) w2 L0 I5 y( D) [# c: c
Copied to ClipboardError: Could not Copy$ a( ~$ S" k' {5 W4 Z1 |4 `
[root@racnode1 ~]# , Z/ Z8 A9 y: v7 Z# Z( u" j' \
mount -r /dev/cdrom /media/cdrom
% @/ ^3 A9 `% y1 v4 c: x. r+ ] @ [root@racnode1 ~]# * W' W/ s2 @( b- M# p. Y- ~8 z* G
cd /media/cdrom/Server
8 f4 H5 B, R4 x6 }" @4 _4 y [root@racnode1 ~]#
' x( v4 M5 I' ~- }( _ rpm -Uvh iscsi-initiator-utils-*& O# k6 \' P: R' [ o* V
[root@racnode1 ~]# 3 E; b+ g, M7 q3 K
cd /
" o$ X# t) x" B' p. K [root@racnode1 ~]# # C4 z3 q: O) _1 [
eject
. o' E4 h* ]7 r, H9 v6 U" j, R[root@racnode1 ~]#
+ `, F, _8 g" q+ z4 d mount -r /dev/cdrom /media/cdrom* C$ R3 X: a- F1 j4 s, Y
[root@racnode1 ~]#
& C3 b# ^. @4 P4 G cd /media/cdrom/Server
. W/ o0 H! z/ c. X6 k: E3 `: o [root@racnode1 ~]#
) Y+ s. g, v0 Q2 G- c$ f# b rpm -Uvh iscsi-initiator-utils-*
- \$ ~5 d4 L( A, {+ m [root@racnode1 ~]# 6 y* q2 N3 V- ^( d1 Q1 Q
cd /# A# h- w& Y: y" a
[root@racnode1 ~]# " T0 ?$ Q! ~1 |; N0 B# N
eject
+ x+ T% @' a( Q2 S验证现已安装 iscsi-initiator-utils 软件包:
# x. l% X/ \( y+ J复制
* T x! i2 x- ?1 A' PCopied to ClipboardError: Could not Copy6 W; x. n6 k% ?
[root@racnode1 ~]#
' F7 J$ Y* ~ s! }$ @, a rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n"| grep iscsi-initiator-utils
; |. i0 A0 [* C2 z3 k$ }6 O iscsi-initiator-utils-6.2.0.871-0.10.el5 (x86_64)& Z* B; N8 x* b
[root@racnode1 ~]# 5 H" I* P# G4 j; R n3 e
rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n"| grep iscsi-initiator-utils! ]4 y" p5 K4 V4 q
iscsi-initiator-utils-6.2.0.871-0.10.el5 (x86_64)
) r+ {1 Z0 T/ W( }/ w) y6 }, ?+ Z2 B配置 iSCSI(启动器)服务
- G% K, z$ z& }" i% ^. N验证两个 Oracle RAC 节点上均安装了 iscsi-initiator-utils 软件包之后,启动 iscsid 服务并设置其在系统启动时自动启动。我们还将配置 iSCSI 服务自动启动,以便于在系统启动时登录到所需 iSCSI 目标。
" X, W3 {8 F8 J6 t+ q; y4 H复制# L- }$ ^. H4 o# f
Copied to ClipboardError: Could not Copy
" o' M. [1 e8 P [[root@racnode1 ~]#
3 w+ `, A2 z, |/ P service iscsid start
3 i7 Q3 l/ A! e J5 z7 {; l6 o Turning off network shutdown. Starting iSCSI daemon:
! s' |, M% J$ u2 T4 q# @" C - u: {7 Z5 m( x5 C( H
OK ]4 n1 U) n: o% C* X3 `5 i
/ }" |5 q5 P4 {; N& l- b
8 I3 v, y6 j; P OK ]
% J& C0 b# n! t9 O ! u% s6 `* O9 P5 X) P! }# ~ v
[root@racnode1 ~]#
1 [) X9 O/ u8 G2 e" k chkconfig iscsid on
- x5 t/ j, A9 ?) c [root@racnode1 ~]# ) u" g& l, q& C
chkconfig iscsi on
; W- B5 ^* y, P0 c% `5 \+ { `[root@racnode1 ~]#
9 J6 A U; s3 j- r( K service iscsid start
& z, p+ J- I0 W$ ? m# _! H3 w; j Turning off network shutdown. Starting iSCSI daemon: # }. n0 a# O8 n- j6 ?! w3 D
2 ?6 b9 ]; u. p- Q L
OK ]2 n, \4 X; I* G! n
, E2 D- y3 H; N* f
0 |$ H4 _+ c# \1 |& k1 |
OK ]1 s/ E5 p7 L8 R2 l
& ~, |: {: \# l6 N [root@racnode1 ~]# ! c0 D& R4 o- p% T
chkconfig iscsid on$ {5 }& R: A1 `! w6 n
[root@racnode1 ~]# 8 B/ B, @, l2 d6 S9 j' a/ h& R
chkconfig iscsi on
8 e7 _1 c- c7 x' w3 Q! c4 n+ E" X现在 iSCSI 服务已启动,请使用 iscsiadm 命令行界面来发现网络存储服务器上的所有可用目标。这应当在两个 Oracle RAC 节点上执行,以验证配置是否正常运行:* G/ ^6 ]& e6 h0 p r
复制
( @* _" P) O1 r. O I; I& L% pCopied to ClipboardError: Could not Copy
1 W3 D- I) N4 h' L$ a7 p[root@racnode1 ~]#
+ I: L( M P! b% F. p+ \2 K9 g iscsiadm -m discovery -t sendtargets -p openfiler1-priv
" }: R" o/ n4 Q' |; i8 a0 | 192.168.2.195:3260,1 iqn.2006-01.com.openfiler:racdb.crs1; ^5 A1 |7 \3 h( g7 {& [7 [
192.168.2.195:3260,1 iqn.2006-01.com.openfiler:racdb.fra1, |! t5 J$ ^* A w8 T
192.168.2.195:3260,1 iqn.2006-01.com.openfiler:racdb.data1$ u1 P2 z7 Z& a
[root@racnode1 ~]#
1 M) F" L: g/ }1 b iscsiadm -m discovery -t sendtargets -p openfiler1-priv& D4 N2 Y0 e+ B7 J' C6 W/ J
192.168.2.195:3260,1 iqn.2006-01.com.openfiler:racdb.crs13 L3 j& T$ [; |
192.168.2.195:3260,1 iqn.2006-01.com.openfiler:racdb.fra1; j8 M% N0 G% p& x4 m, k3 g1 S
192.168.2.195:3260,1 iqn.2006-01.com.openfiler:racdb.data1
& M0 X8 T4 g( C0 }, H手动登录至 iSCSI 目标/ N+ J' u, [" w% @8 N
至此,iSCSI 启动器服务已启动,每一个 Oracle RAC 节点都可以从网络存储服务器中发现可用目标。下一步是手动登录至每一个可用目标,可以使用 iscsiadm 命令行界面来执行此操作。两个 Oracle RAC 节点上都需要运行此任务。请注意,我需要指定 IP 地址,而不是网络存储服务器的主机名 (openfiler1-priv) - 我认为这是必需的,因为(上述)发现显示了使用 IP 地址的目标。
* @0 ~. L3 k6 L) H复制4 W- U4 {6 m' x- [& t) w
Copied to ClipboardError: Could not Copy
) R9 j2 _. @7 r[root@racnode1 ~]# 8 P/ v3 m2 p; @% G4 a# s2 ~: N
iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.crs1 -p 192.168.2.195 -l* j x7 T, J1 j8 }& f
[root@racnode1 ~]#
. T* A$ N- @+ [7 R. d% |# _5 { iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.data1 -p 192.168.2.195 -l
/ R& L% ^! S4 p0 j [root@racnode1 ~]# * @- [: y/ W- K
iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.fra1 -p 192.168.2.195 -l
* z! x+ }9 i7 {[root@racnode1 ~]# 1 g& j; @1 d, c: n+ m8 [$ u
iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.crs1 -p 192.168.2.195 -l: `8 W3 ]9 W5 d. `$ B) j& T% h
[root@racnode1 ~]#
; c0 G0 O; r7 Y+ x& [; ^0 W2 | iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.data1 -p 192.168.2.195 -l T: E9 W. C: ?, u& p5 I
[root@racnode1 ~]#
* n" Q! q* S3 c iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.fra1 -p 192.168.2.195 -l6 P/ M2 f- ]8 G3 h& Z
配置自动登录
$ N9 U* t$ ]. |# n# B/ j下一步是确保客户端将在机器启动时(或 iSCSI 启动器服务启动/重新启动时)自动登录到上述每一个目标。与上述手动登录过程一样,在两个 Oracle RAC 节点上执行以下操作:7 l4 X$ V: Y Y0 L# O( R
复制
% t- G! ]5 ?$ Z0 eCopied to ClipboardError: Could not Copy
" M; j$ ]' d: O1 Q4 Z7 S# d[root@racnode1 ~]#
$ o q# w, Y: g& v iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.crs1 -p 192.168.2.195 --op update -n node.startup -v automatic
* K+ j- a2 Q$ \* J% Y0 Z [root@racnode1 ~]#
6 ~: O$ w* T9 t5 m7 |' E9 h iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.data1 -p 192.168.2.195 --op update -n node.startup -v automatic
8 p. L" O0 c" S6 @5 x% A7 U [root@racnode1 ~]# 1 `' e8 i6 O, i4 y/ g: |8 l
iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.fra1 -p 192.168.2.195 --op update -n node.startup -v automatic2 @; q s3 y; [$ K0 f6 R
[root@racnode1 ~]# 4 z0 p3 j1 Y+ |+ d5 H4 E0 W9 l
iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.crs1 -p 192.168.2.195 --op update -n node.startup -v automatic2 I* h& v# D8 |' a' ~
[root@racnode1 ~]# ' M3 t' J V+ d+ {
iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.data1 -p 192.168.2.195 --op update -n node.startup -v automatic% F' Y1 J3 c4 H0 S O* k s( A& k, C
[root@racnode1 ~]#
7 t4 {* N- C1 N( e; m4 } iscsiadm -m node -T iqn.2006-01.com.openfiler:racdb.fra1 -p 192.168.2.195 --op update -n node.startup -v automatic$ V/ Z! g N* f6 R; h6 \
创建持久本地 SCSI 设备名称
* I" I, x+ m; X6 [在本节中,我们将为每一个 iSCSI 目标名称创建持久本地 SCSI 设备名称。这将使用 udev 来完成。拥有一致的本地 SCSI 设备名称和所映射到的 iSCSI 目标,有助于在配置 ASM 时区分三个不同的卷。这并不是一项严格的需求,因为我们将为所有卷使用 ASMLib 2.0,而这提供了一种自我归档方法来快速识别每一个 iSCSI 卷的名称和位置。
$ a, t' B) S* Z" x* I当任何一个 Oracle RAC 节点启动以及 iSCSI 启动器服务启动时,它将自动登录到以随机方式配置的每一个目标,并将其映射至下一个可用的本地 SCSI 设备名称。例如,目标 iqn.2006-01.com.openfiler:racdb.crs1 可能会映射到 /dev/sdb。我实际上可以通过查看 /dev/disk/by-path 目录来确定所有目标的当前映射:
# e3 d0 S8 C# W' N: {复制6 G! a: }4 X+ q$ I- P x
Copied to ClipboardError: Could not Copy: ?2 ]' ^- C# y$ X
[root@racnode1 ~]#
" U$ }: [8 T" N (cd /dev/disk/by-path; ls -l *openfiler* | awk '{FS=" "; print $9 " " $10 " " $11}')2 V# I1 [( T' q8 y9 t; i
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.crs1-lun-0 -> ../../sdb
7 M1 B- } F. r7 D" F% g ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.data1-lun-0 -> ../../sdd5 w% ?, L; s4 h6 f
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.fra1-lun-0 -> ../../sdc2 b* m' n0 m- C
[root@racnode1 ~]# ! u# T; d2 m# o7 _, L
(cd /dev/disk/by-path; ls -l *openfiler* | awk '{FS=" "; print $9 " " $10 " " $11}')
0 m# Q) N* F# B5 R ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.crs1-lun-0 -> ../../sdb
0 A( c3 N; I4 u( \4 \! ]) J ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.data1-lun-0 -> ../../sdd
G; Q3 i3 `" x8 `& y, O. j ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.fra1-lun-0 -> ../../sdc- ^4 ]/ i; W) I
我们可以使用上述输出建立以下当前映射:2 ^1 L1 Z$ s7 {/ i. U: E9 H' @6 C& v" Q
当前 iSCSI 目标名称到本地 SCSI 设备名称映射
: C1 _3 J) I; YiSCSI 目标名称 SCSI 设备名称
; r }/ n* L8 F- d# @+ U- y, F& Diqn.2006-01.com.openfiler:racdb.crs1 /dev/sdb( ?* @" t- h# f
iqn.2006-01.com.openfiler:racdb.data1 /dev/sdd+ m5 q( y2 A; z& \$ \' i
iqn.2006-01.com.openfiler:racdb.fra1 /dev/sdc
/ J) a; s$ z& }) R7 X+ z0 C但是,每次重新启动 Oracle RAC 节点时,此映射可能会发生更改。例如,在重新启动后,可能会确定 iSCSI 目标 iqn.2006-01.com.openfiler:racdb.crs1 映射到本地 SCSI 设备 /dev/sdc。因此,依赖于使用本地 SCSI 设备名称是不切实际的,因为在重新启动后无法预测 iSCSI 目标映射。; v2 z7 P6 \" E9 |
我们需要的是一个可供引用的一致设备名称(即 /dev/iscsi/crs1),它在重启后始终指向适当的 iSCSI 目标。这就是名为 udev 的动态设备管理工具的用武之地。udev 使用符号链接提供动态设备目录,这些链接使用一系列可配置规则指向实际设备。当 udev 接收到设备事件(例如,客户端登录到 iSCSI 目标)时,它会将其配置的规则与 sysfs 中提供的可用设备属性进行匹配以识别设备。匹配规则可能会提供额外的设备信息或指定设备节点名称和多个符号链接名称,并指示 udev 运行其他程序(例如 SHELL 脚本)作为设备事件处理过程的一部分。
0 D, F8 I" w/ W6 f* r) d$ { w下一步是创建一个新的规则文件。该文件将被命名为 /etc/udev/rules.d/55-openiscsi.rules 且仅包含一行 name=value 对,用于接收我们感兴趣的事件。它还将定义一个调用 SHELL 脚本 (/etc/udev/scripts/iscsidev.sh) 来处理事件。# Z$ P( Z2 m% t
在两个 Oracle RAC 节点上创建以下规则文件 /etc/udev/rules.d/55-openiscsi.rules:
1 a5 d- C. Y6 N7 e$ e复制
5 Q; s& K9 `9 ~/ e1 YCopied to ClipboardError: Could not Copy4 P+ s% q- g$ ^6 i9 i$ _8 E8 Q
..............................................
4 n9 Z* C6 G' j4 |4 Q) X # /etc/udev/rules.d/55-openiscsi.rules
" H- ]- E* r" ^4 {' n) A KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c/part%n"# e( r: b. R4 U% a. R
.............................................." m# u6 h6 Y, |7 w0 z* @1 R" x
..............................................
7 I* A/ i6 P7 R # /etc/udev/rules.d/55-openiscsi.rules
* \4 {* n/ f, m2 F" w KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c/part%n"7 r! f( N0 k$ g
..............................................8 a4 ?" V( H" ]# F
我们现在需要创建 UNIX SHELL 脚本。当收到此事件时将调用该脚本。让我们首先在两个 Oracle RAC 节点上创建一个单独的目录来存储 udev 脚本:& R" _% y2 L- N9 W2 c
复制
& D3 J5 ]# L2 e( mCopied to ClipboardError: Could not Copy3 k" a9 H/ X* v7 n: W
[root@racnode1 ~]# 3 ~1 t$ ^+ Q; r- s% U
mkdir -p /etc/udev/scripts& W6 L$ d8 D9 Q7 L) }1 g
[root@racnode1 ~]#
1 _* z ?, [1 o" a5 v* q: j mkdir -p /etc/udev/scripts
# G* ~2 n) w' R$ b1 g; W' h, a接下来,在两个 Oracle RAC 节点上创建 UNIX shell 脚本 /etc/udev/scripts/iscsidev.sh:8 p* m8 h+ z0 K& j- \
复制
% H( N( a: v8 _5 s2 Y: S1 O! x1 yCopied to ClipboardError: Could not Copy% U" U1 q2 m& ?0 O' S& E/ f
..............................................
# D1 u3 ?9 h3 G( o #!/bin/sh
" R% m6 l4 K, I6 n1 U
4 V6 G" a; i P; w- t% Q+ K # FILE: /etc/udev/scripts/iscsidev.sh
4 N+ R/ V/ B8 q% O5 h$ l # U! G- |1 m" u8 z. k- d
BUS=${1}0 ?# ~; \- v0 Y1 J- N% t/ e
HOST=${BUS%%:*}) |! d0 x& N, x9 p/ t2 E
7 C" N3 S; P- V! }+ Z4 t3 V -e /sys/class/iscsi_host ] || exit 1
% T, F$ l& u+ e, D5 V4 e
+ Z9 X' A/ T- y% b! ~, U" @5 q6 a file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"
' O& X, E1 O- H% S # }% N' k* G$ D# \: N6 Q
target_name=$(cat ${file})+ I8 }# c( k* P8 @8 C7 y
2 E" D$ a0 H; t6 W5 k6 h # This is not an open-scsi drive
u" N/ z( T% V# X if -z "${target_name}" ]; then2 ?; Q# g- Z7 _7 G3 j0 c S/ P
exit 1
8 Q% A! H9 J: N2 s! U- [: N) ` fi
! c X) d" A( m! q 9 t; h3 g1 q4 k$ u
# Check if QNAP drive
+ ^# o* w7 {- M check_qnap_target_name=${target_name%%:*}1 H& M( a2 U% V% ^) M0 k- G
if $check_qnap_target_name = "iqn.2004-04.com.qnap" ]; then4 u9 q- s8 n- t1 a, G- h; E
target_name=`echo "${target_name%.*}"`
) V) W7 e0 a. q8 R+ @) r fi
- A% D8 p" a9 ] ; H& u2 @- W4 f# s$ T6 s! v8 r6 ]
echo "${target_name##*.}"
0 Y( R$ Z$ p+ e% j1 s" B ..............................................
3 d" C1 h$ ?4 B* }4 r' g..............................................5 B) b/ W7 g5 X2 J' h% r) r
#!/bin/sh: ?. L" j& V( }
" I" h& H2 s2 r6 m" V7 P
# FILE: /etc/udev/scripts/iscsidev.sh2 d. h/ D) s' }/ _! d- L1 j
6 I* L. U& o# t E BUS=${1}
# t$ n, p4 H' b8 ~8 C, \" X( W, [ HOST=${BUS%%:*}4 i" M, K5 t3 a! ^% Z; Q8 @
; o1 O; U3 v( C9 _& [) @& {# W
-e /sys/class/iscsi_host ] || exit 1
# L) r- Q1 ]& Z# |. H1 ^
5 X3 s. ~" W" E file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"
# }9 U* K) P+ ?7 L
! a; \6 w& U0 x. ]/ M& i& \0 b6 P* t' r target_name=$(cat ${file})) S* e5 ^- N: h7 u
1 g, ~1 f w3 l o
# This is not an open-scsi drive
( ]. I, o& n- \& o7 i if -z "${target_name}" ]; then7 ^, _6 {7 [2 A& ?" J- \
exit 1+ O+ K' e6 |+ k5 u/ T: v
fi- q" k3 A4 c+ p
) Z( Y3 c; r. {. Z% R3 h
# Check if QNAP drive! P5 b8 T; n. `9 W8 C
check_qnap_target_name=${target_name%%:*}8 g V8 f% C9 c6 ~$ A
if $check_qnap_target_name = "iqn.2004-04.com.qnap" ]; then! e/ O7 K3 l' W' {( x4 d
target_name=`echo "${target_name%.*}"`" t# X8 Q) T/ f2 m
fi. ^8 l3 T7 k) k/ p( ]8 E- y
% g4 Q" m3 ?$ F6 s% Y echo "${target_name##*.}"
* m- A( O/ S# M) z2 b ..............................................* o, G; H: p' r' ?. e8 b7 X/ Q" W: c
在创建 UNIX SHELL 脚本之后,将其更改为可执行文件:6 Z$ l6 I9 g& E! C+ V: x [
复制4 p4 p( R( [# F2 z# f4 |% P
Copied to ClipboardError: Could not Copy2 e/ Q* e) w/ o; N3 Q
[root@racnode1 ~]# ! G( B" S/ K% s6 v/ |# L @: [# `
chmod 755 /etc/udev/scripts/iscsidev.sh+ s2 s6 K6 v4 u i# s e
[root@racnode1 ~]#
5 F" O6 m% @' N% o chmod 755 /etc/udev/scripts/iscsidev.sh' F/ n( r4 a* \4 Q3 _
现在已经配置了 udev,接下来在两个 Oracle RAC 节点上重新启动 iSCSI 服务:
) f% h: I( w3 Y( a2 K复制
3 ~" A& g7 i; {5 R+ E: ~Copied to ClipboardError: Could not Copy
( c4 f8 s( U: t% V, R9 t0 N[root@racnode1 ~]# 8 |7 e; N& a- i! Y
service iscsi stop
, S: [# G& y/ d Logging out of session [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]7 s# s) H$ ?. q" [+ r) C% Q
Logging out of session [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]
& \8 ?2 e& P" ` r# G* T Logging out of session [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]8 x$ f' Z# p m) m) c
Logout of [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful: w4 Z$ ]7 ?! l# j3 T$ }8 O" z
Logout of [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful+ [1 `: z4 }! h Z
Logout of [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful. _( D+ [& k9 `* }- ~; Z; ?8 H# l
Stopping iSCSI daemon: - s, {! c8 O! q" f4 k
2 M/ M3 C: b' c0 ]9 \) w& c
OK ]6 l( B9 ~; V) K V( t) D4 Y% r1 h0 M
. {2 b H! i4 J6 l9 K [root@racnode1 ~]#
. s4 m7 {2 M( v/ W0 k service iscsi start
0 h, \$ m! q/ Z2 F# g6 M! h iscsid dead but pid file exists
6 N' g! U2 F' v& @/ d Turning off network shutdown. Starting iSCSI daemon:
; L1 C- T1 N5 [2 @
o0 ^/ E: J9 Z3 M: d+ b% a OK ]4 w. Q5 {) s9 s/ w
1 R: q2 I6 E9 w1 v
/ M2 G5 I) c' o3 Q" u% m
OK ]
2 I& D8 l- D4 L' L- \& {3 I( h0 D Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260] W- g3 q9 v& B7 x4 v+ Z
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]
$ `4 g- P; i: u" x Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]
- {- |# x2 A+ A+ R7 q Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful
7 b/ U5 d. y7 l+ w+ Z Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful
' }* z% ~9 D" I w4 _ U! u Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful4 ^* {$ C4 w1 b( L$ l7 y$ B
7 h: H+ ]& u& B4 m* |0 s, H4 s6 _* @ + |+ P# ~' e$ T# k
OK ]3 J+ g' p+ r. Z% k
[root@racnode1 ~]# 1 @5 W" z# m. O8 ^
service iscsi stop& p" N7 W# I: m. N; p! y1 V
Logging out of session [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]
/ N5 k9 y: x7 e( z- U Logging out of session [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]( R. {( k# _4 T8 e. I- f
Logging out of session [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]( f- s t5 B, |" n/ i4 e! b
Logout of [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful
2 E8 @3 R8 n3 G! j2 g0 U5 C Logout of [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful8 F' V; F; K2 \. F0 l! g
Logout of [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful( W* O8 v/ h2 |- \
Stopping iSCSI daemon:
: h9 Y# q. i2 M& C ( P/ Y- ?, w' \. i6 c2 E
OK ]2 g" A, `0 F) k
' l$ {8 S# L7 Z( {1 h [root@racnode1 ~]# 1 S9 N4 [8 O0 Q- ~4 f
service iscsi start
9 L, N& m ]- r9 \3 n# r5 D iscsid dead but pid file exists
% a3 B2 O: k( e Turning off network shutdown. Starting iSCSI daemon:
' t: Q+ q* d, k1 p
+ W! J: ~& d! ]' Y2 d' T* A OK ], j& X, N4 d- p; W% N+ `1 h, x
8 ]6 J% ^* X. A7 ~ / V& h: _5 N4 f0 Q! G
OK ]8 e# `% H+ m" e2 M* t6 ^! n
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]( @& A, {6 z! Z5 g% M6 z F* t2 c; f
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]/ V% m# W4 ?4 _ p
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]
3 V9 z7 u$ q9 Y5 M8 W" t' S Q2 b Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful, s5 `, k8 M) w6 H; i R K! }
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful+ |) v4 _+ k3 U3 \
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful
' u! h6 z, B7 Z7 i - Y! N: o! E6 p( f: g4 m7 u
3 Z( i1 u) u" B0 U a4 |
OK ]
" C' c' r7 E" g/ j% Y我们来看看最终的结果:
# q4 p9 S) G* s, }复制
" L% j/ _1 [7 ^# }0 U- o% }, ?Copied to ClipboardError: Could not Copy
& C6 t4 `' C- I# w, b0 x[root@racnode1 ~]# * L: |/ x6 x9 C1 O
ls -l /dev/iscsi/*
% k+ b1 W1 Y/ {2 B0 E0 { /dev/iscsi/crs1:
4 A8 [2 A ^; Z" Y% u0 j* ~" Z! ]3 S+ K. p total 0
; f" }- d) t! o' { f lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> ../../sdc4 ?; R, d8 N& x; d8 n6 ], F
4 s+ }, B1 A' |; b; x /dev/iscsi/data1:
' y; Z: q+ w& P( {! P total 0
1 w/ _4 J+ K' F/ _, M lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> ../../sde+ G1 Q" F g4 \2 Y
3 O m: q$ g$ F' o! ~- Z R! p1 z, u /dev/iscsi/fra1:
4 K4 D0 b, K- P3 b$ v, D total 0* b2 _! [7 G2 J* ^
lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> ../../sdd
. U3 T) Z% j' F5 F[root@racnode1 ~]#
6 h+ P) N* C$ ?# d! q ls -l /dev/iscsi/*
" D9 [7 g1 ^; D, B; h! i/ b /dev/iscsi/crs1:
, e; Z7 U9 W" ]0 o+ s total 09 T/ J; A# M7 i% ]
lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> ../../sdc: F( g2 Z) U6 O2 e: B8 k! Z
' ?5 c2 z# C+ o /dev/iscsi/data1:
' h$ L$ z6 O ~" Z- Q2 \$ h- l total 0
) ?2 r4 @& r! ]! g; V lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> ../../sde# A" O8 `, Z' I) N! T, L$ m
3 s0 k' Z& G+ _! C& S9 | /dev/iscsi/fra1:
6 G& G; S! w$ Y" [ h% a total 0
5 N( {# l5 I/ o* }0 e# G0 g. n/ L lrwxrwxrwx 1 root root 9 Nov 3 18:13 part -> ../../sdd5 {! \7 q T7 w& I \6 ?
以上清单显示 udev 完成了其应当完成的工作!我们现在拥有了一组一致的本地设备名称,可用于引用 iSCSI 目标。例如,我们可以安全地假定设备名称 /dev/iscsi/crs1/part 将始终引用 iSCSI 目标 iqn.2006-01.com.openfiler:racdb.crs1。我们现在通过一致的 iSCSI 目标名称与本地设备名称相映射,如下表所述:* c0 W* \6 {/ ^* X) L
iSCSI 目标名称到本地设备名称映射
* r& k2 \* W% P8 {6 JiSCSI 目标名称 本地设备名称: ]* _0 ^6 `% T; P, v
iqn.2006-01.com.openfiler:racdb.crs1 /dev/iscsi/crs1/part; v( a8 {* s8 k0 Y& s# O6 v5 j
iqn.2006-01.com.openfiler:racdb.data1 /dev/iscsi/data1/part5 j% A+ @1 E5 [; r) c2 ]
iqn.2006-01.com.openfiler:racdb.fra1 /dev/iscsi/fra1/part
1 v6 E. `3 q$ X$ j& l) w% e) a/ N5 ^在 iSCSI 卷上创建分区! N& ]% b( X' `/ Q
我们现在需要在跨整个卷大小的各个 iSCSI 卷上创建一个主分区。如前所述,我将使用自动存储管理 (ASM) 来存储 Oracle Clusterware 所需的共享文件、物理数据库文件(数据/索引文件、联机重做日志文件和控制文件)以及集群数据库的快速恢复区 (FRA)。
% f$ E, q* ?, d9 r3 o5 a) X4 V( A8 JOracle Clusterware 共享文件(OCR 和表决磁盘)将存储在名为 +CRS 的 ASM 磁盘组中,该磁盘组将配置为外部冗余。集群数据库的物理数据库文件将存储在名为 +RACDB_DATA 的 ASM 磁盘组中,该磁盘组也将配置为外部冗余。最后,快速恢复区(RMAN 备份和归档重做日志文件)将存储在名为 +FRA 的第三个 ASM 磁盘组中,该磁盘组也将配置为外部冗余。
. q/ \. i+ Z! F7 N; Y d0 E) `下表列出了将创建的三个 ASM 磁盘组以及它们将包含哪些 iSCSI 卷:* |2 }. d) ~4 _( Y$ v2 ?
Oracle 共享驱动器配置0 C: r( \2 i) Z. L- A
文件类型 ASM 磁盘组名称 iSCSI 目标(短)名称 ASM 冗余 大小 ASMLib 卷名
0 E9 q$ [0 J) D' {4 n- @OCR 和表决磁盘 +CRS crs1 外部 2GB ORCL:CRSVOL1$ r. G: H9 b! m( e) n8 M
Oracle 数据库文件 +RACDB_DATA data1 外部 32 GB ORCL:DATAVOL1
# Z2 X' f- v( V1 o$ m1 S: e+ DOracle 快速恢复区 +FRA fra1 外部 32 GB ORCL:FRAVOL1) U- n2 [2 K. L; b8 m8 {
如上表所示,我们需要在每一个 iSCSI 卷上都创建一个 Linux 主分区。fdisk 命令在 Linux 中用于创建(和删除)分区。对于每一个 iSCSI 卷,您都可以在创建主分区时使用默认值,因为默认操作是使用整个磁盘。您可以安全地忽略任何可能表明设备不包含有效 DOS 分区(或 Sun、SGI 或 OSF 磁盘标签)的警告。4 O1 T3 R+ b% f% P# P
在本例中,我将从 racnode1 中运行 fdisk 命令,并使用 udev 在上一节中创建的本地设备名称在每一个 iSCSI 目标上创建单一主分区:
r$ b5 Y% ^4 E1 f: h/dev/iscsi/crs1/part
7 z' E2 _# x9 b5 J" F/dev/iscsi/data1/part8 L0 a, T% F/ I W& |9 w9 u
/dev/iscsi/fra1/part2 ]5 T; {# {& ^$ v6 A3 V
注意:在每一个 iSCSI 卷上创建单一分区时,只能从 Oracle RAC 集群中的一个节点运行!(即 racnode1)9 F- p# |- ]. w- p0 S3 f0 W
复制5 B2 V4 |6 O/ ^# i4 d/ K5 [
Copied to ClipboardError: Could not Copy* e* V" {, V7 V+ q5 Q
# ---------------------------------------
4 w, u5 G6 E4 [: e4 ]2 k 4 @. r# g9 p2 e/ D
[root@racnode1 ~]# - G& w! `* g% C& I' Z( x+ P$ k
fdisk /dev/iscsi/crs1/part
+ d7 F m1 Z+ v/ ]1 K- s1 |2 x! R Command (m for help): $ c" s7 U( m) y* [4 @
n9 v( N" J5 o( r4 o4 @- I# `5 e
Command action0 F/ Y( A! b: ?$ W: E5 `7 `, M# z0 h* W
e extended
& u8 X5 H, w4 Z4 O. l2 M p primary partition (1-4)
* h0 `! @3 j4 F0 w, h! O4 {3 X p& S9 l! k$ V; V3 x& m4 a2 O
Partition number (1-4):
% G" R; R( c' v' ?& } 1
* _8 H8 i+ `- `0 ^3 S( X- u3 S K First cylinder (1-1012, default 1): ; {0 p+ |7 E" M2 V( M! y
1 {7 S8 ]' N0 S# m9 A# [
Last cylinder or +size or +sizeM or +sizeK (1-1012, default 1012):
9 g1 ]# h2 i. y; d! C2 u 1012
4 k7 \) F7 g3 p1 q* [+ J' ?% s6 r 7 E. O# t- v6 N+ B$ W
Command (m for help): + N* \; V7 B0 Z# r
p4 [7 j! {4 ?( L+ {( o: ^
, n! p" R( D& g- `! y
Disk /dev/iscsi/crs1/part: 2315 MB, 2315255808 bytes, }8 y/ D/ M& ~2 d0 v
72 heads, 62 sectors/track, 1012 cylinders
$ V% q% H: R7 o0 { Units = cylinders of 4464 * 512 = 2285568 bytes: K2 X* i& c# s& o, K6 y4 H
! |/ N2 p! A0 }
Device Boot Start End Blocks Id System1 W0 ~/ C+ _( }" |* N
/dev/iscsi/crs1/part1 1 1012 2258753 83 Linux! F. V1 ?4 N, K c$ K( a
0 h/ h: g) d0 G- G, g5 C# G Command (m for help):
/ G" v, H% {3 F1 l w" J& V) q8 f3 m' C. y4 D1 f) r9 v! W
The partition table has been altered!
+ z Q6 Z w Q; \, c# [
- `+ r. ^. ?' `. P, X) B) L Calling ioctl() to re-read partition table.
]8 n' B2 x0 b7 P Syncing disks.
d2 O; H( N4 ^
3 x4 ^+ t$ `2 j # ---------------------------------------
6 B, d6 }) U: \% U4 A
* g. _9 v4 v' _1 |% q [root@racnode1 ~]# " C7 ~/ _* _: E3 F
fdisk /dev/iscsi/data1/part
7 j" G# L$ R! I2 v* D Command (m for help):
1 J% M: r5 x0 d' ^ n
5 x/ _- e7 b, r+ y Command action. t& _' C6 S0 C6 h3 N$ V
e extended
/ X4 m, m/ V7 x+ k6 v: J p primary partition (1-4)9 R, j% F' C' D
p
3 b' J$ C. g/ V& H Partition number (1-4):
& ^" j( I; H0 r4 y. A( L 14 z- x/ D: f6 q9 t9 Q- V: }% [
First cylinder (1-33888, default 1): " z$ {. c. r8 o) [( T& a
1
$ |! y% c# E8 I* x5 j* l+ b Last cylinder or +size or +sizeM or +sizeK (1-33888, default 33888):
! M/ n; h6 m0 B% E4 D4 Q 33888! R3 ^- d8 S5 Y5 A& c1 t, M
- B! U/ M/ t8 R6 l9 S
Command (m for help):
6 x7 T9 \2 j5 V p! J# e! z* A$ |( Y8 i6 S
( S& F8 E7 H! H# p$ Y$ C Disk /dev/iscsi/data1/part: 35.5 GB, 35534143488 bytes
9 G0 z8 ^4 D5 W% k 64 heads, 32 sectors/track, 33888 cylinders
- N2 P- p- t5 \! J3 c. n Units = cylinders of 2048 * 512 = 1048576 bytes( y7 y& E$ ]- A) v7 y
/ K* U- l5 \/ u# _" n7 B Device Boot Start End Blocks Id System
' Z# W" I1 c7 A" Z6 G R' D /dev/iscsi/data1/part1 1 33888 34701296 83 Linux
& D' M2 y, K( K
6 e" D1 v; h- @' B, t) ~& I Command (m for help): 1 g! I( {* h, A6 a0 I9 ]6 B& J
w
! k8 ?7 a) ]4 `5 F2 u7 K* E3 F The partition table has been altered!* N8 K( s4 P1 k, h' G
/ F" H+ o3 m+ d6 j* \3 a
Calling ioctl() to re-read partition table.
7 ~- E! J5 x% u& O1 ] Syncing disks.& q6 O- X9 p4 M* b4 n! m0 K) C1 S' p/ x
x9 X: W8 l Q% I4 G % n) _% U# W( e7 r3 u& ~& N* |
# ---------------------------------------
' f b& F3 F3 ^* ?) |8 t- r" @ : a! l% p/ l8 w, y5 ]9 p
[root@racnode1 ~]#
# }: e1 G) P3 d! o# _+ y! W6 j fdisk /dev/iscsi/fra1/part
5 }, l& ^5 l1 H' N4 C! L: o: O Command (m for help): : ], g2 w' z! X; Z. A" t. a3 k
n, o/ q, L6 r) A+ ~+ }$ ?
Command action
0 K/ Y. ^# Y" e e extended
5 ~* ^( X. G7 T, F) e( U) N p primary partition (1-4)
/ J7 d6 p; I& e# U0 M p# P& v0 I5 y1 T
Partition number (1-4): 2 h& a4 t& M F* s
1
& E5 n* X1 G5 x+ P9 K/ O First cylinder (1-33888, default 1):
, m* U% \8 F! D/ w% |6 \) ~ 1' Q( O! X5 Y* W* E! N
Last cylinder or +size or +sizeM or +sizeK (1-33888, default 33888):
# ]/ n# q2 U' ? 33888; E( Y1 V) S# d
) [, |- t8 s( q+ ^) b9 O+ ^# W6 l
Command (m for help): 0 H* O e+ k8 b: B$ {
p
) Q5 ?% b) [- R
4 O4 P# | } D' o& M Disk /dev/iscsi/fra1/part: 35.5 GB, 35534143488 bytes6 ~8 }" ?: W! j+ S0 V N# B
64 heads, 32 sectors/track, 33888 cylinders) I2 `0 R& P" v0 \2 m/ h
Units = cylinders of 2048 * 512 = 1048576 bytes) K: d# r7 {! D! S% M* D) Z& B
! U2 w- y( s! }- y
Device Boot Start End Blocks Id System
& H: J0 o5 V; _# E3 b /dev/iscsi/fra1/part1 1 33888 34701296 83 Linux5 p2 ?) v2 J4 U6 w
6 ~1 t4 _, V4 I* c9 c$ B
Command (m for help): : P. m1 b$ s: a/ f# `
w3 v. g$ h0 A* i
The partition table has been altered!
' K( O/ f( p) ? " H& B1 _2 c& p4 _3 n" B
Calling ioctl() to re-read partition table.3 k" c* ~( o/ |) |! T
Syncing disks./ j: Y: e! ?+ b- R6 o! x1 y
# ---------------------------------------
% e0 c# ~ H6 T+ R1 Q / h+ f6 b1 d& J2 k5 {/ q
[root@racnode1 ~]#
- T2 F; {# \3 |4 i# {* @ fdisk /dev/iscsi/crs1/part2 S8 ~ }" O1 @' S4 L- p+ b
Command (m for help):
& Z6 N* z. m8 \& C) V0 _/ L6 q n
# g- d. e, W& m/ T Command action
G. c% A% P! R/ C* ? e extended
; t) }: l7 N) u9 E) k p primary partition (1-4); ?. A0 c! i- m6 i0 z
p$ E* O+ I5 d( {
Partition number (1-4): : h5 c" R% g0 ~& l* _( V5 a+ `
1
3 f7 K! R" l9 z- u% b5 i, ~ J First cylinder (1-1012, default 1): ; W* W; D5 E, h/ s+ i: T
1- v- t$ Y+ \7 s) D( f0 q* b
Last cylinder or +size or +sizeM or +sizeK (1-1012, default 1012): : U9 \3 ~2 @ r+ T8 F, F
1012! O+ p7 o8 y" A8 l9 K; n" |8 w
6 [) V# ?/ }" W7 C6 K% @5 {# S Command (m for help): g1 ?. w% Q4 o( v
p
( R! G& a2 |+ |
( z# X! _# X4 z; i3 P! z Disk /dev/iscsi/crs1/part: 2315 MB, 2315255808 bytes! R4 V1 J$ q! w6 b$ c) v3 B
72 heads, 62 sectors/track, 1012 cylinders
; Z! K" I; Q# c- y5 @3 ?" l Units = cylinders of 4464 * 512 = 2285568 bytes
8 O* ?* _2 @. P5 U: F3 @5 e" M! u: y 1 [+ X1 W: J) _3 h7 U* O e
Device Boot Start End Blocks Id System5 t$ u& v* Z* k) A5 R
/dev/iscsi/crs1/part1 1 1012 2258753 83 Linux
2 i: Z+ C4 \% |8 h ; F9 L$ Y- L" p' M$ w
Command (m for help):
, U4 F* V3 Z5 X w
8 N1 S8 n6 N) Y8 t. a. ~9 N. o+ R The partition table has been altered!
% x. C: L8 b( |: F; Y. s $ O' @& d& g$ R, [
Calling ioctl() to re-read partition table.
# N* ]! z) c1 F5 f% @. ^; z0 G Syncing disks.
$ u0 G8 A1 U* N% z+ s4 K
" Y, }5 _( ?" @6 Y # ---------------------------------------4 ?$ }8 f" C1 _" u
3 D J; H9 t' T; a [root@racnode1 ~]# % e( p! q/ H& l3 \* }
fdisk /dev/iscsi/data1/part
+ P* t- k2 j: S3 | Command (m for help): , t D p0 E' l$ I' h
n4 T0 E" a: Z, j& T) N+ P5 ?
Command action
0 ^7 D' ~! N4 i- [* Y e extended
3 O9 L' |- C. t4 p. i& o5 ^ p primary partition (1-4)
0 j- ^( w# b9 M p
# s) e; ~- m# C8 [; I [ Partition number (1-4): , W8 v9 [7 ?9 p& {: a. C+ e1 y1 ]! i
1
" J+ R. R% F6 b$ g Y First cylinder (1-33888, default 1): 8 Q+ g9 Q" ~9 u: [2 A2 s/ @- a
1
; g% F& T$ L0 B- S' S, ^0 f Last cylinder or +size or +sizeM or +sizeK (1-33888, default 33888):
7 b' ]; \+ O/ F# D# Q 33888
+ D$ Y8 O4 f, Y' u0 c
- p8 ?# _0 D# p- b: m Command (m for help): + ~+ Q% u, ~: x7 K
p; w7 k' q9 s' ~* H
1 V; q. c W( I Disk /dev/iscsi/data1/part: 35.5 GB, 35534143488 bytes
) ~6 l! n& b4 G3 r6 J. X9 b+ { 64 heads, 32 sectors/track, 33888 cylinders1 I. w6 v4 M2 c
Units = cylinders of 2048 * 512 = 1048576 bytes) ]$ h9 I& E: _' o+ l
7 {, k' h! [/ G9 E Device Boot Start End Blocks Id System
; J: d% O# }. n& F /dev/iscsi/data1/part1 1 33888 34701296 83 Linux/ s4 d& U: Q3 k! I9 f
& o {7 H- r5 E* ? A3 u
Command (m for help):
% F n/ q2 k1 k+ N: |4 h, s: U w
' q7 Z r5 y& y( m1 J The partition table has been altered!
" K3 H; P' @" j2 e: W
1 [" {+ p9 D: N' F1 V, o, K Calling ioctl() to re-read partition table., I. ]. s8 \4 n2 H' P/ N
Syncing disks.
8 i$ s4 a5 V8 [ D3 {
4 y4 \4 M) g+ u" `; f# X/ ?( X, @' b, U% I - u1 ^+ z4 U8 { ]7 y7 a
# ---------------------------------------: @" |/ v" T0 b6 a* `5 G a$ Y
! J1 c6 Z5 S7 o1 y* d. h1 `
[root@racnode1 ~]# / S, C6 y9 k. A( s; I
fdisk /dev/iscsi/fra1/part9 r" L0 D) v( @ z5 }3 \
Command (m for help): 3 a0 P5 W- H1 A- O
n
3 [! X( Q1 L5 i. U Command action
; ]' ]5 `) g" i0 l/ ?( G e extended
) m: ?9 w- U( `) r9 ] p primary partition (1-4)) p- @' J5 f+ d. B w) O O: c
p
% X' u6 e. H5 e, u Partition number (1-4): 2 u6 v9 I) s; S* T
1
) }( x( a3 C1 u, g) i; ] First cylinder (1-33888, default 1): 5 }3 p; G8 \/ w8 }( E I. E
11 n3 a& i5 c% `: D N8 M
Last cylinder or +size or +sizeM or +sizeK (1-33888, default 33888):
( U- A! T* Z* i& a% _ 33888
1 ~3 A6 M8 b* _2 e# Y: t' H/ M
2 c d1 F/ q: [; R; d) e. r Command (m for help):
8 }' q$ W* Q; l1 V6 z p
. b- Q% C$ ^0 H* Z( G. }* G' r4 } & R5 ~, S- {+ d! ]3 l6 D4 b- ~* t
Disk /dev/iscsi/fra1/part: 35.5 GB, 35534143488 bytes+ {( k: o; ?; j% F2 U
64 heads, 32 sectors/track, 33888 cylinders
8 s* l& Z$ L& J; u/ ?7 I3 u$ | Units = cylinders of 2048 * 512 = 1048576 bytes* e9 P& @+ G0 |: T9 P4 Z
& n+ n D2 K0 E, C Device Boot Start End Blocks Id System
j8 K& Y4 Y& y3 X" N8 G /dev/iscsi/fra1/part1 1 33888 34701296 83 Linux9 S$ G$ E' ?# C+ M
- d2 d, V5 [! X Command (m for help):
2 L0 t) P0 h$ ]! l5 d/ q9 l w
G. H! j4 r/ ]' S The partition table has been altered! |+ P! \* M( U/ O
& N; J0 S( I: d. o2 ~9 R
Calling ioctl() to re-read partition table., q1 o0 m* w* _8 V
Syncing disks.7 W/ U. o5 D' _6 I ~
验证新分区$ w, c3 j# G1 \4 e. E% C
从 racnode1 创建所有必需的分区后,您现在应当使用以下命令作为 Oracle RAC 集群 (racnode2) 中所有其余节点的“root”用户帐户,以便于向内核通知分区更改。请注意,从 Openfiler 发现的 iSCSI 目标名称与本地 SCSI 设备名称的映射在两个 Oracle RAC 节点上将有所不同。这不是问题,也不会造成任何问题,因为我们不会使用本地 SCSI 设备名称,而是使用 udev 在上一节中创建的本地设备名称。
0 |: q- Z) ~, s/ z从 racnode2 中,运行以下命令:
0 r* F. `. c. X m0 ]2 h复制. ^. o; Y+ V& g6 f
Copied to ClipboardError: Could not Copy7 C& N+ Z( @! x( N
[root@racnode2 ~]#
: }, B( s! _0 X0 G- ^ partprobe2 i9 K3 D6 d- S n3 `6 ^" P" B( B7 b
( f2 r8 T7 e% X. z7 n [root@racnode2 ~]# : N# P" h- w# u1 u( [
fdisk -l7 C5 S, |4 W3 f5 u! }
7 J' u- x: d+ q5 A
Disk /dev/sda: 160.0 GB, 160000000000 bytes q0 C5 o: M! S2 N
255 heads, 63 sectors/track, 19452 cylinders0 i% q2 q0 `2 [" D- b0 L
Units = cylinders of 16065 * 512 = 8225280 bytes+ k; T6 X9 R! m3 ^& Z3 @
/ O' L1 L7 {7 r5 ^4 S1 O/ a
Device Boot Start End Blocks Id System
& @/ s. z Z0 i; b T* H; t /dev/sda1 * 1 13 104391 83 Linux
/ T/ U S& I7 _2 U4 f) q1 W /dev/sda2 14 19452 156143767+ 8e Linux LVM! X1 l/ B1 k+ Y: q. Q
% w# h7 ?: A/ n! p6 _ Disk /dev/sdb: 35.5 GB, 35534143488 bytes$ W1 N" l( C$ ~, l3 B* w5 I7 g
64 heads, 32 sectors/track, 33888 cylinders/ B/ I- t! W* m! A* g _" U4 r$ ~
Units = cylinders of 2048 * 512 = 1048576 bytes0 B1 U$ ?% b0 ^. F$ S4 p
/ M' J/ y! a8 d; w5 T4 I Device Boot Start End Blocks Id System0 r) }( `1 k4 F
/dev/sdb1 1 33888 34701296 83 Linux3 p; T; o. [& O" H+ y1 @% o
; N/ y8 i$ {6 y4 b( H% @ Disk /dev/sdc: 35.5 GB, 35534143488 bytes1 F( m' X" N9 _( K) x: d" p
64 heads, 32 sectors/track, 33888 cylinders
1 Q/ J3 T& V% P4 G9 `, P Units = cylinders of 2048 * 512 = 1048576 bytes
4 c6 a# @7 x0 }- Z9 C5 L : u* b0 V( D- {6 ~
Device Boot Start End Blocks Id System3 o$ D$ ^9 F4 J8 w7 D( G2 n, Q( i9 W
/dev/sdc1 1 33888 34701296 83 Linux G! [1 f6 Z+ b* h4 L7 N
8 x( {! Q. L2 b6 K! i& E8 M Disk /dev/sdd: 2315 MB, 2315255808 bytes" y5 U- [$ ^% J( M# o7 S
72 heads, 62 sectors/track, 1012 cylinders
" n5 u8 Q4 _! ~+ { Units = cylinders of 4464 * 512 = 2285568 bytes- d1 G7 \3 }* z; Z3 W! y/ @
& I, @: f a6 V7 [- a. h Device Boot Start End Blocks Id System
2 o! }) K) ?5 i' Q /dev/sdd1 1 1012 2258753 83 Linux
+ P' u1 C, j: F# \+ ~4 B3 r7 D: \[root@racnode2 ~]#
3 h) [2 _) V6 v partprobe$ P1 X; }; ^6 |, p
# ~" z- Z P9 |5 X [root@racnode2 ~]#
f( C% W# x" e$ |4 T fdisk -l
! I3 a4 V* J5 n, k+ P6 a: K) ] 2 \+ Y! s5 M8 l) E9 q P
Disk /dev/sda: 160.0 GB, 160000000000 bytes
a7 o7 w9 P0 B) P' q 255 heads, 63 sectors/track, 19452 cylinders
. P! z9 Q6 v9 G Units = cylinders of 16065 * 512 = 8225280 bytes/ |) X: L5 K1 F! U% x9 J3 w5 d
% ~% p. C+ Y, y# C$ _ Device Boot Start End Blocks Id System
; F. n3 N4 w3 ~1 _8 B /dev/sda1 * 1 13 104391 83 Linux5 p2 n; G3 b2 c% ?
/dev/sda2 14 19452 156143767+ 8e Linux LVM _/ w; _# G7 H+ m& J* i# f
# r# e) g. H5 R6 d* s8 e) X+ U Disk /dev/sdb: 35.5 GB, 35534143488 bytes
7 v/ O6 x& c$ m0 b$ k; w 64 heads, 32 sectors/track, 33888 cylinders
+ J# L( w7 t3 t/ t Units = cylinders of 2048 * 512 = 1048576 bytes" E+ ?: b; J% d2 i2 M( g- B
9 F/ S7 S1 W j/ Z
Device Boot Start End Blocks Id System
: m* D$ p+ z% o0 `5 z/ j+ O /dev/sdb1 1 33888 34701296 83 Linux
1 ?, J. s/ P K- }7 f3 i5 z
8 v1 {; f5 [2 g7 F; D: w Disk /dev/sdc: 35.5 GB, 35534143488 bytes
) c% N6 N& q0 |1 s1 r 64 heads, 32 sectors/track, 33888 cylinders' D, Q7 a# i' o
Units = cylinders of 2048 * 512 = 1048576 bytes" N' V- n+ K# J: d
% G% t+ [# m0 C. t5 | Device Boot Start End Blocks Id System: ^* E" A1 [- f/ L# z' \
/dev/sdc1 1 33888 34701296 83 Linux
& J$ ]1 Q, i! ]$ C' e7 B
% s$ N$ E9 z: \1 L; ], J8 V3 M Disk /dev/sdd: 2315 MB, 2315255808 bytes( w0 w" r5 H& Y; r* _
72 heads, 62 sectors/track, 1012 cylinders
4 a9 t/ _& I) Y) @/ B0 j Units = cylinders of 4464 * 512 = 2285568 bytes+ a- K( I; n* j5 m+ Y
( u; k$ X" W- `; W Device Boot Start End Blocks Id System
4 j! q: V) n% p /dev/sdd1 1 1012 2258753 83 Linux, _/ q% i$ z3 {. A3 o
最后一步,您应当在两个 Oracle RAC 节点上运行以下命令以验证 udev 是否为每个新分区创建了新的符号链接:+ p4 k; f- ?6 w+ b* W& ]3 H' B
复制
1 P8 w$ i s/ _( k5 x. T' KCopied to ClipboardError: Could not Copy
- D* |9 d% u: C5 B% C[root@racnode2 ~]#
2 I; X6 s# Q! Q% }1 a& `+ B: v (cd /dev/disk/by-path; ls -l *openfiler* | awk '{FS=" "; print $9 " " $10 " " $11}')3 R+ d+ _' X1 J8 X; J1 T7 j
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.crs1-lun-0 -> ../../sdd" q+ E$ R$ R( t% u" C/ V
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.crs1-lun-0-part1 -> ../../sdd1
& u* ?5 d: ?# y% M ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.data1-lun-0 -> ../../sdc* }: i% F* b5 o, y( X: ]
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.data1-lun-0-part1 -> ../../sdc1
F* X8 r( ] K. l# w ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.fra1-lun-0 -> ../../sdb- u. `7 D! \% v6 x! L- c7 B
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.fra1-lun-0-part1 -> ../../sdb1
3 v7 ^8 `' ?2 f# s! H: L- a: h[root@racnode2 ~]# m' s0 O. P v$ l: _ I4 W
(cd /dev/disk/by-path; ls -l *openfiler* | awk '{FS=" "; print $9 " " $10 " " $11}')' ]! T2 Z& O: n7 k1 @! F
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.crs1-lun-0 -> ../../sdd; E( l2 X" n; `6 \+ H; l
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.crs1-lun-0-part1 -> ../../sdd19 u, g1 d4 ~3 z/ f+ r( l# u
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.data1-lun-0 -> ../../sdc
0 r1 q; \1 Z1 [$ @0 Y, _4 y ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.data1-lun-0-part1 -> ../../sdc1, J; K3 G. q1 P: q
ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.fra1-lun-0 -> ../../sdb
3 J* J$ r" I4 u' E# j2 v- Z( u ip-192.168.2.195:3260-iscsi-iqn.2006-01.com.openfiler:racdb.fra1-lun-0-part1 -> ../../sdb15 e7 `) _, z Q7 {
以上清单显示 udev 确实为每一个新分区创建了新的设备名称。在本指南稍后为 ASMlib 配置卷时,我们将使用这些新设备名称:
$ [" l/ {9 a+ U5 T6 ^4 _. m" n
# |2 e/ n* Z* S. D/ u) l9 d% I/dev/iscsi/crs1/part1
( I% @+ Z8 N# a/dev/iscsi/data1/part11 i+ ?( r3 L. O% c. @+ G2 K
/dev/iscsi/fra1/part11 D* {6 ?: c& \8 [, Q% \. ~; }! r
|
|