應用場景:
三臺服務器
服務器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.9.0_x64.zip [root@hblockserver storage01]# unzip CTYUN_HBlock_Plus_3.9.0_x64.zip …… [root@hblockserver storage01]# 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 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.9.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 | 2025-01-17 13:58:21 | | 2. | hblock_2(**) | pm-006 | Connected | 192.168.0.192:3260 | 192.168.0.192 | 2025-01-17 14:11:52 | | 3. | hblock_3(**) | hblockserver | Connected | 192.168.0.110:3260 | 192.168.0.110 | 2025-01-17 14:12:01 | +-----+----------------+------------------+-----------+--------------------+-----------------+---------------------+查看指定服務器。
[root@hblockserver CTYUN_HBlock_Plus_3.9.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: mdm(Up, /mnt/storage01/CTYUN_HBlock_Plus_3.9.0_x64) ls(Up, /mnt/storage01/CTYUN_HBlock_Plus_3.9.0_x64) cs(Up, /mnt/storage01/CTYUN_HBlock_Plus_3.9.0_x64) Public Address: 192.168.0.102:3260 Cluster Address: 192.168.0.102 Recent Start Time: 2025-01-17 13:58:21 Version: 3.9.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.9.0_x64]# ./stor info --serial-id HBlock serial ID: 744B6ED7-6954-4BDA-8228-0772F574CA44-0202-030700 [root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]# ./stor license add -k ****** Import license successfully. The current system time: 2025-01-17 18:02:16 +--------------------------------------+----------------------+--------------+-----------+----------------------+ | 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 18:01:40 | 2025-08-17 18:01:40 | Effective | +----------------------+---------------------+---------------------+-----------+創建iSCSI Target并查詢。
創建iSCSI Target。
[root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]# ./stor target add -n target01 --max-sessions 6 -c chap-test1 -p T12345678912 -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.9.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.9.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.9.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.9.0_x64]# ./stor target ls -n target01 Target Name: target01 Max Sessions: 6 Create Time: 2025-01-17 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) Reclaim Policy: Retain CHAP: chap-test1,T12345678912,Enabled ServerID: hblock_1,hblock_2,hblock_3
創建卷并查詢。
創建卷。
[root@hblockserver CTYUN_HBlock_Plus_3.9.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.9.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.9.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.9.0_x64]# ./stor lun ls +-----+-----------------+--------------+----------+---------------------+------------------------+--------+-------------------------------------------------------------------------+------------------+----------+ | No. | LUN Name | Storage Mode | Capacity | Local Storage Class | Minimum Replica Number | Status | Target | Snapshot Numbers | Is Clone | +-----+-----------------+--------------+----------+---------------------+------------------------+--------+-------------------------------------------------------------------------+------------------+----------+ | 1. | lun01a(LUN 0) | Local | 100 GiB | EC 2+1+32KiB | 2 | Normal | iqn.2012-08.cn.ctyunapi.oos:target01.16(192.168.0.102:3260,Active) | 0 | | | | | | | | | | 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 | Normal | iqn.2012-08.cn.ctyunapi.oos:target02.3(192.168.0.102:3260,Active) | 0 | | | | | | | | | | 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 | Normal | iqn.2012-08.cn.ctyunapi.oos:target03.5(192.168.0.102:3260,Active) | 0 | | | | | | | | | | iqn.2012-08.cn.ctyunapi.oos:target03.6(192.168.0.110:3260,Standby) | | | +-----+-----------------+--------------+----------+---------------------+------------------------+--------+-------------------------------------------------------------------------+------------------+----------+查詢指定卷,例如lun02a。
[root@hblockserver CTYUN_HBlock_Plus_3.9.0_x64]# ./stor lun ls -n lun02a LUN Name: lun02a (LUN 0) Storage Mode: Cache Capacity: 200 GiB Status: Normal Auto Failback: 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: 2025-01-17 20:50:29 Local Storage Class: EC 2+1+32KiB Minimum Replica Number: 2 Redundancy Overlap: 1 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: +-------------------+----------------------------+ | Provider | OOS | | Bucket Name | hblocktest3 | | Prefix | stor2 | | Endpoint | //oos-cn.ctyunapi.cn | | Signature Version | v4 | | Region | cn | | Storage Class | STANDARD | | Access Key | cb22b08b1f9229f85874 | | Object Size | 1024 KiB | | Compression | Enabled | +-------------------+----------------------------+