iscsi

来源:互联网 发布:python count函数 编辑:程序博客网 时间:2024/06/05 21:54
iSCSI(Internet SCSI)支持从客户端(发起端)通过IP向远程服务器上的
SCSI存储设备(目标)发送SCSI命令。iSCSI限定名称用于确定发起端和目
标,并采用iqn.yyyy-mm.{reverse domain}:label的格式。默认情况下,网络
通信是至iSCSI目标上的端口3260/tcp的明文。
 iSCSI发起端:需要访问原始SAN存储的客户端。
 iSCSI目标:从iSCSI服务器提供的远程硬盘磁盘,或“目标门户”
iSCSI目标门户:通过网络向发起端提供目标的服务器。

IQN:“iSCSI限定名称”。每个发起端和目标需要唯一名称进行标识,

最好的做法是使用一个在Internet上可能独一无二的名称。


在server上:

实验前先划分一个lvm分区

安装服务并开启: yum install targetcli

systemctl enable target


targetcli


/> backstores/block create sever1storage /dev/vg0/iscsi_storage  ##创建一个设备

Created block storage object sever1storage using /dev/vg0/iscsi_storage.


/> /iscsi create iqn.2017-06.com.example:strage1     ##创建一个target

Created target iqn.2017-06.com.example:strage1.

Created TPG 1.


/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/luns create /backstores/block/sever1storage

Created LUN 0.   ##创建逻辑单元号


/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/acls create iqn.2017-06.com.example:sever1storagekey

Created Node ACL for iqn.2017-06.com.example:sever1storagekey  ##创建访问控制列表

Created mapped LUN 0


/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/portals create 172.25.254.128   ##使用128主                                                     机的3260端口

Useing defaults IP port 3260

Creata network portal 172.25.254.128:3260

在desktop上:

[root@desktop44 ~]# vim /etc/iscsi/initiatorname.iscsi 

InitiatorName=iqn.2017-06.com.example:server1storagekey    ##key为server的key


[root@desktop44 ~]# iscsiadm -m discovery -t st -p 172.25.254.128       ##查找iSCSI服务器所提供的iSCSI目标
[root@desktop44 ~]# iscsiadm -m node -T iqn.2017-06.com.example:strage1 -p 172.25.254.128 -l    ##登录服务器上的iscsi目标

[root@desktop ~]# yum install tree -y

测试:

fdisk -l



删除:

desktop:

[root@desktop ~]# iscsiadm -m node -T iqn.2017-06.com.example:strage1 -p 172.25.254.128 -u       ## 登出iSCSI目标,以暂时断开连接
iscsiadm: No matching sessions found
[root@desktop ~]# iscsiadm -m node -T iqn.2017-06.com.example:strage1 -p 172.25.254.128 -o delete    ## 删除iSCSI目标的本地记录,以永久断开连接

server:

/> clearconfig confirm=True
All configuration cleared
/> exit

原创粉丝点击