• 使用华为RH2288服务器搭建iSCSI共享存储(含ESXi映射步骤)


    1 环境需求

    说明:因为测试环境没有专用的存储服务器,所以想到了用一台服务器安装CentOS8,然后安装IPSAN来作为共享存储,供ESXi主机使用。目前使用了几个月,运行状况非常好,唯一的不足就是ESXi映射时有时候会等很久才会成功。

    这是援非项目上使用的测试平台,因此部分截图采用了英语的说明

    需要安装虚拟化平台软件作为模拟环境,因此将一台服务器安装CentOS8后创建iSCSI存储服务器提供共享存储服务,另外三台服务器用于搭建ESXi平台,组成虚拟化集群。

    2 服务器安装

    华为服务器的默认远程管理卡信息:

    IP address: 192.168.2.100
    username: root
    password: Huawei12#$

    1. 当服务器进度走到硬盘信息时,Ctrl+R进入RAID设置模式

    在这里插入图片描述

    1. 选中根目录,按F2,选择Create Virtual Drive创建RAID

    在这里插入图片描述

    1. 选择RAID-5,然后移动到磁盘,按空格选中,将所有磁盘加入到RAID中,创建阵列

    在这里插入图片描述

    1. 选中Virtual Drives下的磁盘,回车进入设置模式,可以给虚拟磁盘命名,完成后的配置如下:

    在这里插入图片描述

    1. Ctrl+N可以翻页,查看物理硬盘信息:

    在这里插入图片描述

    1. 按Esc退出,并保存配置,然后重启服务器,安装操作系统

    2. F11用于选择启动盘,如果使用电脑的本地镜像,需要选择虚拟DVD-ROM作为启动盘。

    在这里插入图片描述

    1. 操作系统的分区情况如下:

    在这里插入图片描述

    15.3 服务安装

    参数解释

    • TPG:共享存储组,某个特定iSCSI目标要侦听的接口IP地址和TCP端口的集合。可以将目标配置添加到TPG以协调多个LUN的设置。
    • ACL:访问权限控制列表,一种使用节点IQN(通常是启动器名称)来验证启动器的访问权限的访问限制。
    • IQN:iSCSI限定名称,全球唯一名称,用于以强制命名格式来识别启动器和目标。 IQN格式:iqn.YYYY-MM.com.reversed.domain[:optional_string] iqn:表示此名称使用域为标识符;YYYY-MM:表示拥有域名的年月时间; com.reversed.domain:拥有此iSCSI组织的逆向域名;:optional_string:以冒号为前缀的可选字符串,全球唯一,由域所有者分配,其中可包含冒号为分割符的组织边界;
    • LUN:逻辑单元号,带有编号的块设备,连接到目标且通过目标来使用。可以有一个或多个LUN连接到单个目标,但通常一个目标提供一个LUN;
    • portals入口:目标或启动器上用于建立连接的IP地址和端口号,端口号一般为3260。目标端的portals入口配置使用targetcli命令。

    服务器端安装软件:

    [root@Storage ~]# dnf install targetcli
    

    进入管理界面

    [root@Storage ~]# targetcli
    targetcli shell version 2.1.53
    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]
    

    创建两块用于虚拟化平台的磁盘:

    /> cd backstores/fileio
    /backstores/fileio> create VM-ISO /var/iscsi-storage/VM-ISO.img 300G
    Created fileio VM-ISO with size 322122547200
    /backstores/fileio> create VM-Data /var/iscsi-storage/VM-Data 1650G
    Created fileio VM-Data with size 1771674009600
    /backstores/fileio> ls
    o- fileio ..................................................................................................... [Storage Objects: 2]
      o- VM-Data .......................................................... [/var/iscsi-storage/VM-Data (1.6TiB) write-back deactivated]
      | o- alua ....................................................................................................... [ALUA Groups: 1]
      |   o- default_tg_pt_gp ........................................................................... [ALUA state: Active/optimized]
      o- VM-ISO ...................................................... [/var/iscsi-storage/VM-ISO.img (300.0GiB) write-back deactivated]
        o- alua ....................................................................................................... [ALUA Groups: 1]
          o- default_tg_pt_gp ........................................................................... [ALUA state: Active/optimized]
    

    创建属于服务器端的标示,并将两块磁盘映射到该标示中:

    /backstores/fileio> cd iscsi 
    /iscsi> create iqn.2022-07.minesup.com.cm:storage.target01	# 格式:[ iqn.(year)-(month).(reverse of domain name):(any name you prefer) ].
    Created target iqn.2022-07.minesup.com.cm:storage.target01.
    Created TPG 1.
    Global pref auto_add_default_portal=true
    Created default portal listening on all IPs (0.0.0.0), port 3260.
    
    /iscsi> cd iqn.2022-07.minesup.com.cm:storage.target01/tpg1/luns
    /iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/VM-ISO
    Created LUN 0.
    /iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/VM-Data
    Created LUN 1.
    /iscsi/iqn.20...t01/tpg1/luns> ls
    o- luns .................................................................................................................. [LUNs: 2]
      o- lun0 ....................................................... [fileio/VM-ISO (/var/iscsi-storage/VM-ISO.img) (default_tg_pt_gp)]
      o- lun1 ......................................................... [fileio/VM-Data (/var/iscsi-storage/VM-Data) (default_tg_pt_gp)]
    

    将磁盘服务映射给客户端(三个客户端需要做三个映射),可以给客户端设置密码,也可以不用设置(ESXi没办法将CHAP账户和密码配置上去,因此这里没有做认证)

    /iscsi/iqn.20...t01/tpg1/luns> cd ../acls
    /iscsi/iqn.20...t01/tpg1/acls> create iqn.1998-01.com.vmware:62c828bf-4d0d-7be4-919e-a4be2b83b44b-633b45a9	# ESXi的标示
    Created Node ACL for iqn.1998-01.com.vmware:62c828bf-4d0d-7be4-919e-a4be2b83b44b-633b45a9
    Created mapped LUN 1.
    Created mapped LUN 0.
    /iscsi/iqn.20...t01/tpg1/acls> create iqn.1998-01.com.vmware:esxi01-3593fb19
    Created Node ACL for iqn.1998-01.com.vmware:esxi01-3593fb19
    Created mapped LUN 1.
    Created mapped LUN 0.
    /iscsi/iqn.20...t01/tpg1/acls> create iqn.1998-01.com.vmware:esxi02-5b27fdf1
    Created Node ACL for iqn.1998-01.com.vmware:esxi02-5b27fdf1
    Created mapped LUN 1.
    Created mapped LUN 0.
    /iscsi/iqn.20...t01/tpg1/acls> exit			# 退出并保存配置
    Global pref auto_save_on_exit=true
    Configuration saved to /etc/target/saveconfig.json
    

    修改防火墙策略

    [root@Storage ~]# firewall-cmd --add-service=iscsi-target --permanent 
    success
    [root@Storage ~]# firewall-cmd --reload
    success
    

    15.4 ESXi映射

    在ESXi的存储适配器中开启软iSCSI服务,并配置IP-SAN服务器:

    在这里插入图片描述

    在这里插入图片描述

    完成配置后,点击重新扫描,这期间可能需要等一段时间,可能很快,也可能会等一个小时,当存储设备出现后,就可以在Datastore中添加新的卷了,但是需要注意,第一台服务器添加了存储后,后续的服务器就不用再添加了,而是自动出现。

  • 相关阅读:
    分布式教程从0到1【1】分布式基础
    Flink快速入门
    Netflow相关技术
    python第五次作业
    [202101][深入浅出 Spring Security][王松][著]
    【毕业设计】基于STM32的智能药箱系统设计与实现 - 物联网 单片机
    Python-逻辑运算
    【Mybatis】使用IDEA创建第一个Mybatis入门程序
    《rPPG》——(1)PyTorch——Windows环境配置
    linux+python3.6.8+uwsgi+postgresql+django部署web服务器
  • 原文地址:https://blog.csdn.net/wuxiaobing1234/article/details/139278826