CREATE REPOSITORY

Description

Creates a repository in a remote storage system that is used to store data snapshots for backing up and restoring data.

CAUTION

Only users with the ADMIN privilege can create a repository.

For detailed instructions on deleting a repository, see DROP REPOSITORY.

Syntax

CREATE [READ ONLY] REPOSITORY <repository_name>
WITH BROKER 
ON LOCATION "<repository_location>"
PROPERTIES ("key"="value", ...)

Parameters

ParameterDescription
READ ONLYCreate a read-only repository. Note that you can only restore data from a read-only repository. When creating the same repository for two clusters to migrate data, you can create a read-only repository for the new cluster and only grant it RESTORE permissions.
repository_nameRepository name.
repository_locationLocation of the repository in the remote storage system.
PROPERTIESThe credential method for accessing the remote storage system.

NOTE

CelerData supports creating repositories in AWS S3 only according to the S3A protocol. Therefore, when you create repositories in AWS S3, you must replace s3:// in the S3 URI you pass as a repository location in ON LOCATION with s3a://.

PROPERTIES:

PropertyRequiredDescription
aws.s3.use_instance_profileYesSpecifies whether to allow instance profile and assumed role as credential methods for accessing AWS S3. Valid values: true and false. Default value: false.
aws.s3.iam_role_arnNoThe ARN of the IAM role that has privileges on the AWS S3 bucket in which your data files are stored. If you want to use assumed role as the credential method for accessing AWS S3, you must specify this parameter. Then, CelerData will assume this role when it analyzes your Hive data by using a Hive catalog.
aws.s3.regionYesThe region in which your AWS S3 bucket resides. Example: us-west-1.

Examples

Example 1: Create a repository named s3_repo1 in the Amazon S3 bucket test_bucket using instance profile as the credential method.

CREATE REPOSITORY test_repo
WITH BROKER
ON LOCATION "s3a://test_bucket/backup"
PROPERTIES(
    "aws.s3.use_instance_profile" = "true",
    "aws.s3.region" = "us-west-2"
);

Example 2: Create a read-only repository named s3_repo2 in the Amazon S3 bucket test_bucket using assumed role as the credential method.

CREATE READ ONLY REPOSITORY s3_repo2
WITH BROKER
ON LOCATION "s3a://test_bucket/backup"
PROPERTIES(
    "aws.s3.use_instance_profile" = "true",
    "aws.s3.iam_role_arn" = "arn:aws:iam::xxxxxxx:role/yyyyyyyyy",
    "aws.s3.region" = "us-west-2"
);