Ozone2 Command Line Interface

This storage Ozone2 shell is the primary interface to interact with Ozone2 from the command line.

Volume operations

Note

Ozone ACL limits volume creation permissions to ozone admins only.

# CREATE VOLUME # authenticate user with kinit, in case of kerberized cluster $ ozone2 --config /etc/ozone2/conf/ozone.om sh volume create testvol OR $ ozone2 --config /etc/ozone2/conf/ozone.om sh volume create o3://${om_service_id}/testvol
# VOLUME INFO $ ozone2 --config /etc/ozone2/conf/ozone.om sh volume info testvol 24/05/02 07:41:31 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 24/05/02 07:41:31 INFO client.ClientTrustManager: Loading certificates for client. { "metadata" : { }, "name" : "testvol", "admin" : "ambari-qa", "owner" : "ambari-qa", "quotaInBytes" : -1, "quotaInNamespace" : -1, "usedNamespace" : 0, "creationTime" : "2024-05-02T05:10:09.564Z", "modificationTime" : "2024-05-02T05:10:09.564Z", "acls" : [ { "type" : "USER", "name" : "ambari-qa", "aclScope" : "ACCESS", "aclList" : [ "ALL" ] }, { "type" : "GROUP", "name" : "ambari-qa", "aclScope" : "ACCESS", "aclList" : [ "ALL" ] }, { "type" : "GROUP", "name" : "hadoop", "aclScope" : "ACCESS", "aclList" : [ "ALL" ] } ], "refCount" : 0 }
# LIST VOLUME $ ozone2 --config /etc/ozone2/conf/ozone.om sh volume list --all
# DELETE VOLUME $ ozone2 --config /etc/ozone2/conf/ozone.om sh volume delete testvol 24/05/02 07:44:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 24/05/02 07:44:15 INFO client.ClientTrustManager: Loading certificates for client. Volume testvol is deleted

If the volume contains any buckets or keys, we can delete the volume recursively. This will delete all keys and buckets within the volume, and then delete the volume itself. After running this command there is no way to recover deleted contents.

$ ozone2 sh volume delete -r testvol This command will delete volume recursively. There is no recovery option after using this command, and no trash for FSO buckets. Delay is expected running this command. Enter 'yes' to proceed': yes Volume testvol is deleted

Bucket operation

# CREATE BUCKET # authenticate user with kinit before accessing below commands, in case of kerberized cluster $ ozone2 --config /etc/ozone2/conf/ozone.om sh bucket create /testvol/bucket OR $ ozone2 --config /etc/ozone2/conf/ozone.om sh bucket create o3://${om_service_id}/testvol/bucket

By default, all buckets are created to support file system (FILE_SYSTEM_OPTIMIZED).

# BUCKET INFO $ ozone2 --config /etc/ozone2/conf/ozone.om sh bucket info /testvol/bucket 24/05/02 14:21:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 24/05/02 14:21:53 INFO client.ClientTrustManager: Loading certificates for client. { "metadata" : { }, "volumeName" : "testvol", "name" : "bucket", "storageType" : "DISK", "versioning" : false, "usedBytes" : 276, "usedNamespace" : 1, "creationTime" : "2024-04-23T11:35:07.893Z", "modificationTime" : "2024-04-23T11:35:07.893Z", "sourcePathExist" : true, "quotaInBytes" : -1, "quotaInNamespace" : -1, "bucketLayout" : "FILE_SYSTEM_OPTIMIZED", "owner" : "hdfs", "link" : false }
# DELETE BUCKET $ ozone2 --config /etc/ozone2/conf/ozone.om sh bucket delete /testvol/bucket 24/05/02 08:57:32 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 24/05/02 08:57:33 INFO client.ClientTrustManager: Loading certificates for client. Bucket bucket is deleted

If the bucket contains any keys, we can delete the bucket recursively. This will delete all the keys within the bucket, and then the bucket itself. After running this command there is no way to recover deleted contents.

$ ozone2 sh bucket delete -r /testvol/bucket This command will delete bucket recursively. There is no recovery option after using this command, and deleted keys won't move to trash. Enter 'yes' to proceed': yes Bucket bucket is deleted

Key operation

# UPLOAD KEY $ ozone2 --config /etc/ozone2/conf/ozone.om sh key put /testvol/bucket/README.md ./README.md
# KEY INFO $ ozone2 --config /etc/ozone2/conf/ozone.om sh key info /testvol/testbuck/README.md 24/05/02 14:34:02 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 24/05/02 14:34:03 INFO client.ClientTrustManager: Loading certificates for client. { "volumeName" : "testvol", "bucketName" : "testbuck", "name" : "README.md", "dataSize" : 92, "creationTime" : "2024-04-23T11:36:55.386Z", "modificationTime" : "2024-04-23T11:36:58.194Z", "replicationConfig" : { "replicationFactor" : "THREE", "requiredNodes" : 3, "replicationType" : "RATIS" }, "metadata" : { }, "ozoneKeyLocations" : [ { "containerID" : 1001, "localID" : 113750153625601001, "length" : 92, "offset" : 0, "keyOffset" : 0 } ], "file" : true }
# Getting key on local system $ ozone2 --config /etc/ozone2/conf/ozone.om sh key get /testvol/testbuck/README.md /tmp/ 24/05/02 14:40:19 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 24/05/02 14:40:20 INFO client.ClientTrustManager: Loading certificates for client. 24/05/02 14:40:22 WARN impl.MetricsConfig: Cannot locate configuration: tried hadoop-metrics2-xceiverclientmetrics.properties,hadoop-metrics2.properties 24/05/02 14:40:22 INFO impl.MetricsSystemImpl: Scheduled Metric snapshot period at 10 second(s). 24/05/02 14:40:22 INFO impl.MetricsSystemImpl: XceiverClientMetrics metrics system started root@o301:~# ls /tmp/README.md /tmp/README.md root@o301:~# cat /tmp/README.md Hi this is test README file. It is part of test volume /testvol and test bucket 'testbuck'.
# DELETE KEY $ ozone2 sh key delete /vol1/bucket1/key1 $ ozone2 --config /etc/ozone2/conf/ozone.om sh key delete /testvol/testbuck/README.md

If the key is in an FSO bucket it will be moved to the trash when deleted. Location of trash folder /<volume>/<bucket>/.Trash/<user>. If the key is in an OBS bucket it will be permanently deleted.

  Last updated