The Ozone shell commands enable you to create, delete, view, and list buckets. Before
running these commands, you must have configured the Ozone Service ID for
your cluster from the Configuration tab of the Ozone service on Cloudera
Manager.
Creating a bucket
Command Syntax
ozone sh bucket create URI
Purpose
Creates a bucket in the specified volume.
Arguments
URI: The name of the bucket to create in the
<prefix>://<Service ID>/<volumename>/<bucketname>
format.
Example
ozone sh bucket create o3://ozone1/vol1/buck1
This
command creates a bucket buck1 in the volume vol1. Here, ozone1 is the Ozone Service
ID.
Deleting a bucket
Command Syntax
ozone sh bucket delete URI
Purpose
Deletes the specified bucket, which must be empty.
Arguments
URI: The name of the bucket to delete in the
<prefix>://<Service ID>/<volumename>/<bucketname>
format.
Example
ozone sh bucket create o3://ozone1/vol1/buck2
This
command deletes the empty bucket buck2. Here, ozone1 is the Ozone Service
ID.
Viewing bucket information
Command Syntax
ozone sh bucket info URI
Purpose
Provides information about the specified bucket.
Arguments
URI: The name of the bucket whose details you want to view, in the
<prefix>://<Service ID>/<volumename>/<bucketname>
format.
Example
ozone sh bucket info o3://ozone1/vol1/buck3
This command
provides information about bucket buck3. Here, ozone1 is the Ozone Service
ID.
Listing buckets
Command Syntax
ozone sh bucket list URI --length=<number_of_buckets> --prefix=<bucket_prefix> --start=<starting_bucket>
Purpose
Lists all the buckets in a specified volume.
Arguments
-l, length: Specifies the maximum number of results to return. The
default is 100.
-p, prefix: Lists bucket names that match the specified prefix.
-s, start: Returns results starting with the bucket after
the specified value.
URI: The name of the volume whose buckets you want to list, in the
<prefix>://<Service ID>/<volumename>/ format.
Example
ozone sh bucket list o3://ozone1/vol2 --length=100 --prefix=buck --start=buck
This
command lists 100 buckets belonging to volume vol2 and names starting with the
prefix buck. Here, ozone1 is the Ozone Service ID.
Setting bucket Space level quota
Command Syntax
ozone sh bucket setquota --space-quota <volumecapacity> /volume/bucket
Purpose
Manage the quota of the specific bucket under a bucket.
Arguments
--space-quota <volumecapacity>: Specifies the maximum size the
volume can occupy in the cluster.
Example
ozone sh bucket setquota --space-quota 10GB /volume1/bucket1
This
command sets volume1/bucket1 space quota to 10GB.
Clearing bucket Space level quota
Command Syntax
ozone sh bucket clrquota --space-quota /volume/bucket
Purpose
Clear the space quota of the bucket.
Arguments
--space-quota: Specifies the space quota of a bucket.
Example
ozone sh bucket clrquota --space-quota /volume1/bucket1
This
command clears the space quota of bucket1.
Check space level quota for bucket
Command Syntax
ozone sh bucket info /volume/bucket
Purpose
Get the quota value and usedBytes info of the bucket.
Arguments
-
Example
ozone sh bucket info /volume1/bucket1
This
command gets the quota value and usedBytes info of bucket1.
Setting Namespace quota
Namespace quota is a number that represents how many unique names can be used. This number
cannot be greater than LONG.MAX_VALUE in Java.
Command Syntax
ozone sh bucket create --namespace-quota <volumecapacity> /volume/bucket
Purpose
Manage the quota of the namespace bucket.
Arguments
--namespace-quota <volumecapacity>: Specifies the namespace quota of a
bucket.
Example
ozone sh bucket create --namespace-quota 100 /volume1/bucket1
This
command sets the namespace quota of bucket1 to 100.
Clearing bucket spacelvel quota
Command Syntax
ozone sh bucket clrquota --namespace-quota /volume/bucket
Purpose
Clear the namespace quota of the bucket.
Arguments
--namespace-quota: Specifies the namespace quota of a bucket.
Example
ozone sh bucket clrquota --namespace-quota /volume1/bucket1
This
command clears the namespace quota of bucket1.
Check Namespace level quota for bucket
Command Syntax
ozone sh bucket info /bucket
Purpose
Get the quota value and usedNamespace info of the bucket.
Arguments
-
Example
ozone sh bucket info /bucket1
This command gets the quota
value and usedNamespace of bucket1.