2017-08-04 13:15:34 -07:00
---
title : Rook Client
2017-09-07 13:56:09 -07:00
weight : 40
2017-08-04 13:15:34 -07:00
---
2017-02-21 16:10:27 -08:00
# Using Rook
2017-08-07 12:13:18 -07:00
The `rookctl` client tool can be used to manage your Rook cluster once it is running as well as manage block, file and object storage. See the sections below for details on how to configure each type of storage.
If you don't yet have a Rook cluster running, refer to our [Quickstart Guides ](../README.md#quickstart-guides ).
2017-06-20 12:39:29 -07:00
`rookctl` can be accessed in the following ways:
2017-08-07 12:13:18 -07:00
2017-06-20 12:39:29 -07:00
- Kubernetes: Start the [toolbox ](toolbox.md ) pod
2017-02-21 16:10:27 -08:00
## Block Storage
2017-08-07 12:13:18 -07:00
2017-08-02 13:32:15 -07:00
1. Create a new pool and volume image (10MB)
2017-02-21 16:10:27 -08:00
```bash
2017-11-28 15:26:44 -08:00
rookctl pool create --name rbd --replica-count 1
2017-06-20 12:10:30 -07:00
rookctl block create --name test --size 10485760
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Map the block volume and format it and mount it
2017-02-21 16:10:27 -08:00
` ``bash
2017-06-20 12:39:29 -07:00
# If running in the toolbox container, no need to run privileged
2017-06-20 12:10:30 -07:00
rookctl block map --name test --format --mount /tmp/rook-volume
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Write and read a file
2017-02-21 16:10:27 -08:00
` ``bash
echo "Hello Rook!" > /tmp/rook-volume/hello
cat /tmp/rook-volume/hello
` ``
2017-05-05 07:35:47 -07:00
1. Cleanup
2017-02-21 16:10:27 -08:00
` ``bash
2017-06-20 12:39:29 -07:00
# If running in the toolbox container, no need to run privileged
2017-06-20 12:10:30 -07:00
rookctl block unmap --mount /tmp/rook-volume
2017-02-21 16:10:27 -08:00
` ``
## Shared File System
2017-08-07 12:13:18 -07:00
2017-02-21 16:10:27 -08:00
1. Create a shared file system
` ``bash
2017-11-28 15:26:44 -08:00
rookctl filesystem create --name testfs --data-replica-count 1 --metadata-replica-count 1
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Verify the shared file system was created
2017-02-21 16:10:27 -08:00
` ``bash
2017-06-20 12:10:30 -07:00
rookctl filesystem ls
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Mount the shared file system from the cluster to your local machine
2017-02-21 16:10:27 -08:00
` ``bash
2017-06-20 12:39:29 -07:00
# If running in the toolbox container, no need to run privileged
2017-11-28 15:26:44 -08:00
rookctl filesystem mount --name testfs --path /tmp/rookFS
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Write and read a file to the shared file system
2017-02-21 16:10:27 -08:00
` ``bash
echo "Hello Rook!" > /tmp/rookFS/hello
cat /tmp/rookFS/hello
` ``
2017-05-05 07:35:47 -07:00
1. Unmount the shared file system (this does **not** delete the data from the cluster)
2017-02-21 16:10:27 -08:00
` ``bash
2017-06-20 12:39:29 -07:00
# If running in the toolbox container, no need to run privileged
2017-06-20 12:10:30 -07:00
rookctl filesystem unmount --path /tmp/rookFS
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Cleanup the shared file system from the cluster (this **does** delete the data from the cluster)
2017-02-21 16:10:27 -08:00
` ``
2017-11-28 15:26:44 -08:00
rookctl filesystem delete --name testfs
2017-02-21 16:10:27 -08:00
` ``
## Object Storage
2017-08-07 12:13:18 -07:00
2017-02-21 16:10:27 -08:00
1. Create an object storage instance in the cluster
` ``bash
2017-11-28 15:26:44 -08:00
rookctl object create -n my-store --data-replica-count 1 --metadata-replica-count 1
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Create an object storage user
2017-02-21 16:10:27 -08:00
` ``bash
2017-11-28 15:26:44 -08:00
rookctl object user create my-store rook-user "my object store user"
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
### Consume the Object Storage
2017-08-07 12:13:18 -07:00
2017-05-05 07:35:47 -07:00
Use an S3 compatible client to create a bucket in the object store. If you are running in Kubernetes,
the s3cmd tool is included in the [Rook toolbox](toolbox.md) pod.
1. Get the connection information for accessing object storage
2017-02-21 16:10:27 -08:00
` ``bash
2017-11-28 15:26:44 -08:00
eval $(rookctl object connection my-store rook-user --format env-var)
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Create a bucket in the object store
2017-02-21 16:10:27 -08:00
` ``bash
2017-11-02 00:17:33 +01:00
s3cmd mb --no-ssl --host=${AWS_HOST} --host-bucket= s3://rookbucket
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. List buckets in the object store
2017-02-21 16:10:27 -08:00
` ``bash
2017-11-28 15:26:44 -08:00
rookctl object bucket list my-store
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Upload a file to the newly created bucket
2017-02-21 16:10:27 -08:00
` ``bash
echo "Hello Rook!" > /tmp/rookObj
2017-11-02 00:17:33 +01:00
s3cmd put /tmp/rookObj --no-ssl --host=${AWS_HOST} --host-bucket= s3://rookbucket
2017-02-21 16:10:27 -08:00
` ``
2017-05-05 07:35:47 -07:00
1. Download and verify the file from the bucket
2017-02-21 16:10:27 -08:00
` ``bash
2017-11-02 00:17:33 +01:00
s3cmd get s3://rookbucket/rookObj /tmp/rookObj-download --no-ssl --host=${AWS_HOST} --host-bucket=
2017-02-21 16:10:27 -08:00
cat /tmp/rookObj-download
` ``