iSCSI是internet Small Computer System Interface的缩写,又称为IP-SAN,是一种基于因特网及SCSI-3协议下的存储技术,由IETF提出,并于2003年2月11日成为正式的标准。
iSCSI的目的是为了用IP协议将存储设备连接在一起。通过在IP网上传送SCSI命令和数据,iSCSI推动了数据在网络之间的传递,同时也促进了数据的远距离管理。由于其出色的数据传输能力,iSCSI协议被认为是促进存储区域网(SAN)市场快速发展的关键因素之一。因为IP网络的广泛应用,iSCSI能够在LAN、WAN甚至Internet上进行数据传送,使得数据的存储不再受地域的现在。iSCSI技术的核心是在TCP/IP网络上传输SCSI协议,即使用TCP/IP报文和iSCSI报文封装SCSI报文,使得SCSI命令和数据可以在普通以太网络上进行传输,如下图所示。
iSCSI的工作过程:当iSCSI主机应用程序发出数据读写请求后,操作系统会生成一个相应的SCSI命令,该SCSI命令在iSCSI initiator层被封装成ISCSI消息包并通过TCP/IP传送到设备侧,设备侧的iSCSI target层会解开iSCSI消息包,得到SCSI命令的内容,然后传送给SCSI设备执行;设备执行SCSI命令后的响应,在经过设备侧iSCSI target层时被封装成ISCSI响应PDU,通过TCP/IP网络传送给主机的ISCSI initiator层,iSCSI initiator会从ISCSI响应PDU里解析出SCSI响应并传送给操作系统,操作系统再响应给应用程序。
iet(iSCSI Enterprise Target)是Linux下的iSCSI Target实现,open-iscsi是Linux下的iscsi initiator实现,使用iet(官方网站:http://iscsitarget.sourceforge.net)和open-iscsi就可以方便的实现简单的IPSAN,同时iet也可以和其他系统的iscsi initiator配合使用。
一、iet安装
1、下载iet。
srv10:~# wget http://sourceforge.net/projects/iscsitarget/files/iscsitarget/1.4.20.2/iscsitarget-1.4.20.2.tar.gz/download
3、 使用如下命令解压并编译安装iet。
srv10:~#tar -xzvf iscsitarget-1.4.20.2.tar.gz
srv10:~#cd iscsitarget-1.4.20.2
srv10:~#make && make install
二、iet基本配置
iet主要包括以下配置文件(控制文件的优先级类似与tcp_wrappers)。
/etc/iet/ietd.conf :iet的主配置文件
/etc/iet/initiators.allow:控制initiator对target的访问权限。
/etc/iet/initiators.deny:控制initiator对target的访问权限。
/etc/iet/targets.allow:控制不同target的被访问权限。
通过iet实现iSCSI Target的基本功能需要完成以下二个配置
iSCSI Target的命名,命名在同一子网内应该是唯一。在/etc/iet/ietd.conf文件中增加如下内容实现iSCSI Target命名。
Target target名称
其中:
target 名称:是iSCSI Target名称。一般iSCSI Target命名采用“iqn.yyyy-mm.<reversed domain name>: identifier 识别代号”的格式。
将块设备、文件、LVM卷、RAID卷作为块设备映射给iSCSI initiator使用。在/etc/iet/ietd.conf文件中增加如下内容实现块设备映射。
Lun <lunID> Path=<device>,Type=fileio|blockio[,IOMode=(wb|ro)]
其中:
<lunID>:是Lun的编号从0开始,最大2^14-1。
Path=<device>:指定块设备。可以使用dd命令生成一个文件。
Type=fileio|blockio:指定块设备类型,分区及dd命令生成的文件使用fileio类型;LVM卷、RAID卷使用blockio类型。
IOMode=(wb|ro):指定iSCSI initiator允许的操作,wb表示可读写;ro表示只读。
将如下内容加入/etc/iet/ietd.conf文件后,通过重新启动计算机再运行/etc/init.d/iscsi-target restart命令(不知什么原因,修改/etc/iet/ietd.conf文件后必须重新启动计算机)启动iet后iSCSI initiator即可使用。
Target iqn.2011-02.zqin.example:storage.lun0
Lun 0 Path=/dev/sdb1,Type=fileio
Alias lun0
三、iet其它配置
使用命令方式配置iSCSI Target
通过命令方式配置的iSCSI Target在重启后会失效。
1、 添加一个新的Target。其中[id]为数字必须是唯一的,后面的Name需要自定义,也需要保证是唯一的。
srv10:~#ietadm --op new --tid=[id] --params Name=iqn.zqin.example
2、 添加一个新的 lun。其中[id] 必须是一个已经存在的 tid 号, [lun] 从0开始。
srv10:~#ietadm --op new --tid=[id] --lun=[lun] --params Path=/path/exported/file,Type=fileio
四、iet常用命令
1、 查看当前iSCSI Target清单。
srv10:~#cat /proc/net/iet/volume
2、 查看当前服务器iSCSI Target服务以及连接状态命令
srv10:~#cat /proc/net/iet/sessions
3、 停止某个Target 的某个 Connection 的连接。
srv10:~#ietadm --op delete --tid=2 --sid=562950876233792 --cid=1 && ietadm --op delete --tid=2
4、 停止所有Target 的连接。
srv10:~#ietadm --op delete
5、 删除某个Target (已经没有 Session 连接的)。
srv10:~#ietadm --op delete --tid= 1
五、iSCSI initiator配置
(一)Linux客户端
1、 使用如下命令安装Open iSCSI/iscsi-initiator-utils-6.2.0.872-6.el5.i386。
srv10:~# apt-get install open-iscsi
or
srv10:~# yum install iscsi-initiator-utils*
包含(iscsiadm iscsid iscsi-iname iscsistart )
2、 查找(discovery)指定IP下的Target。
srv10:~#iscsiadm -m discovery -t st -p 192.168.159.74
3、 执行以下命令登陆iSCSI Target。
srv10:~#iscsiadm -m node -T iqn.2011-02.zqin.example:storage.lun0 -l
(二)Windows客户端
目前微软最新的服务器端操作系统Windows Server 2008已经支持iSCSI群集(Windows Vista/7也支持iSCSI),这样好处是不言而喻,相比昂贵的SAN而言iSCSI更加的廉价,性能也可以接受。对于预算紧张又希望应用高可用的用户来说是个很好的选择。在Windows 7中连接到一个iSCSITarget操作步骤如下。
1、 打开“管理工具”→“iSCSI 发起程序”。
2、 打开“目标”选项页后,在“目标”中输入iSCSI Target所在主机的IP地址,单击“快速连接”。
3、 在计算机磁盘管理器中会出现一上新的硬盘就是iSCSI Target。格式化后即可像本机物理磁盘一样使用。

[root@localhost iet]# ietadm --help
Usage: ietadm [OPTION]
iSCSI Enterprise Target Administration Utility.
--op new --tid=[id] --params Name=[name]
add a new target with [id]. [id] must not be zero.
--op delete --tid=[id]
delete specific target with [id]. The target must
have no active sessions.
--op show --tid=[id]
show target parameters of target with [id].
--op show --tid=[id] --sid=[sid]
show iSCSI parameters in effect for session [sid]. If
[sid] is "0" (zero), the configured parameters
will be displayed.
--op show --tid=[id] --user
show list of Discovery (--tid omitted / id=0 (zero))
or target CHAP accounts.
--op show --tid=[id] --user --params=[user]=[name]
show CHAP account information. [user] can be
"IncomingUser" or "OutgoingUser". If --tid is
omitted / id=0 (zero), [user] is treated as Discovery
user.
--op new --tid=[id] --lun=[lun] --params Path=[path]
add a new logical unit with [lun] to specific
target with [id]. The logical unit is offered
to the initiators. [path] must be block device files
(including LVM and RAID devices) or regular files.
--op delete --tid=[id] --lun=[lun]
delete specific logical unit with [lun] that
the target with [id] has.
--op delete --tid=[id] --sid=[sid] --cid=[cid]
delete specific connection with [cid] in a session
with [sid] that the target with [id] has.
If the session has no connections after
the operation, the session will be deleted
automatically.
--op delete stop all activity.
--op update --tid=[id] --params=key1=value1,key2=value2,...
change iSCSI IET target parameters of specific
target with [id]. You can use parameters in ietd.conf
as a key.
--op new --tid=[id] --user --params=[user]=[name],Password=[pass]
add a new account with [pass] for specific target.
[user] could be [IncomingUser] or [OutgoingUser].
If you don't specify a target (omit --tid option),
you add a new account for discovery sessions.
--op delete --tid=[id] --user --params=[user]=[name]
delete specific account having [name] of specific
target. [user] could be [IncomingUser] or
[OutgoingUser].
If you don't specify a target (omit --tid option),
you delete the account for discovery sessions.
--op update --tid=[id] --redirect=[dest]
redirect login to target with tid [id] to portal
[dest]. Discovery sessions will not be impacted,
but normal sessions will be redirected before
security negotiation. The destination should be
specified using the format:
<ip_addr>[:port]
IPv6 addresses need to be enclosed in [] brackets
To clear, provide an empty string
--version display version and exit
--help display this help and exit
Report bugs to <iscsitarget-devel@sourceforge.net>.
本日志由 flyinweb 于 2011-05-27 17:29:56 发表,目前已经被浏览 1972 次,评论 0 次;
作者添加了以下标签: ISCSI,IET,iscsi-target;
引用通告:http://www.517sou.net/Article/611/Trackback.ashx
而且直接配置文件是效率最高的,通过其它驱动效率都相对较低,BDB
这个测试不太准确,看官方的测试结果:http://bind-dlz.sourceforg
为什么使用BDB时QPS这么低? 我在bind版本基本相似的环境中测试的
It is quite useful and interesting too.
VIRT 的上限是64G,也就是36位, cat /proc/cpuinfo的结果是:addre
昨天要准备用线程重写webbench,试验了下Fedora Linux 2.6.35.14
不明白您的具体的意思是什么?
已经发送到你QQ邮箱