Commands for managing buckets

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.