--- title: Command Shell menu: main --- # Ozone Command Shell Ozone command shell gives a command shell interface to work against Ozone. Please note that this document assumes that cluster is deployed with simple authentication. The Ozone commands take the following format. ``` ozone oz --command_ /volume/bucket/key -user [-root] ``` The `port` specified in command should match the port mentioned in the config property `hdds.rest.http-address`. This property can be set in `ozone-site.xml`. The default value for the port is `9880` and is used in below commands. The `-root` option is a command line short cut that allows *ozone oz* commands to be run as the user that started the cluster. This is useful to indicate that you want the commands to be run as some admin user. The only reason for this option is that it makes the life of a lazy developer more easier. ## Volume Commands The volume commands allow users to create, delete and list the volumes in the ozone cluster. ### Create Volume Volumes can be created only by administrators. Here is an example of creating a volume. ``` ozone oz -createVolume hive -user bilbo -quota 100TB -root ``` The above command creates a volume called `hive` owned by user `bilbo`. The `-root` option allows the command to be executed as user `hdfs` which is an admin in the cluster. ### Update Volume Updates information like ownership and quota on an existing volume. ``` ozone oz -updateVolume hive -quota 500TB -root ``` The above command changes the volume quota of hive from 100TB to 500TB. ### Delete Volume Deletes a Volume if it is empty. ``` ozone oz -deleteVolume /hive -root ``` ### Info Volume Info volume command allows the owner or the administrator of the cluster to read meta-data about a specific volume. ``` ozone oz -infoVolume /hive -root ``` ### List Volumes List volume command can be used by administrator to list volumes of any user. It can also be used by any user to list their own volumes. ``` ozone oz -listVolume / -user bilbo ``` The above command lists all volumes owned by user bilbo. ## Bucket Commands Bucket commands follow a similar pattern as volume commands. However bucket commands are designed to be run by the owner of the volume. Following examples assume that these commands are run by the owner of the volume or bucket. ### Create Bucket Create bucket call allows the owner of a volume to create a bucket. ``` ozone oz -createBucket /hive/january ``` This call creates a bucket called `january` in the volume called `hive`. If the volume does not exist, then this call will fail. ### Update Bucket Updates bucket meta-data, like ACLs. ``` ozone oz -updateBucket /hive/january -addAcl user:spark:rw ``` ### Delete Bucket Deletes a bucket if it is empty. ``` ozone oz -deleteBucket /hive/january ``` ### Info Bucket Returns information about a given bucket. ``` ozone oz -infoBucket /hive/january ``` ### List Buckets List buckets in a given volume. ``` ozone oz -listBucket /hive ``` ## Ozone Key Commands Ozone key commands allows users to put, delete and get keys from Ozone buckets. ### Put Key Creates or overwrites a key in Ozone store, -file points to the file you want to upload. ``` ozone oz -putKey /hive/january/processed.orc -file processed.orc ``` ### Get Key Downloads a file from the Ozone bucket. ``` ozone oz -getKey /hive/january/processed.orc -file processed.orc.copy ``` ### Delete Key Deletes a key from the Ozone store. ``` ozone oz -deleteKey /hive/january/processed.orc ``` ### Info Key Reads key metadata from the Ozone store. ``` ozone oz -infoKey /hive/january/processed.orc ``` ### List Keys List all keys in an Ozone bucket. ``` ozone oz -listKey /hive/january ```