Ozone Command Line Interface

The Ozone Command Line Interface (CLI) serves as the primary tool for interacting with Ozone from the command line.

Volume Operations

Volume operations in Ozone are governed by ACLs (Access Control Lists), restricting volume creation permissions to ozone admins only.

Commands

  • Create Volume: To create a volume, use the following command:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh volume create testvol

Or specify the OM service ID:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh volume create o3://${om_service_id}/testvol
  • Volume Info: Retrieve information about a volume using:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh volume info testvol
  • List Volumes: List all volumes with:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh volume list --all
  • Delete Volume: To delete a volume, execute:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh volume delete testvol

For recursive deletion (including all keys and buckets within the volume), use:

$ ozone sh volume delete -r testvol

Confirm deletion by entering 'yes' when prompted.

Bucket Operations

Interact with buckets in Ozone using the following commands:

  • Create Bucket: To create a bucket, use:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh bucket create /testvol/bucket

Or specify the OM service ID:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh bucket create o3://${om_service_id}/testvol/bucket

By default, buckets are configured to support the file system (FILE_SYSTEM_OPTIMIZED).

  • Bucket Info: Retrieve information about a bucket with:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh bucket info /testvol/bucket
  • Delete Bucket: Delete a bucket using:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh bucket delete /testvol/bucket

For recursive deletion (including all keys within the bucket), utilize:

$ ozone sh bucket delete -r /testvol/bucket

Confirm deletion by entering 'yes' when prompted. This will delete all the keys within the bucket, and then the bucket itself. After running the command there is no way to recover deleted contents.

Key Operations

Perform various operations on keys in Ozone using the following commands:

  • Upload Keys: Upload a key to a specified location:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh key put /testvol/bucket/README.md ./README.md
  • Key Info: Retrieve information about a key:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh key info /testvol/testbuck/README.md
  • Get Key on Local System: Download a key to the local system:

$ ozone --config /etc/hadoop-ozone/conf/ozone.om sh key get /testvol/testbuck/README.md /tmp/
  • Delete Key: To delete the key:

$ ozone sh key delete /vol1/bucket1/key1 $ ozone --config /etc/hadoop-ozone/conf/ozone.om sh key delete /testvol/testbuck/README.md

If the key is in an FSO (File System Optimized) bucket, it will be moved to the trash upon deletion. The location of the trash folder is /volume/bucket/.Trash/user. If the key is in an OBS (Object Store) bucket, it will be permanently deleted.

  Last updated