RHEL7部署ISCSI SERVER,作为共享存储使用。
装包(yum源已提前配置好)
[root@host1 ~]# yum install targetcli -y
新建分区(新建/dev/sdb1分区,大小为10G)
[root@host1 ~]# fdisk /dev/sdb
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.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xb1af1bb0.
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): 1
First sector (2048-209715199, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): +10G
Partition 1 of type Linux and of size 10 GiB is set
Command (m for help): W
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
创建block设备
[root@host1 ~]# targetcli
/> cd backstores/block
/backstores/block> create iscsidisk1 /dev/sdb1
Created block storage object iscsidisk1 using /dev/sdb1.
配置iqn
/backstores/block> cd /
/> cd iscsi/
/iscsi> create ***.***.ntae007:disk1
Created target ***.***.ntae007:disk1.
配置acl
配置允许哪些initiator端访问,本例允许2个节点的访问。
/iscsi> cd ***.***.ntae007:disk1/tpg1/acls
/iscsi/iqn.20...sk1/tpg1/acls> create ***.***.ntae007:cvk01
Created Node ACL for ***.***.ntae007:cvk01
/iscsi/iqn.20...sk1/tpg1/acls> create ***.***.ntae007:cvk02
Created Node ACL for ***.***.ntae007:cvk02
配置lun
/iscsi/iqn.20...sk1/tpg1/acls> cd /
/> cd iscsi/***.***.ntae007:disk1/tpg1/luns
/iscsi/iqn.20...sk1/tpg1/luns> create /backstores/block/iscsidisk1
Created LUN 0.
Created LUN 0->0 mapping in node ACL ***.***.ntae007:cvk02
Created LUN 0->0 mapping in node ACL ***.***.ntae007:cvk01
配置portal(先删除0.0.0.0,使其只在指定地址192.168.1.12监听3260端口)
/iscsi/iqn.20...sk1/tpg1/luns>cd /
/> cd /iscsi/***.***.ntae007:disk1/tpg1/portals/
/iscsi/iqn.20.../tpg1/portals> delete 0.0.0.0 3260
Deleted network portal 0.0.0.0:3260
/iscsi/iqn.20.../tpg1/portals> create 192.168.1.12 3260
Using default IP port 3260
Created network portal 192.168.1.12:3260.
保存配置
/iscsi/iqn.20.../tpg1/portals> cd /
/> saveconfig
/> exit
启动服务
[root@host1 ~]# systemctl start target
[root@host1 ~]# systemctl enable target
打开防火墙
[root@host1 ~]# firewall-cmd --permanent --add-service=mysql
[root@host1 ~]# firewall-cmd --reload
检查服务
[root@host1 ~]# netstat -antup | grep 3260
tcp 0 0 192.168.1.12:3260 0.0.0.0:* LISTEN -
1、
2、
该案例暂时没有网友评论
✖
案例意见反馈
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作