Skip to content

Caching Remote Buckets (User Guide)

Barak Sason Rofman edited this page May 31, 2021 · 13 revisions

This is a user guide for using the namespace cache feature to cache remote buckets using local storage resources.

For more information on caching use cases and design please refer to - TODO.

Step 0 - Prerequisites

  1. NooBaa installed in Kubernetes - see https://github.com/noobaa/noobaa-core#deploy-to-kubernetes
  2. noobaa cli - get from https://github.com/noobaa/noobaa-operator/releases
  3. Account credentials to the Hub

Step 1 - Connect to the Hub

Use check_external_connection to check if the provided hub details are good - that the hub is accessible and the credentials work. Use add_external_connection to actually create the hub connection.

noobaa api account_api check_external_connection '{
  "endpoint_type": "S3_COMPATIBLE",
  "endpoint": "s3.hub.com",
  "identity": "123",
  "secret": "abc"
}'

noobaa api account_api add_external_connection '{
  "name": "hub",
  "endpoint_type": "S3_COMPATIBLE",
  "endpoint": "s3.hub.com",
  "identity": "123",
  "secret": "abc"
}'

Step 2 - Configure local storage

You can use any of the supported backing store types as the local cache storage. See the docs - https://github.com/noobaa/noobaa-operator/blob/master/doc/backing-store-crd.md

If you don't have any backing stores or prefer to create a new one:

noobaa backingstore create pv-pool noobaa-default-backing-store [--storage-class=classname] --num-volumes=1 --pv-size-gb=32

If the default backing store already exists but is used, and you create a new one for the cache, we then need to create the bucket tiering policy and tier manually - TODO...

Step 3 - Create a Cache Bucket

For every remote bucket create a namespace resource and a bucket with cache policy:

noobaa api pool_api create_namespace_resource '{
  "name": "hub-bucket1",
  "connection": "hub",
  "target_bucket": "bucket1"
}'

noobaa api bucket_api create_bucket '{
  "name": "bucket1-cached",
  "namespace":{
    "write_resource": {"resource": "hub-bucket1"},
    "read_resources": [{"resource": "hub-bucket1"}],
    "caching": { "ttl_ms": 60000 }
  }
}'

Step 4 - Connect an Application

Create account for the application - copy the access_key and secret_key from the response:

noobaa api account_api create_account '{
  "name": "app1",
  "email": "[email protected]",
  "has_login": false,
  "s3_access": true,
  "allow_bucket_creation": false,
  "allowed_buckets": {
    "full_permission": false,
    "permission_list": ["bucket1-cached"]
  }
}'

Application S3 config:

AWS_ACCESS_KEY_ID=<from create_account response>
AWS_SECRET_ACCESS_KEY=<from create_account response>
S3_ENDPOINT=s3.noobaa.svc
BUCKET_NAME=bucket1-cached

Step 5 - Monitoring the Cache

  • TODO Cache space utilization
  • TODO Cache hit/miss rates
  • TODO Performance

Troubleshooting

The following commands provide troubleshooting information:

kubectl get pod
kubectl logs noobaa-core-0
kubectl get events --sort-by=lastTimestamp
noobaa status
noobaa api system_api read_system
noobaa api bucket_api list_buckets
noobaa api account_api list_accounts '{}'
Clone this wiki locally