應用場景
服務器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的目錄下并解壓縮,進入解壓縮后的文件夾。
[root@hblockserver stor]# ls CTYUN_HBlock_Plus_3.9.0_x64.zip [root@hblockserver stor]# unzip CTYUN_HBlock_Plus_3.9.0_x64.zip …… [root@hblockserver stor]# cd CTYUN_HBlock_Plus_3.9.0_x64 [root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]#安裝并初始化HBlock。
安裝HBlock。
[root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]# ./stor install -w 2443 Do you agree with HBlock User Agreement? [Yes/No] Used in Chinese mainland, follow //www.daliqc.cn/portal/protocol/10073150 Otherwise, follow //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.9.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.9.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: 2025-01-17 10:18:23 Version: 3.9.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.9.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.9.0_x64]# ./stor license add -k ****** Import license successfully. The current system time: 2025-01-17 14:48:34 +--------------------------------------+----------------------+--------------+-----------+----------------------+ | LicenseId | Account | Type | Status | MaximumLocalCapacity | +--------------------------------------+----------------------+--------------+-----------+----------------------+ | ehc2b6a9-f3fb-4098-a6b3-3652a5d71232 | testaccount@daliqc.cn | Subscription | Effective | 1 PiB | +--------------------------------------+----------------------+--------------+-----------+----------------------+ License ehc2b6a9-f3fb-4098-a6b3-3652a5d71232 (Effective): Usage: +----------------------+---------------------+---------------------+-----------+ | MaximumLocalCapacity | EffectiveTime | ExpireTime | Status | +----------------------+---------------------+---------------------+-----------+ | 1 PiB | 2025-01-17 14:42:08 | 2025-08-16 14:42:08 | Effective | +----------------------+---------------------+---------------------+-----------+創建iSCSI Target并查詢。
創建iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_3.9.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.9.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.9.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.9.0_x64]# ./stor target ls +-----+-------------+--------------+----------------------------------------------------------+-------------------+ | No. | Target Name | Max Sessions | ISCSI Target | CHAP | +-----+-------------+--------------+----------------------------------------------------------+-------------------+ | 1. | targeta | 3 | iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260) | chap-test,Enabled | | 2. | targetb | 2 | iqn.2012-08.cn.ctyunapi.oos:targetb.2(192.168.0.32:3260) | Disabled | | 3. | targetc | 1 | iqn.2012-08.cn.ctyunapi.oos:targetc.3(192.168.0.32:3260) | Disabled | +-----+-------------+--------------+----------------------------------------------------------+-------------------+查詢指定iSCSI Target,例如查詢targeta。
[root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]# ./stor target ls -n targeta Target Name: targeta Max Sessions: 3 Create Time: 2025-01-17 14:50:23 iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260) Reclaim Policy: Delete CHAP: chap-test,test1test2024,Enabled
創建卷并查詢。
創建卷。
[root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]# ./stor lun add -n luna1 -p 100 -t targeta Created LUN luna1 successfully. [root@hblockserver CTYUN_HBlock_Plus_3.9.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.9.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.9.0_x64]# ./stor lun ls +-----+--------------+--------------+----------+--------+-----------------------------------------------------------------+------------------+----------+ | No. | LUN Name | Storage Mode | Capacity | Status | Target | Snapshot Numbers | Is Clone | +-----+--------------+--------------+----------+--------+-----------------------------------------------------------------+------------------+----------+ | 1. | luna1(LUN 0) | Local | 100 GiB | Normal | iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260,Active) | 0 | | | 2. | lunb1(LUN 0) | Cache | 200 GiB | Normal | iqn.2012-08.cn.ctyunapi.oos:targetb.2(192.168.0.32:3260,Active) | 0 | | | 3. | lunc1(LUN 0) | Storage | 300 GiB | Normal | iqn.2012-08.cn.ctyunapi.oos:targetc.3(192.168.0.32:3260,Active) | 0 | | +-----+--------------+--------------+----------+--------+-----------------------------------------------------------------+------------------+----------+查詢指定卷,例如查詢卷luna1。
[root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]# ./stor lun ls -n luna1 LUN Name: luna1 (LUN 0) Storage Mode: Local Capacity: 100 GiB Status: Normal iSCSI Target: iqn.2012-08.cn.ctyunapi.oos:targeta.1(192.168.0.32:3260,Active) Create Time: 2025-01-17 14:52:42 Local Sector Size: 4096 bytes Write Policy: WriteBack WWID: 33fffffffce6bc2a6 UUID: lun-uuid-9885d5c6-23f7-4739-b580-fc5a233ea3bd Path: /mnt/storage01 Snapshot Numbers: 0