iSCSI远程块存储
来源:互联网 发布:软件架构师培训 编辑:程序博客网 时间:2024/05/20 17:40
#########################
#######iscsi#############
#########################
1.iscsi是直接对设备进行共享的服务
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.启动iscsi共享设备
1>在server上
建立一个lvm设备
[root@server2 ~]# fdisk /dev/vdb
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): +1000M
Partition 1 of type Linux and of size 1000 MiB is set
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): p
Changed type of partition 'Linux' to 'unknown'
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Empty' to 'Linux LVM'
Command (m for help): p
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 label type: dos
Disk identifier: 0xfee851aa
Device Boot Start End Blocks Id System
/dev/vdb1 2048 2050047 1024000 8e Linux LVM
[root@server2 ~]# partprobe
[root@server2 ~]# pvcreate /dev/vdb1
Physical volume "/dev/vdb1" successfully created
[root@server2 ~]# vgcreate vg0 /dev/vdb1
Volume group "vg0" successfully created
[root@server2 ~]# lvcreate -l 249 -n iscsi_storage vg0
Logical volume "iscsi_storage" created
[root@server2 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert
iscsi_storage vg0 -wi-a----- 996.00m
安装 yum install targetcli -y
[root@server2 ~]# systemctl enable target
[root@server2 ~]# systemctl stop firewalld
[root@server2 ~]# targetcli
/> ls
/> /backstores/block create server1storage /dev/vg0/iscsi_storage ##将/dev/vg0重新命名
/> /iscsi create iqn.2017-06.com.example:strage1
/> ls
/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/luns create /backstores/block/server1storage ##钥匙和设备匹配
/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/acls create iqn.2017-06.com.example:server1storagekey ##创建钥匙
/> /iscsi/iqn.2017-06.com.example:strage1/tpg1/portals create 172.25.2.11 ##开启设备端口
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json ##退出后所做的设定保存在此
2>在deskotp上
[root@desktop2 ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2017-06.com.example:server1storagekey ##添加钥匙
[root@desktop2 ~]# systemctl restart iscsi
[root@desktop2 ~]# fdisk -l
[root@desktop2 ~]# iscsiadm -m discovery -t st -p 172.25.2.11 ##查找
172.25.2.11:3260,1 iqn.2017-06.com.example:strage1
[root@desktop2 ~]# iscsiadm -m node -T iqn.2017-06.com.example:strage1 -p 172.25.2.11 -l ##登陆
Logging in to [iface: default, target: iqn.2017-06.com.example:strage1, portal: 172.25.2.11,3260] (multiple)
Login to [iface: default, target: iqn.2017-06.com.example:strage1, portal: 172.25.2.11,3260] successful.
[root@desktop2 ~]# fdisk -l
Disk /dev/sda: 1044 MB, 1044381696 bytes, 2039808 sectors
[root@desktop2 ~]# fdisk /dev/sda
[root@desktop2 ~]# partprobe
[root@desktop2 ~]# mkfs.xfs /dev/sda1
[root@desktop2 ~]# mount /dev/sda1 /mnt ##实现直接访问服务器存储器
[root@desktop2 ~]# df
[root@desktop2 ~]# yum install tree.x86_64 -y
[root@desktop2 ~]# tree -C /var/lib/iscsi/ ##查看存储信息
3.挂载
[root@desktop2 ~]# blkid
/dev/sda1: UUID="a90b98d2-4ee9-4b49-ab82-b4bf4b3cd673" TYPE="xfs"
[root@desktop2 ~]# vim /etc/fstab
UUID="a90b98d2-4ee9-4b49-ab82-b4bf4b3cd673" /mnt xfs defaults 0 0
[root@desktop2 ~]# mount -a
[root@desktop2 ~]# df
[root@desktop2 ~]# reboot^C
4.删除
[root@desktop2 ~]# umount /mnt
[root@desktop2 ~]# vim /etc/fstab
[root@desktop2 ~]# iscsiadm -m node -T iqn.2017-06.com.example:strage1 -p 172.25.2.11 -u ##登出
[root@desktop2 ~]# iscsiadm -m node -T iqn.2017-06.com.example:strage1 -p 172.25.2.11 -o delete ##删除
[root@server2 ~]# targetcli
/> clearconfig confirm=True
All configuration cleared
/> ls
- iscsi远程块存储
- iscsi远程块存储
- iSCSI远程块存储
- iSCSI远程块存储
- 3-7远程块存储ISCSI
- Blog29@linux iSCSI远程块存储
- ISCSI———— 远程块存储
- 集群基础-----(iscsi远程共享存储)
- Iscsi挂载大容量存储
- 网络存储ISCSI配置
- ISCSI共享存储模拟
- centos7搭建iscsi存储
- Linux7 配置iscsi存储
- 存储技术与iSCSI
- ISCSI网络存储服务器
- Iscsi实现共享存储
- ISCSI网络存储服务
- iSCSI存储技术全攻略
- HTTP协议及过程描述
- 如何在FPGA中利用Verilog实现任意倍的奇数分频
- 【C++】学习笔记四十四——单独编译
- 【Codeforces 814 C. An impassioned circulation of affection】+ 尺取法
- 第十六周:(Sicily) Huffman Coding V1(c++)
- iSCSI远程块存储
- Spring注解配置全局自定义@Transactional 属性
- ThinkPHP5学习(12)模型和关联
- cv2.error: The node does not represent a user object (unknown type?) python+opencv
- HTML学习笔记day one
- 分散读取以及聚集写入
- android dagger2搭建mvp架构
- 网络框架解析
- synchronized关键字实现同步