- 最后登录
- 2014-5-7
- 在线时间
- 4 小时
- 威望
- -11
- 金钱
- 31
- 注册时间
- 2012-12-3
- 阅读权限
- 0
- 帖子
- 14
- 精华
- 0
- 积分
- -11
- UID
- 718
|
2#
发表于 2012-12-3 19:15:45
chkconfig 配置iscsi随机启动
iscsi 服务端:
ClusterStorage目录下
rpm -ivh perl-Config-General-2.40-1.el5.noarch.rpm
rpm -ivh scsi-target-utils-0.0-5.20080917snap.el5.x86_64.rpm
Server目录下
rpm -ivh iscsi-initiator-utils-6.2.0.871-0.16.el5.i386.rpm
vi /etc/tgt/targets.conf
----------------------------------------
<target iqn.2011-01.com.oracle.blues:luns1>
backing-store /dev/sda9
initiator-address 10.1.1.0/24
</target>
----------------------------------------
vi /etc/udev/scripts/iscsidev.sh
----------------------------------------
#!/bin/bash
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})
if [ -z "${target_name}" ] ; then
exit 1
fi
echo "${target_name##*:}"
----------------------------------------
chmod +x /etc/udev/scripts/iscsidev.sh
chkconfig iscsi on
chkconfig iscsid on
chkconfig tgtd on
service iscsi start
service iscsid start
service tgtd start
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
iscsiadm -m discovery -t sendtargets -p 10.1.1.103
service iscsi start
fdisk -l
重新扫描服务器
iscsiadm -m session -u
iscsiadm -m discovery -t sendtargets -p 10.1.1.103
vi /etc/rc.local
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
service iscsi start
iscsi客户端配置 client : 10.1.1.103
rpm -ivh iscsi-initiator-utils-6.2.0.871-0.16.el5.i386.rpm
vi /etc/udev/rules.d/55-openiscsi.rules
-----------------------------------------------
KERNEL=="sd*",BUS=="scsi",PROGRAM="/etc/udev/scripts/iscsidev.sh %b",SYMLINK+="iscsi/%c"
-----------------------------------------------
vi /etc/udev/scripts/iscsidev.sh
----------------------------------------
#!/bin/bash
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})
if [ -z "${target_name}" ] ; then
exit 1
fi
echo "${target_name##*:}"
----------------------------------------
chmod +x /etc/udev/scripts/iscsidev.sh
service iscsi start
iscsiadm -m discovery -t sendtargets -p 10.1.1.18 -l
service iscsi start
fdisk -l
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
对iscsi共享盘分区:
将iscsi共享分区变为裸设备:
vi /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdb2", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdb3", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdb5", RUN+="/bin/raw /dev/raw/raw4 %N"
KERNEL=="raw[1]", MODE="0660", GROUP="oinstall", OWNER="root"
KERNEL=="raw[2]", MODE="0660", GROUP="oinstall", OWNER="oracle"
KERNEL=="raw[3]", MODE="0660", GROUP="oinstall", OWNER="oracle"
KERNEL=="raw[4]", MODE="0660", GROUP="oinstall", OWNER="oracle"
分别在node1 & node2启动udev:
start_udev
分别在node1 & node2确认裸设备被加载:
[root@stu50 ~]# ll /dev/raw
总计 0
crw-rw---- 1 root oinstall 162, 1 01-11 12:44 raw1
crw-rw---- 1 oracle oinstall 162, 2 01-11 12:44 raw2
crw-rw---- 1 oracle oinstall 162, 3 01-11 12:44 raw3
crw-rw---- 1 oracle oinstall 162, 4 01-11 12:44 raw4 |
|