部署环境介绍
服务端:
2C2G 云服务器-20G 数据盘-20G 数据盘
软件版本:CentOS Linux release 7.8.2003
内核版本:3.10.0-1127.19.1.el7.x86_6
客户端:
1C1G 云服务器-20G 数据盘-(扩展后的磁盘)
软件版本:CentOS Linux release 7.8.2003
内核版本:3.10.0-1127.19.1.el7.x86_6
产品简介:
HBlock 是中国电信天翼云自主研发的存储资源盘活系统,是一款轻量级存储集群控制器,通过标准 iSCSI 协议提供分布式块存储服务,挂载给本地服务器(或其他远程服务器)使用。
项目部署过程
一、配置环境
1、挂载数据盘
[root@hblock ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTvda 253:0 0 20G 0 disk└─vda1 253:1 0 20G 0 part /vdb 253:16 0 20G 0 disk└─vdb1 253:17 0 20G 0 part[root@hblock ~]# mkdir /hblock[root@hblock ~]# mkfs.ext4 /dev/vdb1[root@hblock ~]# mount /dev/vdb1 /hblock[root@hblock ~]# lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTvda 253:0 0 20G 0 disk└─vda1 253:1 0 20G 0 part /vdb 253:16 0 20G 0 disk└─vdb1 253:17 0 20G 0 part /hblock
#永久挂载,开机不丢失mount[root@hblock ~]# blkid/dev/vda1: UUID="9f2d3e15-a78a-4f3d-8385-0165b4b67864" TYPE="ext4"/dev/vdb1: UUID="47232063-2922-453d-a186-d05a52975bdf" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="6a07a00e-bc25-41f5-a27e-65dc4f3eae40"[root@hblock ~]# vim /etc/fstab[root@hblock ~]# cat /etc/fstabUUID=9f2d3e15-a78a-4f3d-8385-0165b4b67864 / ext4 defaults 1 1UUID=47232063-2922-453d-a186-d05a52975bdf /hblock ext4 defaults 0 1[root@hblock ~]# mount -a
复制代码
2、配置资源限制
[root@hblock ~]# cat /etc/systemd/system.conf| grep DefaultLimitNOFILEDefaultLimitNOFILE=65536[root@hblock ~]# cat /etc/security/limits.conf | grep 65535root soft nofile 65535root hard nofile 65535* soft nofile 65535* hard nofile 65535
复制代码
二、安装并初始化 HBlock
#x86架构的安装包wget https://oos-hazz.ctyunapi.cn/hblock-package/3.7/CTYUN_HBlock_Plus_3.7.0_x64.zip#解压安装unzip CTYUN_HBlock_Plus_3.7.0_x64.zipcd CTYUN_HBlock_Plus_3.7.0_x64#指定 API 端口号,默认端口号为 1443。WEB_PORT:指定 WEB 端口号,默认端口号为 443。(我没有证书先配置http访问)[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor install -w 80Do you agree with HBlock User Agreement? [Yes/No]Used in Chinese mainland, follow https://www.ctyun.cn/portal/protocol/10073150Otherwise, follow https://www.esurfingcloud.com/portal/protocol/20692906y
复制代码
建议:命令提示符号需要 y 才能安转,我开始还以为夯住了,开了另一个看 top 进程,发县啥都没有。要不然建议官方把这个 yes 放在选项上呢,比如 -y ,提一个优化小建议!
1、通过 web、命令行和 API 进行初始化 HBlock。
[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor setup -n stor1 -u storuser -s 10.1.0.53:/hblockPlease enter password:************Start to setup HBlock, please wait.Processing...Setup successfully and the HBlock services have been started.Welcome to HBlock!You are using a 30-day trial version. Please follow the steps to get a license.1. Run "stor info --serial-id" to get the serial ID of the HBlock2. Contact the software vendor to obtain a license3. Run "stor license add -k KEY" to import the license
Type 'stor --help' to get more information, such as managing LUNs, targets, servers, etc.
复制代码
HBlock 系统名称为 stor1,HBlock 登录用户名为 storuser,登录密码为 hblock12@。
踩坑实录:
1、对密码有长度和复杂性要求,否则报错:Error: Value 'Wushibo123!' at 'new password' failed to satisfy constraint: Argument must have length between 8 and 16, and must contain 3 of the following: uppercase letters, lowercase letters, digits, special symbols (~! @ # $% ^ & * () _ + [] {} | ;:,. / <>?) , and must not contain any of the following: 3 consecutive repeating characters, 3 consecutive or in-reverse order of numbers or letters (case-insensitive) , 3 consecutive or in-reverse order of keyboard sequences (case-insensitive)
2、对 IP 地址只能是内网 IP 地址,不能使用公网 IP 地址,否则报错:The current server is not in the servers list。不能使用 localhost,否则报错:Error: Value null at 'public network' failed to satisfy constraint: Argument must not be null when 'server ip' contains 'localhost'/'127.0.0.1'/'0:0:0:0:0:0:0:1'.
2、查询服务器
./stor server ls -n hblock_1
复制代码
HBlock 软件提供 30 天试用期,过期后无法进行管理操作。
购买服务后可以通过这种方法获取软件许可证并加载。
[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor info --serial-idHBlock serial ID: 5CEB392A-EED2-47DC-951E-EFA4F018EF2B-0201-030700[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor license add -k 5CEB392A-EED2-47DC-951E-EFA4F018EF2B-0201-030700
复制代码
3、创建 iSCSI Target 并查询
[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target add -n targeta --max-sessions 3 -c chap-test -p [12-15为密码] -s onCreated Target targeta successfully.iqn = iqn.2012-08.cn.ctyunapi.oos:targeta.1(10.1.0.53:3260)[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target ls+-----+-------------+--------------+-------------------------------------------------------+-------------------+| No. | Target Name | Max Sessions | ISCSI Target | CHAP |+-----+-------------+--------------+-------------------------------------------------------+-------------------+| 1. | targeta | 3 | iqn.2012-08.cn.ctyunapi.oos:targeta.1(10.1.0.53:3260) | chap-test,Enabled |+-----+-------------+--------------+-------------------------------------------------------+-------------------+
复制代码
4、创建卷并查询
[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun add -n luna1 -p 100 -t targetaCreated LUN luna1 successfully.[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun ls+-----+--------------+--------------+----------+---------+--------------------------------------------------------------+| No. | LUN Name | Storage Mode | Capacity | Status | Target |+-----+--------------+--------------+----------+---------+--------------------------------------------------------------+| 1. | luna1(LUN 0) | Local | 100 GiB | Enabled | iqn.2012-08.cn.ctyunapi.oos:targeta.1(10.1.0.53:3260,Active) |+-----+--------------+--------------+----------+---------+--------------------------------------------------------------+[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun ls -n luna1LUN Name: luna1 (LUN 0)Storage Mode: LocalCapacity: 100 GiBStatus: EnablediSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(10.1.0.53:3260,Active)Create Time: 2024-08-25 16:47:47Local Sector Size: 4096 bytesWrite Policy: WriteBackWWID: 33fffffffc28da3ddUUID: lun-uuid-0c3a40a6-27bf-4f21-aeda-224a4197e436Path: /hblock
复制代码
三、客户端配置
因为我没有 win 电脑,所有我给你一个指南:3.1 Windows 客户端 – 单机版
https://oos-hazz.ctyunapi.cn/hblock-document/%E5%AD%98%E5%82%A8%E8%B5%84%E6%BA%90%E7%9B%98%E6%B4%BB%E7%B3%BB%E7%BB%9F%E7%94%A8%E6%88%B7%E6%89%8B%E5%86%8C-%E5%91%BD%E4%BB%A4%E8%A1%8C_3.7.pdf
复制代码
linux 客户端配置
前置条件:HBlock 服务器端,已经成功创建卷
yum -y install iscsi-initiator-utils
1、进入服务端查看相关数据
主要注意 CHAP 认证的账户和密码,是否开启 CHAP(Enabled 开启,disable 关闭)
CHAP: chap-test,fff235232508200909,Enabled
[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun ls -n luna1LUN Name: luna1 (LUN 0)Storage Mode: LocalCapacity: 100 GiBStatus: EnablediSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(10.1.0.53:3260,Active)Create Time: 2024-08-25 16:47:47Local Sector Size: 4096 bytesWrite Policy: WriteBackWWID: 33fffffffc28da3ddUUID: lun-uuid-0c3a40a6-27bf-4f21-aeda-224a4197e436Path: /hblock[root@hblock CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target ls -n targetaTarget Name: targetaMax Sessions: 3Create Time: 2024-08-25 16:46:23iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(10.1.0.53:3260)LUN: luna1(LUN 0)CHAP: chap-test,fff235232508200909,Enabled
复制代码
2、客户端传入参数链接服务器
iscsiadm -m node -T iqn.2012-08.cn.ctyunapi.oos:targeta.1 -o update --name node.session.auth.authmethod --value=CHAPiscsiadm -m node -T iqn.2012-08.cn.ctyunapi.oos:targeta.1 -o update --name node.session.auth.username --value=chap-testiscsiadm -m node -T iqn.2012-08.cn.ctyunapi.oos:targeta.1 -o update --name node.session.auth.password --value=fff235232508200909iscsiadm -m node -T iqn.2012-08.cn.ctyunapi.oos:targeta.1 -p 10.1.0.53:3260 -l
复制代码
正确回显
之后我们就可以看见一个新硬盘
3、大功告成
测试新的云硬盘
关于产品
一、谈谈感受
个人用户可以快速上手,通过简单的命令行操作完成部署。
HBlock 提供了命令行工具和 API,使得管理操作直观且易于自动化。
但是我感觉部署过程也存在潜在挑战:
学习曲线:对于不熟悉 Linux 或存储系统的用户,可能需要一定的学习时间来掌握 HBlock 的部署和管理。
官方文档:对于文档很对多命令并没有对每一个选项做出全市,还存在些许学习成本。还有本文部署过程中提到的一些问题和优化建议,希望官方在后续文档中作为补充
二、产品对 tob 和 toc 的优势
技术先进性:HBlock 实现了全用户态的软件定义存储,支持分布式块存储服务,提供了与传统硬件存储阵列相媲美的低延迟和高可用性。
异构设备兼容性:HBlock 支持多种硬件平台,包括 x86、ARM 和龙芯服务器,提高了企业现有硬件的利用率。
场景化适配能力:无论是非联网模式还是联网模式,HBlock 都能提供适应不同 IT 架构的解决方案。
降本增效:通过将通用服务器的闲置存储资源转换成高可用的虚拟磁盘,HBlock 减少了对专用存储硬件的依赖,从而降低了企业的资本开支和运营成本。
按需扩展:HBlock 支持从几台服务器扩展到数千台,且支持数据上云,实现存储空间的按需使用和弹性扩展,避免了过度投资。
易安装与维护:HBlock 可以像普通应用程序一样安装在 Linux 操作系统中,简化了安装和维护流程。
监控与告警:HBlock 提供了实时性能数据监控和告警功能,帮助 IT 运维团队及时发现并解决问题,减少系统故障时间。
评论