2018-05-22 13:49:10 -04:00
|
|
|
---
|
|
|
|
title: Command Shell
|
|
|
|
menu: main
|
|
|
|
---
|
2017-06-20 00:29:18 -04:00
|
|
|
<!---
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License. See accompanying LICENSE file.
|
|
|
|
-->
|
2018-06-07 17:10:52 -04:00
|
|
|
# Ozone Command Shell
|
2017-06-20 00:29:18 -04:00
|
|
|
|
2018-06-07 17:10:52 -04:00
|
|
|
|
|
|
|
Ozone command shell gives a command shell interface to work against Ozone.
|
2017-06-20 00:29:18 -04:00
|
|
|
Please note that this document assumes that cluster is deployed
|
|
|
|
with simple authentication.
|
|
|
|
|
|
|
|
The Ozone commands take the following format.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh --command_ /volume/bucket/key -user <username> [-root]
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
2018-06-07 17:10:52 -04:00
|
|
|
The `port` specified in command should match the port mentioned in the config
|
2018-04-12 11:51:44 -04:00
|
|
|
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.
|
2017-10-11 17:31:57 -04:00
|
|
|
|
2018-09-16 01:12:47 -04:00
|
|
|
The `-root` option is a command line short cut that allows *ozone fs*
|
2017-06-20 00:29:18 -04:00
|
|
|
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.
|
|
|
|
|
2018-06-07 17:10:52 -04:00
|
|
|
## Volume Commands
|
|
|
|
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
The volume commands allow users to create, delete and list the volumes in the
|
|
|
|
ozone cluster.
|
|
|
|
|
|
|
|
### Create Volume
|
2018-06-07 17:10:52 -04:00
|
|
|
Volumes can be created only by administrators. Here is an example of creating a volume.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -createVolume hive -user bilbo -quota 100TB -root
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
The above command creates a volume called `hive` owned by user `bilbo`. The
|
2018-04-12 11:51:44 -04:00
|
|
|
`-root` option allows the command to be executed as user `hdfs` which is an
|
2017-06-20 00:29:18 -04:00
|
|
|
admin in the cluster.
|
|
|
|
|
|
|
|
### Update Volume
|
|
|
|
Updates information like ownership and quota on an existing volume.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -updateVolume hive -quota 500TB -root
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
The above command changes the volume quota of hive from 100TB to 500TB.
|
|
|
|
|
|
|
|
### Delete Volume
|
|
|
|
Deletes a Volume if it is empty.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -deleteVolume /hive -root
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### Info Volume
|
2018-06-07 17:10:52 -04:00
|
|
|
Info volume command allows the owner or the administrator of the cluster
|
|
|
|
to read meta-data about a specific volume.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -infoVolume /hive -root
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### List Volumes
|
2018-06-07 17:10:52 -04:00
|
|
|
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.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -listVolume / -user bilbo
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
The above command lists all volumes owned by user bilbo.
|
|
|
|
|
2018-06-07 17:10:52 -04:00
|
|
|
## Bucket Commands
|
2017-06-20 00:29:18 -04:00
|
|
|
|
2018-06-07 17:10:52 -04:00
|
|
|
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.
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### Create Bucket
|
|
|
|
Create bucket call allows the owner of a volume to create a bucket.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -createBucket /hive/january
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
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.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -updateBucket /hive/january -addAcl user:spark:rw
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
### Delete Bucket
|
|
|
|
Deletes a bucket if it is empty.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -deleteBucket /hive/january
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### Info Bucket
|
|
|
|
Returns information about a given bucket.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -infoBucket /hive/january
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### List Buckets
|
2018-06-07 17:10:52 -04:00
|
|
|
List buckets in a given volume.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -listBucket /hive
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
2018-06-07 17:10:52 -04:00
|
|
|
## Ozone Key Commands
|
2017-06-20 00:29:18 -04:00
|
|
|
|
2018-06-07 17:10:52 -04:00
|
|
|
Ozone key commands allows users to put, delete and get keys from Ozone buckets.
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### Put Key
|
2018-06-07 17:10:52 -04:00
|
|
|
Creates or overwrites a key in Ozone store, -file points to the file you want
|
2017-06-20 00:29:18 -04:00
|
|
|
to upload.
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -putKey /hive/january/processed.orc -file processed.orc
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### Get Key
|
2018-06-07 17:10:52 -04:00
|
|
|
Downloads a file from the Ozone bucket.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -getKey /hive/january/processed.orc -file processed.orc.copy
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### Delete Key
|
2018-06-07 17:10:52 -04:00
|
|
|
Deletes a key from the Ozone store.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -deleteKey /hive/january/processed.orc
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### Info Key
|
2018-06-07 17:10:52 -04:00
|
|
|
Reads key metadata from the Ozone store.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -infoKey /hive/january/processed.orc
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|
|
|
|
### List Keys
|
2018-06-07 17:10:52 -04:00
|
|
|
List all keys in an Ozone bucket.
|
|
|
|
```
|
2018-09-16 01:12:47 -04:00
|
|
|
ozone sh -listKey /hive/january
|
2018-06-07 17:10:52 -04:00
|
|
|
```
|
2017-06-20 00:29:18 -04:00
|
|
|
|