《2022年rhel.搭建iscsi-target服务器实战 .pdf》由会员分享,可在线阅读,更多相关《2022年rhel.搭建iscsi-target服务器实战 .pdf(7页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、rhel6.3搭建 iscsi-target服务器实战iSCSI 技术是一种由IBM 公司研究开发的,是一个供硬件设备使用的可以在IP 协议的上层运行的 SCSI 指令集,这种指令集合可以实现在IP 网络上运行SCSI 协议,使其能够在诸如高速千兆以太网上进行路由选择。iSCSI 的最大好处是能提供快速的网络环境,虽然其性能和带宽跟光纤网络还有一些差距,但能节省企业约30-40%的成本。下面我们来看一下在RHEL6.3 上如何搭建iscsi-target服务器和客户端如何挂载.一、服务端操作服务端版本:rootracscsi home#uname -r 2.6.32-279.el6.x86_6
2、4 rootracscsi home#cat/etc/redhat-release Red Hat Enterprise Linux Server release 6.3(Santiago)安装 iscsi server软件包。用 RPM 的方式安装。rootracscsi home#rpm-ivh scsi-target-utils-1.0.24-2.el6.x86_64.rpm warning:scsi-target-utils-1.0.24-2.el6.x86_64.rpm:Header V3 RSA/SHA256 Signature,key ID fd431d51:NOKEY Prep
3、aring.#100%package scsi-target-utils-1.0.24-2.el6.x86_64 is already installed 用 yum命令安装(需自己配置YUM 源)rootracscsi home#yum-y install scsi-target-utils 启动服务并且添加到开机自启动。rootracscsi home#/etc/init.d/tgtd start Starting SCSI target daemon:OK rootracscsi home#chkconfig tgtd on 使用 fdisk命令创建几个分区,或者通过外部存储映射共享分区
4、。现在这台服务器已划分好/dev/sdb、/dev/sdc、/dev/sdd、/dev/sde、/dev/sdf、/dev/sdg、/dev/sdh、/dev/sdi分区,用于客户端的挂载下面我们需要编辑配置文件/etc/tgt/targets.conf,并设置下iSCSI Qualified Name(IQN).rootracscsi home#vim/etc/tgt/targets.conf 名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 7 页 -在文件末尾添加如下内容#iqn名字可任意 backing-store/dev/sdb backing-store/dev/sdc
5、 backing-store/dev/sdd backing-store/dev/sde backing-store/dev/sdf backing-store/dev/sdg backing-store/dev/sdh backing-store/dev/sdi initiator-address 192.168.10.0/24#限定允许访问的客户端地址段或具体IP write-cache off#是否开启或关闭快取 重启服务,使修改后的配置生效。rootracscsi home#/etc/init.d/tgtd restart 确定 iscsi server是否成功。如果显示如下说明配置i
6、scsi server已经成功。rootracscsi home#tgt-admin-show Target 1:iqn.2008-.example:asm System information:Driver:iscsi State:ready I_T nexus information:I_T nexus:1 Initiator:iqn.1994-.redhat:b363811441a Connection:0 IP Address:192.168.10.212 LUN information:LUN:0 Type:controller SCSI ID:IET 00010000 SCSI S
7、N:beaf10 Size:0 MB,Block size:1 Online:Yes 名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 7 页 -Removable media:No Prevent removal:No Readonly:No Backing store type:null Backing store path:None Backing store flags:LUN:1 Type:disk SCSI ID:IET 00010001 SCSI SN:beaf11 Size:2147 MB,Block size:512 Online:Yes Removable me
8、dia:No Prevent removal:No Readonly:No Backing store type:rdwr Backing store path:/dev/sdb Backing store flags:。#中间内容省略 LUN:8 Type:disk SCSI ID:IET 00010008 SCSI SN:beaf18 Size:5369 MB,Block size:512 Online:Yes Removable media:No Prevent removal:No Readonly:No Backing store type:rdwr Backing store pa
9、th:/dev/sdi Backing store flags:Account information:ACL information:名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 7 页 -192.168.10.0/24 注意:关闭服务端的IPTABLES,以免客户端无法正常访问二、客户端挂载客户端需安装的包iscsi-initiator-utils rootrac2 home#rpm-ivh iscsi-initiator-utils-6.2.0.872-41.el6.x86_64.rpm warning:iscsi-initiator-utils-6.2.0.872-41
10、.el6.x86_64.rpm:Header V3 RSA/SHA256 Signature,key ID fd431d51:NOKEY Preparing.#100%1:iscsi-initiator-utils#100%用 yum命令安装(需自己配置YUM 源)rootrac2 home#yum-y install iscsi-initiator-utils 启动服务并且添加到开机启动。rootrac2 Desktop#/etc/init.d/iscsid start rootrac2 Desktop#chkconfig iscsid on 发现服务器端iscsi server的共享分区。
11、rootrac2 Desktop#iscsiadm-mode discovery-type sendtargets-portal 192.168.10.220 192.168.10.220:3260,1 iqn.2008-.example:asm 已发现登陆到 iscsi server共享的分区。rootrac2 Desktop#iscsiadm-m node-T iqn.2008-.example:asm-p 192.168.10.220-l Logging in to iface:default,target:iqn.2008-.example:asm,portal:192.168.10.
12、220,3260(multiple)Login to iface:default,target:iqn.2008-.example:asm,portal:192.168.10.220,3260 successful.再使用 fdisk-l命令查看分区,发现共享出来的分区都已经挂过来了。rootrac2 Desktop#fdisk-l 名师资料总结-精品资料欢迎下载-名师精心整理-第 4 页,共 7 页 -Disk/dev/sda:21.5 GB,21474836480 bytes 255 heads,63 sectors/track,2610 cylinders Units=cylinders
13、 of 16065*512=8225280 bytes Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x000586f0 Device Boot Start End Blocks Id System/dev/sda1 *1 39 307200 83 Linux Partition 1 does not end on cylinder boundary./dev/sda2 39 549 4096000 82 Linu
14、x swap/Solaris Partition 2 does not end on cylinder boundary./dev/sda3 549 2611 16567296 83 Linux Disk/dev/sdb:2147 MB,2147483648 bytes 67 heads,62 sectors/track,1009 cylinders Units=cylinders of 4154*512=2126848 bytes Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 b
15、ytes/512 bytes Disk identifier:0 x00000000 Disk/dev/sdc:2147 MB,2147483648 bytes 67 heads,62 sectors/track,1009 cylinders Units=cylinders of 4154*512=2126848 bytes Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x00000000 Disk/dev/sdd
16、:2147 MB,2147483648 bytes 67 heads,62 sectors/track,1009 cylinders Units=cylinders of 4154*512=2126848 bytes 名师资料总结-精品资料欢迎下载-名师精心整理-第 5 页,共 7 页 -Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x00000000 Disk/dev/sde:10.7 GB,1073741824
17、0 bytes 64 heads,32 sectors/track,10240 cylinders Units=cylinders of 2048*512=1048576 bytes Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x00000000 Disk/dev/sdf:10.7 GB,10737418240 bytes 64 heads,32 sectors/track,10240 cylinders Uni
18、ts=cylinders of 2048*512=1048576 bytes Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x00000000 Disk/dev/sdg:10.7 GB,10737418240 bytes 64 heads,32 sectors/track,10240 cylinders Units=cylinders of 2048*512=1048576 bytes Sector size(lo
19、gical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x00000000 Disk/dev/sdh:5368 MB,5368709120 bytes 166 heads,62 sectors/track,1018 cylinders Units=cylinders of 10292*512=5269504 bytes Sector size(logical/physical):512 bytes/512 bytes 名师资料总结-精品资料欢迎下载-名
20、师精心整理-第 6 页,共 7 页 -I/O size(minimum/optimal):512 bytes/512 bytes Disk identifier:0 x00000000 Disk/dev/sdi:5368 MB,5368709120 bytes 166 heads,62 sectors/track,1018 cylinders Units=cylinders of 10292*512=5269504 bytes Sector size(logical/physical):512 bytes/512 bytes I/O size(minimum/optimal):512 byte
21、s/512 bytes Disk identifier:0 x00000000 最后你可以格式化分区,挂载在本地相应目录。如果要实现开机自动挂载,要在 fstab文件添加记录。注意添加 _netdev 参数,要不你在重启iscsi server后,启动时会报错。示例:/dev/sdb/crs ext4 default,_netdev 0 0 补充:如果在服务端/etc/tgt/targets.conf文件配置了用户名密码,比如 backing-store /dev/sdb initiator-address 192.168.10.0/24 incoming grid 123passwd write-cacheoff 则在客户端/etc/iscsi/iscsid.conf配置文件需要添加相应的账号和密码node.session.auth.username=grid node.session.auth.password=123passwd discovery.sendtargets.auth.username=grid discovery.sendtargets.auth.password=123passwd 名师资料总结-精品资料欢迎下载-名师精心整理-第 7 页,共 7 页 -