[RHEL 7]ISCSI服务端及客户端连接配置
Posted 飘飘的摇摇
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[RHEL 7]ISCSI服务端及客户端连接配置相关的知识,希望对你有一定的参考价值。
网卡eth0 10.0.0.1
添加一块100GB硬盘,配置成DATAVG,划分LV并发布成iscsi硬盘
#yum install targetd targetcli -y
firewall-cmd --permanent --add-port=3260/tcp
p查看->n新建->p主分区->1分区1->回车默认起始扇区->回车默认使用全部大小
t选择分区类型->L列出所有类型->8e设定为Linux LVM->w写入磁盘
# vgcreate vgiscsi00 /dev/sdb1
# lvcreate -n lv_5G_00 -L 5G vgiscsi00
# lvcreate -n lv_5G_01 -L 5G vgiscsi00
# lvcreate -n lv_5G_02 -L 5G vgiscsi00
/backstores/block> create asmdisk5G00.disk /dev/vgiscsi00/lv_5G_00
/backstores/block> create asmdisk5G01.disk /dev/vgiscsi00/lv_5G_01
/backstores/block> create asmdisk5G02.disk /dev/vgiscsi00/lv_5G_02
/iscsi> create iqn.2015-06.com.sample.domain:sharedisk
create iqn.2015-06.com.sample.domain:server00
create /backstores/block/asmdisk5G00.disk
create /backstores/block/asmdisk5G01.disk
create /backstores/block/asmdisk5G02.disk
配置门户以使用目标侦听192.168.31.11端口3260
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
2.客户端主机配置
网卡eth0 10.0.0.10
客户端访问iscsi存储
yum install iscsi-initiator-utils -y
[root@localhost ~]# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2015-06.com.sample.domain:server00
# iscsiadm -m discovery -t st -p 10.0.0.1
5.登陆到呈现的iSCSI目标
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.0.0.1 –l
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.1.0.1 –l
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.2.0.1 –l
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.3.0.1 -l
[root@localhost nodes]# iscsiadm -m session -P 3|grep Attached
5. 查找新iSCSI目标的持久节点记录
less iqn.2015-06.com.sample.domain:sharedisk /10.0.0.1,3260,1/default
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.0.0.1 –u
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.1.0.1 –u
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.2.0.1 –u
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.3.0.1 -u
ls -1R仍存在记录,但是lsblk块存储消失,重启iscsi服务,lsblk重新发现
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.0.0.1 -u
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.1.0.1 -u
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.2.0.1 -u
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.3.0.1 -u
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.0.0.1 -o delete
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.1.0.1 -o delete
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.2.0.1 -o delete
# iscsiadm -m node -T iqn.2015-06.com.sample.domain:sharedisk -p 10.3.0.1 -o delete
ls -1R记录消失,但是lsblk块存储消失,重启iscsi服务,lsblk没有节点记录
# iscsiadm -m discovery -t st -p 192.168.31.11
#ls -1R
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
├─sda1 8:1 0 500M 0 part /boot
├─rhel-root 253:0 0 27.5G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
[root@localhost nodes]# blkid /dev/sdb
以上是关于[RHEL 7]ISCSI服务端及客户端连接配置的主要内容,如果未能解决你的问题,请参考以下文章