免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2572 | 回复: 2
打印 上一主题 下一主题

[系统管理] oracle 11g+openfiler+linux 5.4 iscsi设备持久化配置问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-04-22 22:07 |只看该作者 |倒序浏览
主要参考这篇文章做rac 环境
我们需要的是可引用的一致的设备名称(即 /dev/iscsi/crs1),该设备名称在重新引导后将始终指向相应的 iSCSI 目标。这就是引入名为 udev 的动态设备管理 工具的原因。 udev 提供了一个动态设备目录,使用一组可配置的规则通过符号链接指向实际设备。当 udev 收到设备事件(例如,客户端登录到 iSCSI 目标)时,就会根据 sysfs 中提供的可用设备属性匹配其配置好的规则以便识别设备。匹配规则可以提供其他设备信息或指定设备节点名和多个符号链接名,并指示 udev 运行其他程序(例如,一个 SHELL 脚本)作为设备事件处理过程的一部分。
第一步是创建一个新的规则文件。该文件将命名为 /etc/udev/rules.d/55-openiscsi.rules,并且只包含一行用于接收我们感兴趣事件的名称=值对。它还将定义一个调出 SHELL 脚本 (/etc/udev/scripts/iscsidev.sh),用于处理事件。
在两个 Oracle RAC 节点上创建以下规则文件 /etc/udev/rules.d/55-openiscsi.rules:
..............................................
# /etc/udev/rules.d/55-openiscsi.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",
SYMLINK+="iscsi/%c/part%n"
..............................................现在,我们需要创建在接收该事件时将调用的 UNIX SHELL 脚本。我们首先在两个 Oracle RAC 节点上创建一个单独的目录,用于存储 udev 脚本:
[root@racnode1 ~]# mkdir -p /etc/udev/scripts                       接下来,在两个 Oracle RAC 节点上创建 UNIX shell 脚本 /etc/udev/scripts/iscsidev.sh:
..............................................
#!/bin/sh
# FILE: /etc/udev/scripts/iscsidev.sh

BUS=${1}
HOST=${BUS%%:*}
[ -e /sys/class/iscsi_host ] || exit 1
file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/
targetname"
target_name=$(cat ${file})
# This is not an open-scsi drive
if [ -z "${target_name}" ]; then
   exit 1
fi

# Check if QNAP drive
check_qnap_target_name=${target_name%%:*}
if [ $check_qnap_target_name = "iqn.2004-04.com.qnap" ]; then
    target_name=`echo "${target_name%.*}"`
fi

echo "${target_name##*.}"
..............................................
创建 UNIX SHELL 脚本后,将其更改为可执行文件:
[root@racnode1 ~]# chmod 755
既然已经配置了 udev,下面将在两个 Oracle RAC 节点上重新启动 iSCSI 服务:
[root@racnode1 ~]# service iscsi stop Logging out of session [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]
Logging out of session [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]
Logging out of session [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]
Logout of [sid: 6, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful
Logout of [sid: 7, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful
Logout of [sid: 8, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful
Stopping iSCSI daemon:                               [ OK ]

[root@racnode1 ~]# service iscsi start iscsid dead but pid file exists
Turning off network shutdown. Starting iSCSI daemon: [ OK ]
                                                     [ OK ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]
Logging in to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.crs1, portal: 192.168.2.195,3260]: successful
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.fra1, portal: 192.168.2.195,3260]: successful
Login to [iface: default, target: iqn.2006-01.com.openfiler:racdb.data1, portal: 192.168.2.195,3260]: successful [ OK ]
下面,我们来看一下我们的辛勤工作是否得到了回报:
[root@racnode1 ~]# ls -l /dev/iscsi/* /dev/iscsi/crs1:
total 0
lrwxrwxrwx 1 root root 9 Nov  3 18:13 part -< ../../sdc

/dev/iscsi/data1:
total 0
lrwxrwxrwx 1 root root 9 Nov  3 18:13 part -< ../../sde

/dev/iscsi/fra1:
total 0
lrwxrwxrwx 1 root root 9 Nov  3 18:13 part -< ../../sdd

我的系统为redhat 5.4
配置完成后重启iscsi服务后
并未产生效果
系统日志中报错信息为 program '/etc/udev/scripts/iscsidev.sh' failed


之后在另外一台虚拟机上出现同样的问题
[root@orcl scripts]# uname -r
2.6.32-100.34.1.el6uek.i686
[root@orcl scripts]# lsb_release -a
LSB Version:    :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarchrinting-4.0-ia32rinting-4.0-noarch
Distributor ID: OracleServer
Description:    Oracle Linux Server release 6.1
Release:        6.1
Codename:       n/a
[root@orcl scripts]# cat /etc/udev/scripts/iscsidev.sh
BUS=${1}
HOST=${BUS%%:*}
[ -e /sys/class/iscsi_host ] || exit 1
file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"
target_name=$(cat ${file})
# This is not an open-scsi drive
if [ -z "${target_name}" ]; then
   exit 1
fi
echo "${target_name##*.}"

[root@orcl scripts]# cat /etc/udev/rules.d/55-openscsi.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c/part%n"
[root@orcl scripts]# service iscsi stop
Stopping iscsi: [  OK  ]
[root@orcl scripts]# service iscsi start
Starting iscsi: [  OK  ]

关闭和启动的日志
Apr 22 21:28:26 orcl kernel: connection13:0: detected conn error (1020)
Apr 22 21:28:26 orcl kernel: connection15:0: detected conn error (1020)
Apr 22 21:28:26 orcl kernel: connection14:0: detected conn error (1020)
Apr 22 21:28:27 orcl iscsid: Connection13:0 to [target: iqn.2006-01.com.openfiler:san.flasharea, portal: 192.168.0.13,3260] through [iface: default] is shutdown.
Apr 22 21:28:27 orcl iscsid: Connection15:0 to [target: iqn.2006-01.com.openfiler:san.data, portal: 192.168.0.13,3260] through [iface: default] is shutdown.
Apr 22 21:28:27 orcl iscsid: Connection14:0 to [target: iqn.2006-01.com.openfiler:san.crs, portal: 192.168.0.13,3260] through [iface: default] is shutdown.
Apr 22 21:28:42 orcl kernel: scsi18 : iSCSI Initiator over TCP/IP
Apr 22 21:28:42 orcl kernel: scsi19 : iSCSI Initiator over TCP/IP
Apr 22 21:28:42 orcl kernel: scsi20 : iSCSI Initiator over TCP/IP
Apr 22 21:28:42 orcl kernel: scsi 18:0:0:0: Direct-Access     OPNFILER VIRTUAL-DISK     0    PQ: 0 ANSI: 4
Apr 22 21:28:42 orcl kernel: sd 18:0:0:0: Attached scsi generic sg3 type 0
Apr 22 21:28:42 orcl kernel: scsi 20:0:0:0: Direct-Access     OPNFILER VIRTUAL-DISK     0    PQ: 0 ANSI: 4
Apr 22 21:28:42 orcl kernel: scsi 19:0:0:0: Direct-Access     OPNFILER VIRTUAL-DISK     0    PQ: 0 ANSI: 4
Apr 22 21:28:42 orcl kernel: sd 19:0:0:0: Attached scsi generic sg4 type 0
Apr 22 21:28:42 orcl kernel: sd 20:0:0:0: Attached scsi generic sg5 type 0
Apr 22 21:28:42 orcl kernel: sd 18:0:0:0: [sdc] 65536 512-byte logical blocks: (33.5 MB/32.0 MiB)
Apr 22 21:28:42 orcl kernel: sd 18:0:0:0: [sdc] Write Protect is off
Apr 22 21:28:42 orcl kernel: sd 18:0:0:0: [sdc] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
Apr 22 21:28:42 orcl kernel: sd 19:0:0:0: [sde] 65536 512-byte logical blocks: (33.5 MB/32.0 MiB)
Apr 22 21:28:42 orcl kernel: sdc:
Apr 22 21:28:42 orcl kernel: sd 19:0:0:0: [sde] Write Protect is off
Apr 22 21:28:42 orcl kernel: sd 19:0:0:0: [sde] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
Apr 22 21:28:42 orcl kernel: unknown partition table
Apr 22 21:28:42 orcl kernel: sd 20:0:0:0: [sdd] 65536 512-byte logical blocks: (33.5 MB/32.0 MiB)
Apr 22 21:28:42 orcl kernel: sde:
Apr 22 21:28:42 orcl kernel: sd 20:0:0:0: [sdd] Write Protect is off
Apr 22 21:28:42 orcl kernel: unknown partition table
Apr 22 21:28:42 orcl kernel: sd 18:0:0:0: [sdc] Attached SCSI disk
Apr 22 21:28:42 orcl kernel: sd 20:0:0:0: [sdd] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
Apr 22 21:28:42 orcl kernel: sd 19:0:0:0: [sde] Attached SCSI disk
Apr 22 21:28:42 orcl udevd-work[7061]: exec of program '/etc/udev/scripts/iscsidev.sh' failed
Apr 22 21:28:42 orcl udevd-work[7063]: exec of program '/etc/udev/scripts/iscsidev.sh' failed

Apr 22 21:28:42 orcl kernel: sdd: unknown partition table
Apr 22 21:28:42 orcl kernel: sd 20:0:0:0: [sdd] Attached SCSI disk
Apr 22 21:28:42 orcl udevd-work[7064]: exec of program '/etc/udev/scripts/iscsidev.sh' failed
Apr 22 21:28:43 orcl iscsid: Could not set session16 priority. READ/WRITE throughout and latency could be affected.
Apr 22 21:28:43 orcl iscsid: Could not set session17 priority. READ/WRITE throughout and latency could be affected.
Apr 22 21:28:43 orcl iscsid: Could not set session18 priority. READ/WRITE throughout and latency could be affected.
Apr 22 21:28:43 orcl iscsid: Connection16:0 to [target: iqn.2006-01.com.openfiler:san.flasharea, portal: 192.168.0.13,3260] through [iface: default] is operational now
Apr 22 21:28:43 orcl iscsid: Connection17:0 to [target: iqn.2006-01.com.openfiler:san.crs, portal: 192.168.0.13,3260] through [iface: default] is operational now
Apr 22 21:28:43 orcl iscsid: Connection18:0 to [target: iqn.2006-01.com.openfiler:san.data, portal: 192.168.0.13,3260] through [iface: default] is operational now

论坛徽章:
0
2 [报告]
发表于 2013-04-22 22:11 |只看该作者
网上找了各种资料还是不能解决

论坛徽章:
1
双子座
日期:2013-08-15 18:33:16
3 [报告]
发表于 2013-07-29 09:42 |只看该作者
你可以尝试下给shell脚本加入set -x打印出每行执行的结果,这样看看到底哪里出了问题,定位比较容易
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP