Title
Create new category
Edit page index title
Edit category
Edit link
Ozone2 Command Line Interface
This storage Ozone2 shell is the primary interface to interact with Ozone2 from the command line.
Volume operations
Ozone ACL limits volume creation permissions to ozone admins only.
xxxxxxxxxx# CREATE VOLUME# authenticate user with kinit, in case of kerberized cluster$ ozone2 --config /etc/ozone2/conf/ozone.om sh volume create testvolOR$ 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 testvol24/05/02 07:41:31 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable24/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}xxxxxxxxxx# 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 testvol24/05/02 07:44:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable24/05/02 07:44:15 INFO client.ClientTrustManager: Loading certificates for client.Volume testvol is deletedIf 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.
xxxxxxxxxx$ ozone2 sh volume delete -r testvolThis 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': yesVolume testvol is deletedBucket operation
xxxxxxxxxx# 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/bucketOR$ ozone2 --config /etc/ozone2/conf/ozone.om sh bucket create o3://${om_service_id}/testvol/bucketBy 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/bucket24/05/02 14:21:52 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable24/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/bucket24/05/02 08:57:32 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable24/05/02 08:57:33 INFO client.ClientTrustManager: Loading certificates for client.Bucket bucket is deletedIf 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.
xxxxxxxxxx$ ozone2 sh bucket delete -r /testvol/bucketThis 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': yesBucket bucket is deletedKey operation
xxxxxxxxxx# 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.md24/05/02 14:34:02 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable24/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 applicable24/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.properties24/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 startedroot@o301:~# ls /tmp/README.md/tmp/README.mdroot@o301:~# cat /tmp/README.mdHi this is test README file.It is part of test volume /testvol and test bucket 'testbuck'.xxxxxxxxxx# DELETE KEY$ ozone2 sh key delete /vol1/bucket1/key1$ ozone2 --config /etc/ozone2/conf/ozone.om sh key delete /testvol/testbuck/README.mdIf 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.