Managing Data in OBS
KooCLI has integrated the obsutil tool of Object Storage Service (OBS). You can run hcloud obs to manage your data in OBS.
Function Overview
With KooCLI, you can perform the following operations to manage your data in OBS.
Function |
Description |
---|---|
Basic bucket operations |
Create buckets of different storage classes in specific regions, delete buckets, and obtain the bucket list and configuration information. |
Basic object operations |
Manage objects, including uploading, downloading, deleting, and listing objects.
|
Logs |
Configure logging on your client to record bucket and object operations for statistical analysis. |
Initial Configuration
Before using KooCLI to manage data in OBS, configure OBS connection, including the OBS endpoint and access key (AK/SK). You can use KooCLI to manage OBS buckets and objects only after being authenticated by OBS.
- Permanent AK/SK:
hcloud obs config -i=ak -k=sk -e=endpoint
- Temporary AK/SK and SecurityToken:
hcloud obs config -i=ak -k=sk -t=token -e=endpoint
Checking Connectivity
After the configuration is complete, run the following command to check the connectivity:
hcloud obs ls -s
Check the configuration result based on the command output:
- Bucket number: The configuration is correct.
- Http status [403]: The access key is incorrect, or you do not have permission to access the bucket list. Analyze the root cause.
- A connection attempt failed: OBS cannot be connected. Check the network condition.
Command Line Structure
The commands for managing OBS data with KooCLI have the following structure:
hcloud obs command [parameters...] [options...]
To enter the interactive mode in Windows:
- Run the following command to enter the interactive mode:
hcloud obs
- Manage your OBS data with commands in the following structure:
command [parameters...] [options...]
For example:
hcloud obs Enter "exit" or "quit" to logout Enter "help" or "help command" to show help docs Input your command: -->ls -limit=3 -s obs://bucket-001 obs://bucket-002 obs://bucket-003 Bucket number: 3
- command indicates the command to be executed, for example, ls or cp.
- parameters indicates the basic parameters (mandatory) of the command, for example, name of a bucket to be created.
- options indicates additional parameters (optional) of the command. Additional parameters must be preceded with a hyphen (-) when you run the command. Enter a parameter in the -key=value or -key value format, for example, -acl=private or -acl private. There is no difference between the two formats. Select either one as you like.
- The brackets ([]) are not part of the command. Do not enclose parameter values with brackets when entering a command.
- If the command contains special characters such as ampersands (&), angle brackets (<>), and spaces, escape these parameters using single quotation marks (Linux and macOS) or quotation marks (Windows).
The following table lists the OBS operation commands supported by KooCLI. The parameters of each command are the same as those in obsutil. For details about these parameters, see Bucket Commands, Object Commands, and Auxiliary Commands.
Category |
Command |
Function |
Description |
Command Line Structure |
---|---|---|---|---|
Bucket commands |
mb |
Create bucket |
Create a bucket with a unique name. Each account can create a maximum of 100 buckets. |
hcloud obs mb obs://bucket [-fs] [-az=xxx] [-acl=xxx] [-sc=xxx] [-location=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
ls |
List buckets |
Obtain the bucket list. The buckets are displayed in lexicographical order of their names. |
hcloud obs ls [-s] [-du] [-sc] [-j=1] [-limit=1] [-format=default] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
stat |
Query bucket properties |
Query the basic properties of a bucket, including the default storage class, region, version, support for POSIX, AZ, number of objects, storage usage, and bucket quota. |
hcloud obs stat obs://bucket [-acl] [-bf=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
chattri |
Set bucket properties |
Set the properties of a bucket, including storage classes and access policies. |
hcloud obs chattri obs://bucket [-sc=xxx] [-acl=xxx] [-aclXml=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
rm |
Delete bucket |
Delete a bucket that contains no objects, historical versions, or fragments. |
hcloud obs rm obs://bucket [-f] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
bucketpolicy |
Configure bucket policy |
Configure a bucket policy. |
hcloud obs bucketpolicy obs://bucket -method=put -localfile=xxx [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
Obtain bucket policy |
Obtain a bucket policy. |
hcloud obs bucketpolicy obs://bucket -method=get [-localfile=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
Delete bucket policy |
Delete a bucket policy. |
hcloud obs bucketpolicy obs://bucket -method=delete [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
Object commands |
mkdir |
Create folder |
Create a folder in a specified bucket or the local file system. |
|
cp |
Upload object |
Upload one or more local files or folders to a specified path in OBS. These files can be texts, images, or videos. |
|
|
Copy object |
Copy a single object or copy multiple objects with a specified name prefix. |
|
||
Download object |
Download an object or download multiple objects with a specified name prefix to your local PC. |
|
||
Resume failed upload task |
Resume a failed upload task based on the task ID. |
hcloud obs cp -recover=xxx [-arcDir=xxx] [-dryRun] [-f] [-u] [-vlength] [-vmd5] [-j=1] [-p=1] [-threshold=52428800] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-clear] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
Resume failed copy task |
Resume a failed copy task based on the task ID. |
hcloud obs cp -recover=xxx [-dryRun] [-f] [-u] [-crr] [-vlength] [-vmd5] [-j=1] [-p=1] [-threshold=52428800] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-clear] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
Resume failed download task |
Resume a failed download task based on the task ID. |
hcloud obs cp -recover=xxx [-dryRun] [-tempFileDir=xxx] [-f] [-u] [-vlength] [-vmd5] [-j=1] [-p=1] [-threshold=52428800] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-clear] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
stat |
Query object properties |
Query the basic properties of an object. |
hcloud obs stat obs://bucket/key [-acl][-bf=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
chattri |
Set object properties |
Set properties of a single object or of multiple objects with a specified name prefix. |
|
|
ls |
List objects |
Query objects or object versions in a bucket. All objects are displayed in lexicographical order of their names or versions. |
hcloud obs ls obs://bucket[/prefix] [-s] [-d] [-v] [-du] [-marker=xxx] [-versionIdMarker=xxx] [-bf=xxx] [-limit=1] [-format=default] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
List multipart upload tasks |
Query multipart upload tasks in a bucket. |
hcloud obs ls obs://bucket[/prefix] [-s] [-d] -m [-a] [-uploadIdMarker=xxx] [-marker=xxx] [-limit=1] [-format=default] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
mv |
Move object |
Move a single object or move multiple objects with a specified name prefix. |
|
|
sign |
Generate object download link |
Generate a download link for a specified object in a bucket or generate download links for multiple objects with a specified name prefix in a bucket. |
|
|
rm |
Delete object |
|
|
|
sync |
Synchronously upload incremental objects |
Synchronize all content in a local source path to a specified target OBS bucket to keep data consistency. Incremental synchronization has the following meanings:
|
|
|
Synchronously copy incremental objects |
Synchronize all objects in a specified path of the source bucket to a specified path in the destination bucket to keep data consistency. Incremental synchronization has the following meanings:
|
hcloud obs sync obs://srcbucket[/key] obs://dstbucket[/dest] [-dryRun] [-crr] [-vlength] [-vmd5] [-j=1] [-p=1] [-threshold=52428800] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
Synchronously download incremental objects |
Synchronize all objects in a specified path of the source OBS bucket to a target local path to keep data consistency. Incremental synchronization has the following meanings:
|
hcloud obs sync obs://bucket[/key] folder_url [-tempFileDir=xxx] [-dryRun] [-vlength] [-vmd5] [-j=1] [-p=1] [-threshold=52428800] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
||
restore |
Restore objects from OBS archive |
Restore a specified object whose storage class is cold or restore multiple objects with a specified name prefix. |
|
|
abort |
Delete multipart upload task |
|
|
|
create-share |
Create authorization code for directory sharing |
Create an authorization code for directory sharing by specifying a bucket name, object name prefix, and access code. |
hcloud obs create-share obs://bucket[/prefix] [-ac=xxx] [-vp=xxx] [-dst=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
share-ls |
List objects by using authorization code |
Query objects in a bucket with an authorization code. The returned objects are displayed in lexicographical order of their names. |
|
|
share-cp |
Download objects by using authorization code |
Download a single object or download multiple objects with a specified name prefix to your local PC by using an authorization code. |
|
|
Auxiliary commands |
config |
Update configuration file |
Update some items in the .obsutilconfig file, including the endpoint, AK, SK, and token. For details about the parameters in .obsutilconfig, see Parameter Description. |
|
clear |
Delete part records |
Delete part records from a specified directory. |
hcloud obs clear [checkpoint_dir] [-u] [-d] [-c] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx] |
|
help |
View command help information |
View the supported OBS commands or the help information of a specific command. |
hcloud obs help [command] |
|
version |
View version |
View the version of the integrated obsutil. |
hcloud obs version |
|
archive |
Archive log files |
Archive log files to a local PC or to a specified bucket. |
|
|
ls |
List failure result files |
List the last modified failure result files generated by the cp or sync commands in a specified folder. |
hcloud obs ls -failed [-limit=1000] [-o=xxx] |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot