ISCSI共享存储

ISCSI网络磁盘    默认端口:3260

 

服务端:

一.

二.安装软件:targetcli

用命令targetcli进行配置------------------------进入iscsi磁盘配置模式

  1.建立backstore后端存储

    >>>  backstores/block create  name=nsd  dev=/dev/vdb1
    >>>  ls
  2.建立target磁盘组(iqn.yyyy-mm.倒叙域名:自定义标示)

    >>>  iscsi/ create iqn.2018-11.com.example:server0

    >>>  ls

  3.配置lun关联

    >>>  iscsi/iqn.2018-11.com.example:server0/tpg1/luns create /backstores/block/nsd

    >>>  ls

  4.配置访问控制:设置客户端声称的名字

    >>>  iscsi/iqn.2018-11.com.example:server0/tpg1/acls create iqn.2018-11.com.example:desktop0

  5.启用ip地址与端口

    >>>  iscsi/iqn.2018-11.com.example.server0/tpg1/portals create 172.25.0.11

三.重启服务:

  systemctl restart target

  systemctl enable target

 

yum -y install targetcli
[root@server0 ~]# 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 name=nsd dev=/dev/vdb1
Created block storage object nsd using /dev/vdb1.
/> iscsi/ create iqn.2018-11.com.example:server0
Created target iqn.2018-11.com.example:server0.
Created TPG 1.
/> iscsi/iqn.2018-11.com.example:server0/tpg1/luns create /backstores/block/nsd 
Created LUN 0.
/> iscsi/iqn.2018-11.com.example:server0/tpg1/acls create iqn.2018-11.com.example:desktop0
Created Node ACL for iqn.2018-11.com.example:desktop0
Created mapped LUN 0.
/> iscsi/iqn.2018-11.com.example:server0/tpg1/portals create 172.25.0.11
Using default IP port 3260
Created network portal 172.25.0.11:3260.
/> 
[root@server0 ~]# systemctl restart target
[root@server0 ~]# systemctl enable target

 

客户端:

1.安装iscsi-initiator-utils,访问共享存储服务

2.配合客户端声称的名字 /etc/iscsi/initiatorname.iscsi

  initiatorName=iqn.2018-11.com.example:desktop0 

  

vim /etc/iscsi/initiatorname.iscsi 
InitiatorName=iqn.2018-11.com.example:desktop0

 

3.重启服务,刷新客户端声称的名字

  systemctl restart iscsid

systemctl restart iscsid

 

4.运行命令,发现共享存储

iscsiadm --mode discoverydb --type sendtargets --portal 172.25.0.11 --discover

5.重启服务iscsi服务,使用共享存储

  systemctl restart iscsi

  systemctl enable iscsi 

  lsblk

posted @ 2018-11-13 11:56  Ray_chen  阅读(1048)  评论(0编辑  收藏  举报