ISCSI
来源:互联网 发布:注明的网络写手 编辑:程序博客网 时间:2024/06/04 08:26
ISCSI
1.ISCSI概念
(1)
iSCSI(Internet SCSI)支持从客户端(发起端)通过IP向远程服务器上的SCSI存储设备(目标)发送SCSI命令。iSCSI限定名称用于确定发起端和目标,并采用iqn.yyyy-mm.{reverse domain}:label的格式。默认情况下,网络通信是至iSCSI目标上的端口3260/tcp的明文。
iSCSI发起端:需要访问原始SAN存储的客户端。
iSCSI目标:从iSCSI服务器提供的远程硬盘磁盘,或“目标门户”
iSCSI目标门户:通过网络向发起端提供目标的服务器。
IQN:“iSCSI限定名称”。每个发起端和目标需要唯一名称进行标识,最好的做法是使用一个在Internet上可能独一无二的名称。
(2)
存储I/O接口:SAN:传输数据块 NAS(NFS、HTTP、CIFS) 传输文件
ISCSI协议:
IDE
SATA(最常用)
SAS
存储的传输:
FC
FCOE
ISCISI:支持以太网的数据传输,tcp/ip ip找到原地址
一层层封装:以太网 | ip | tcp | iscsi协议+数据包
ISCSI:
HBA 硬件,不需要客户端安装软件
TOE引擎 需消耗计算机cpu
验证:基于IP 、基于用户
2.ISCSI配置
(1)在服务端的主机上 创建逻辑卷
[root@localhost ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
[root@localhost ~]# partprobe
[root@localhost ~]# pvcreate /dev/vdb1
Physical volume "/dev/vdb1"successfully created
[root@localhost ~]# vgcreate vg0 /dev/vdb1
Volume group "vg0" successfullycreated
[root@localhost ~]# lvcreate -l 249 -n iscsi_storage vg0
Logical volume"iscsi_storage" created
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
iscsi_storage vg0 -wi-a----- 996.00m
(2)配置iscsi服务
服务端:
[root@server179 ~]# yum install targetcli -y
[root@server179 ~]# systemctl enable target
[root@server179 ~]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin.
targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> ls
o- /..............................................................................[...]
o- backstores................................................................... [...]
| o- block....................................................... [Storage Objects:0]
| o- fileio...................................................... [Storage Objects:0]
| o- pscsi....................................................... [Storage Objects:0]
| o- ramdisk..................................................... [Storage Objects:0]
o- iscsi................................................................. [Targets:0]
o- loopback.............................................................. [Targets:0]
/>
/> /backstores/block create server1storage /dev/vg0/iscsi_storage
Created block storage object server1storage using /dev/vg0/iscsi_storage.
/> /iscsi create iqn.2017-06.com.example:strage1
Created target iqn.2017-06.com.example:strage1.
Created TPG 1.
/> ls
o- /..............................................................................[...]
o- backstores................................................................... [...]
| o- block .......................................................[Storage Objects: 1]
| | o- server1storage ......[/dev/vg0/iscsi_storage (996.0MiB) write-thru deactivated]
| o- fileio...................................................... [Storage Objects:0]
| o- pscsi .......................................................[Storage Objects: 0]
| o- ramdisk..................................................... [Storage Objects:0]
o- iscsi................................................................. [Targets:1]
| o- iqn.2017-06.com.example:strage1........................................ [TPGs: 1]
| o- tpg1 ....................................................[no-gen-acls, no-auth]
| o- acls ............................................................... [ACLs:0]
| o- luns ...............................................................[LUNs: 0]
| o- portals .........................................................[Portals: 0]
o- loopback.............................................................. [Targets:0]
/>
/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/luns create/backstores/block/server1stora/>/iscsi/iqn.2017-06.com.example:strage1/tpg1/luns create/backstores/block/server1storage
Created LUN 0.
/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/acls createiqn.2017-06.com.example:server1storagekey
Created Node ACL for iqn.2017-06.com.example:server1storagekey
Created mapped LUN 0.
/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/portals create172.25.254.179
Using default IP port 3260
Created network portal 172.25.254.179:3260.
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
客户端:
[root@localhost ~]# yum install tree -y
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# iscsiadm -m discovery -t st -p 172.25.254.179
172.25.254.103:3260,1 iqn.2017-06.com.example:strage1
[root@localhost ~]# iscsiadm -m node -T iqn.2017-06.com.example:strage1 -p172.25.254.179 -l
Logging in to [iface: default, target: iqn.2017-06.com.example:strage1, portal:172.25.254.179,3260] (multiple)
Login to [iface: default, target: iqn.2017-06.com.example:strage1, portal:172.25.254.179,3260] successful.
[root@localhost ~]# fdisk -l
Disk /dev/vda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00013f3e
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 20970332 10484142+ 83 Linux
Disk /dev/vdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 1044 MB, 1044381696 bytes, 2039808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 4194304 bytes
[root@localhost ~]# tree -C /var/lib/iscsi/
/var/lib/iscsi/
├── ifaces
├── isns
├── nodes
│ └── iqn.2017-06.com.example:strage1
│ └──172.25.254.179,3260,1
│ └── default
├── send_targets
│ └── 172.25.254.179,3260
│ ├── iqn.2017-06.com.example:strage1,172.25.254.179,3260,1,default->/var/lib/iscsi/nodes/iqn.2017-06.com.example:strage1/172.25.254.179,3260,1
│ └── st_config
├── slp
└── static
10 directories, 2 files
[root@localhost ~]#
- iscsi
- iscsi
- iSCSI
- iSCSI
- iSCSI
- iSCSI
- ISCSI
- iSCSI
- iscsi
- iscsi
- iSCSI
- iscsi
- iscsi
- iSCSI
- iSCSI
- ISCSI
- ISCSI
- iscsi
- SearchView
- mybatis异常01
- 【python学习笔记】1.python的安装和配置
- Android 进阶16:IntentService 使用及源码解析
- android studio 友盟多渠道打包
- ISCSI
- LIVE555 利用FIFO实现直播
- 场景转换到想要跳转的界面
- (一)ajax之jQuery.ajax
- C#使用Windows Service 启动和关闭IISExpress
- unix和linux的区别
- OnTouchListener会覆盖OnClickListener
- css文本样式1
- Signal ()函数详细介绍 Linux函数