应用场景
- 服务器IP地址为:192.168.0.32,API端口号为1443,WEB端口号为2443,安装路径为/mnt/stor(挂载磁盘/dev/vdd),数据目录为/mnt/storage01(挂载磁盘/dev/vdc)、/mnt/storage02(挂载磁盘/dev/vda)。
- 创建卷:本地模式的卷luna1,对应iSCSI Target为targeta,卷容量为100G;缓存模式卷lunb1,对应iSCSI Target为targetb,卷容量为200G;存储模式卷lunc1,对应iSCSI Target为targetc,卷容量为300G。
- 缓存模式和存储模式卷对应的OOS存储桶为:hblocktest3。
- HBlock系统名称为stor1,HBlock登录用户名为storuser,登录密码为hblock12@。
操作步骤
-
完成以下准备工作:安装路径/mnt/stor,数据目录/mnt/storage01、/mnt/storage02。OOS存储桶hblocktest3,AK/SK,前缀stor1。
-
将安装包放到服务器欲安装HBlock的目录下并解压缩,进入解压缩后的文件夹。
-
安装并初始化HBlock。
-
安装HBlock。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor install -w 2443 Do you agree with HBlock User Agreement? [Yes/No] Used in Chinese mainland, follow https://www.ctyun.cn/portal/protocol/10073150 Otherwise, follow https://www.esurfingcloud.com/portal/protocol/20692906 y Installing HBlock... Installed successfully. When all servers are installed, please initialize HBlock in any of the following ways: 1. Use web portal to initialize HBlock. The https port is 2443. 2. Use management API (POST /rest/v1/system/setup) to initialize HBlock. The https port is 1443. 3. Use command line (stor setup) to initialize HBlock. Type 'stor --help setup' for more information.
-
初始化HBlock。
密码可以按交互式输入,使用交互式输入密码时,以密文形式显示。[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor setup -n stor1 -u storuser -s 192.168.0.32:/mnt/storage01,/mnt/stor Please 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 HBlock 2. Contact the software vendor to obtain a license 3. Run "stor license add -k KEY" to import the license Type 'stor --help' to get more information, such as managing LUNs, targets, servers, etc.
-
查询服务器。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor server ls -n hblock_1 Server Name: hblockserver Server ID: hblock_1 Status: Connected Public Address: 192.168.0.32:3260 Cluster Address: 192.168.0.32 Recent Start Time: 2024-07-22 10:18:23 Version: 3.7.0 Disk Path(s): +-----+-------------------+---------------+----------------+---------------------+----------------+---------------+---------------+ | No. | Path | Used Capacity | Total Capacity | Used Capacity Quota | Capacity Quota | Health Status | Health Detail | +-----+-------------------+---------------+----------------+---------------------+----------------+---------------+---------------+ | 1. | /mnt/storage01(*) | 19.37 GiB | 93.29 GiB | 4 KiB | Unlimited | Healthy | | | 2. | /mnt/stor | 1.17 GiB | 93.29 GiB | 4 KiB | Unlimited | Healthy | - | +-----+-------------------+---------------+----------------+---------------------+----------------+---------------+---------------+
-
-
获取软件许可证并加载。
HBlock软件提供30天试用期,过期后无法进行管理操作。您可以通过下列步骤获取软件许可证并加载。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor info --serial-id HBlock serial ID: HBlock serial ID: CF317E33-A0E7-433C-9D2B-774828642C4F-0201-030700 [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor license add -k ****** Import license successfully. The current system time: 2024-07-22 14:48:34 +--------------------------------------+----------------------+--------------+-----------+----------------------+ | LicenseId | Account | Type | Status | MaximumLocalCapacity | +--------------------------------------+----------------------+--------------+-----------+----------------------+ | ehc2b6a9-f3fb-4098-a6b3-3652a5d71232 | testaccount1@xxx.com | Subscription | Effective | 1 PiB | +--------------------------------------+----------------------+--------------+-----------+----------------------+ License ehc2b6a9-f3fb-4098-a6b3-3652a5d71232 (Effective): Usage: +----------------------+---------------------+---------------------+-----------+ | MaximumLocalCapacity | EffectiveTime | ExpireTime | Status | +----------------------+---------------------+---------------------+-----------+ | 1 PiB | 2024-07-22 14:42:08 | 2024-08-21 14:42:08 | Effective | +----------------------+---------------------+---------------------+-----------+
-
创建iSCSI Target并查询。
-
创建iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target add -n targeta --max-sessions 3 -c chap-test -p ****** -s on Created Target targeta successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260) [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target add -n targetb --max-sessions 2 Created Target targetb successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:targetb.2(192.168.0.32:3260) [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target add -n targetc Created Target targetc successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:targetc.3(192.168.0.32:3260)
-
查询iSCSI Target。
查询所有iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target ls -n targeta Target Name: targeta Max Sessions: 3 Create Time: 2024-07-22 14:50:23 iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260) CHAP: chap-test,test1test2024,Enabled
-
-
创建卷并查询。
-
创建卷。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun add -n luna1 -p 100 -t targeta Created LUN luna1 successfully. [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun add -n lunb1 -t targetb -p 200 -m Cache -B hblocktest3 -E oos-cn.ctyunapi.cn -A cb22b08b1f9229f85874 -S ************** --sign-version v4 --region cn -X stor1 Created LUN lunb1 successfully. [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun add -n lunc1 -t targetc -p 300 -m Storage -B hblocktest3 -E oos-cn.ctyunapi.cn -A cb22b08b1f9229f85874 -S ************** --sign-version v4 --region cn -X stor1 Created LUN lunc1 successfully.
-
查询卷。
查询所有卷。
[root@hblockserver 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(192.168.0.32:3260,Active) | | 2. | lunb1(LUN 0) | Cache | 200 GiB | Enabled | iqn.2012-08.cn.ctyunapi.oos:targetb.2(192.168.0.32:3260,Active) | | 3. | lunc1(LUN 0) | Storage | 300 GiB | Enabled | iqn.2012-08.cn.ctyunapi.oos:targetc.3(192.168.0.32:3260,Active) | +-----+--------------+--------------+----------+---------+-----------------------------------------------------------------+
查询指定卷,例如查询卷luna1。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun ls -n luna1 LUN Name: luna1 (LUN 0) Storage Mode: Local Capacity: 100 GiB Status: Enabled iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260,Active) Create Time: 2024-07-22 14:52:42 Local Sector Size: 4096 bytes Write Policy: WriteBack WWID: 33fffffffce6bc2a6 UUID: lun-uuid-9885d5c6-23f7-4739-b580-fc5a233ea3bd Path: /mnt/storage01
-