应用场景:
- 三台服务器
- 服务器1:IP地址为192.168.0.110,API端口号为1443,WEB端口号为2443,安装路径为/mnt/storage01(磁盘/dev/vdc),数据目录为/mnt/stor(磁盘/dev/vdd)、/mnt/storage02(磁盘/dev/vdb)。
- 服务器2:IP地址为192.168.0.192,API端口号为1443,WEB端口号为2443,安装路径为/mnt/storage01(磁盘/dev/vda),数据目录为/mnt/stor(磁盘/dev/vdd)。
- 服务器3:IP地址为192.168.0.102,API端口号为1443,WEB端口号为2443,安装路径为/mnt/storage01(磁盘/dev/vda),数据目录为/mnt/stor(磁盘/dev/vdd)。
- 创建卷:本地模式的卷lun01a,对应iSCSI Target为target01,卷容量为100G;缓存模式卷lun02a,对应iSCSI Target为target02,卷容量为200G;存储模式卷lun03a,对应iSCSI Target为target03,卷容量为300G。
- 缓存模式和存储模式卷对应的OOS存储桶为:hblocktest3。
- HBlock系统名称为stor2,HBlock登录用户名为storuser,登录密码为hblock12@。
操作步骤
-
完成以下准备工作
- 服务器1安装路径:/mnt/storage01,数据目录:/mnt/stor、/mnt/storage02。
- 服务器2安装路径:/mnt/storage01,数据目录:/mnt/stor。
- 服务器3安装路径:/mnt/storage01,数据目录:/mnt/stor。
- OOS存储桶hblocktest3,AK/SK,前缀stor2。
-
将安装包放到各个服务器的安装HBlock目录下并解压缩,进入解压缩后的文件夹。
[root@hblockserver storage01]# ls CTYUN_HBlock_Plus_3.7.0_x64.zip [root@hblockserver storage01]# unzip CTYUN_HBlock_Plus_3.7.0_x64.zip …… [root@hblockserver storage01]# cd CTYUN_HBlock_Plus_3.7.0_x64 [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]#
-
安装并初始化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 stor2 -p hblock12@ -s 192.168.0.110:/mnt/stor,/mnt/storage02 192.168.0.192:/mnt/stor 192.168.0.102:/mnt/stor 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 +-----+--------------+------------------+-----------+--------------------+-----------------+---------------------+ | No. | Server ID | Server Name | Status | Public Address | Cluster Address | Recent Start Time | +-----+--------------+------------------+-----------+--------------------+-----------------+---------------------+ | 1. | hblock_1(M) | ecs-9689-0915140 | Connected | 192.168.0.102:3260 | 192.168.0.102 | 2024-07-22 13:58:21 | | 2. | hblock_2(**) | pm-006 | Connected | 192.168.0.192:3260 | 192.168.0.192 | 2024-07-22 14:11:52 | | 3. | hblock_3(**) | hblockserver | Connected | 192.168.0.110:3260 | 192.168.0.110 | 2024-07-22 14:12:01 | +-----+--------------+------------------+-----------+--------------------+-----------------+---------------------+
查看指定服务器。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor server ls -n hblock_1 Server Name: ecs-9689-0915140 Server ID: hblock_1 Node Name: default:server1 Parent Node: default Status: Connected Master Server: true Base Server: true Base Service: ls(Up),cs(Up) Public Address: 192.168.0.102:3260 Cluster Address: 192.168.0.102 Recent Start Time: 2024-07-22 13:58:21 Version: 3.7.0 Disk Path(s): +-----+-----------+--------------+---------------+----------------+---------------------+----------------+---------------+---------------+ | No. | Path | Storage Pool | Used Capacity | Total Capacity | Used Capacity Quota | Capacity Quota | Health Status | Health Detail | +-----+-----------+--------------+---------------+----------------+---------------------+----------------+---------------+---------------+ | 1. | /mnt/stor | default | 10.22 GiB | 93.29 GiB | 138.49 KiB | Unlimited | Healthy | - | +-----+-----------+--------------+---------------+----------------+---------------------+----------------+---------------+---------------+
-
-
获取软件许可证并加载。
HBlock软件提供30天试用期,过期后无法进行管理操作。您可以通过下列步骤获取软件许可证并加载。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor info --serial-id HBlock serial ID: 744B6ED7-6954-4BDA-8228-0772F574CA44-0202-030700 [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor license add -k ****** Import license successfully. The current system time: 2024-07-22 18:02:16 +--------------------------------------+----------------------+--------------+-----------+----------------------+ | 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 18:01:40 | 2024-08-22 18:01:40 | Effective | +----------------------+---------------------+---------------------+-----------+
-
创建iSCSI Target并查询。
-
创建iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target add -n target01 --max-sessions 6 -c chap-test1 -p *********** -s on --num 3 --server hblock_1,hblock_2,hblock_3 Created Target target01 successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:target01.1(192.168.0.110:3260) iqn = iqn.2012-08.cn.ctyunapi.oos:target01.2(192.168.0.192:3260) iqn = iqn.2012-08.cn.ctyunapi.oos:target01.16(192.168.0.102:3260) [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target add -n target02 --max-sessions 2 Created Target target02 successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:target02.3(192.168.0.102:3260) iqn = iqn.2012-08.cn.ctyunapi.oos:target02.4(192.168.0.110:3260) [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target add -n target03 Created Target target03 successfully. iqn = iqn.2012-08.cn.ctyunapi.oos:target03.5(192.168.0.102:3260) iqn = iqn.2012-08.cn.ctyunapi.oos:target03.6(192.168.0.110:3260)
-
查询iSCSI Target。
查询所有iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target ls +-----+-------------+--------------+-------------------------------------------------------------+--------------------+ | No. | Target Name | Max Sessions | ISCSI Target | CHAP | +-----+-------------+--------------+-------------------------------------------------------------+--------------------+ | 1. | target01 | 6 | iqn.2012-08.cn.ctyunapi.oos:target01.1(192.168.0.110:3260) | chap-test1,Enabled | | | | | iqn.2012-08.cn.ctyunapi.oos:target01.2(192.168.0.192:3260) | | | | | | iqn.2012-08.cn.ctyunapi.oos:target01.16(192.168.0.102:3260) | | | 2. | target02 | 2 | iqn.2012-08.cn.ctyunapi.oos:target02.3(192.168.0.102:3260) | Disabled | | | | | iqn.2012-08.cn.ctyunapi.oos:target02.4(192.168.0.110:3260) | | | 3. | target03 | 1 | iqn.2012-08.cn.ctyunapi.oos:target03.5(192.168.0.102:3260) | Disabled | | | | | iqn.2012-08.cn.ctyunapi.oos:target03.6(192.168.0.110:3260) | | +-----+-------------+--------------+-------------------------------------------------------------+--------------------+
查询指定iSCSI Target,例如target01。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor target ls -n target01 Target Name: target01 Max Sessions: 6 Create Time: 2024-07-22 19:50:29 Number of Servers: 3 iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:target01.1(192.168.0.110:3260) iqn.2012-08.cn.ctyunapi.oos:target01.2(192.168.0.192:3260) iqn.2012-08.cn.ctyunapi.oos:target01.16(192.168.0.102:3260) CHAP: chap-test1,T12345678912,Enabled ServerID: hblock_1,hblock_2,hblock_3
-
-
创建卷并查询。
-
创建卷。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun add -n lun01a -t target01 -c EC 2+1 --ec-fragment-size 32 -p 100 -m Local Created LUN lun01a successfully. [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun add -n lun02a -t target02 -c EC 2+1 --ec-fragment-size 32 -p 200 -m Cache -B hblocktest3 -E oos-cn.ctyunapi.cn -A cb22b08b1f9229f85874 -S ************** --sign-version v4 --region cn -X stor2 Created LUN lun02a successfully. [root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun add -n lun03a -t target03 -c EC 2+1 --ec-fragment-size 32 -p 300 -m Storage -B hblocktest3 -E oos-cn.ctyunapi.cn -A cb22b08b1f9229f85874 -S ************** --sign-version v4 --region cn -X stor2 Created LUN lun03a successfully.
-
查询卷
查询所有卷。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun ls +-----+-----------------+--------------+----------+---------------------+------------------------+---------+-------------------------------------------------------------------------+ | No. | LUN Name | Storage Mode | Capacity | Local Storage Class | Minimum Replica Number | Status | Target | +-----+-----------------+--------------+----------+---------------------+------------------------+---------+-------------------------------------------------------------------------+ | 1. | lun01a(LUN 0) | Local | 100 GiB | EC 2+1+32KiB | 2 | Enabled | iqn.2012-08.cn.ctyunapi.oos:target01.16(192.168.0.102:3260,Active) | | | | | | | | | iqn.2012-08.cn.ctyunapi.oos:target01.2(192.168.0.192:3260,Standby) | | | | | | | | | iqn.2012-08.cn.ctyunapi.oos:target01.1(192.168.0.110:3260,ColdStandby) | | 2. | lun02a(LUN 0) | Cache | 200 GiB | EC 2+1+32KiB | 2 | Enabled | iqn.2012-08.cn.ctyunapi.oos:target02.3(192.168.0.102:3260,Active) | | | | | | | | | iqn.2012-08.cn.ctyunapi.oos:target02.4(192.168.0.110:3260,Standby) | | 3. | lun03a(LUN 0) | Storage | 300 GiB | EC 2+1+32KiB | 2 | Enabled | iqn.2012-08.cn.ctyunapi.oos:target03.5(192.168.0.102:3260,Active) | | | | | | | | | iqn.2012-08.cn.ctyunapi.oos:target03.6(192.168.0.110:3260,Standby) | +-----+-----------------+--------------+----------+---------------------+------------------------+---------+-------------------------------------------------------------------------+
查询指定卷,例如lun02a。
[root@hblockserver CTYUN_HBlock_Plus_3.7.0_x64]# ./stor lun ls -n lun02a LUN Name: lun02a (LUN 0) Storage Mode: Cache Capacity: 200 GiB Status: Enabled iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:target02.3(192.168.0.110:3260,Active) iqn.2012-08.cn.ctyunapi.oos:target02.4(192.168.0.102:3260,Standby) Create Time: 2024-07-22 20:50:29 Local Storage Class: EC 2+1+32KiB Minimum Replica Number: 2 Local Sector Size: 4096 bytes High Availability: ActiveStandby Storage Pool: default Write Policy: WriteBack WWID: 33fffffff805dcfc1 UUID: lun-uuid-9457ebfc-8440-4e69-bc9c-c054938e5551 Object Storage Info: +-------------------+----------------------------+ | Bucket Name | hblocktest3 | | Prefix | stor2 | | Endpoint | https://oos-cn.ctyunapi.cn | | Signature Version | v4 | | Region | cn | | Storage Class | STANDARD | | Access Key | cb22b08b1f9229f85874 | | Object Size | 1024 KiB | | Compression | Enabled | +-------------------+----------------------------+
-