CDP CLI for Replication Manager

You can use CDP CLI commands to create and manage HDFS and Hive replication policies in Replication Manager. The CDP CLI commands for Replication Manager are under the replicationmanager CDP CLI option.

To use CDP CLI for Replication Manager, ensure that the following are available:

  1. CDP CLI client. For more information about installing a CDP CLI client, see Installing CDP CLI client.

  2. Access to CDP CLI. You can choose one of the following methods to log into CDP CLI:

    • Interactive method. This login method grants a 12-hour access key to the CLI. For more information, see Logging into CLI/SDK.
    • Traditional method. In this method, you generate access credentials and configure the ~/.cdp/credentials file with the key pair. This login method allows you to withdraw the access permission by removing the access credentials from the ~/.cdp/credentials file. For more information, see Generating an API access key and Configuring CDP client with the API access key.

CDP CLI options for Replication Manager

You can use the following CDP CLI options to perform tasks in Replication Manager:

CDP CLI option Usage Description
activate-policy replicationmanager activate-policy --cluster-crn [***cluster_crn***] --policy-name [***policy_name***] Resumes the specified suspended policy.
create-policy replicationmanager create-policy --cluster-crn [***cluster_crn***] --policy-name [***policy_name***] --policy-definition [***policy_definition***] [--cli-input-json [****cli input json***] [--generate-cli-skeleton] Creates an HDFS or Hive replication policy based on the provided parameters. Provide source CRN for HDFS replication policies and target CRN for Hive replication policies.
delete-policy replicationmanager delete-policy --cluster-crn [***cluster_crn***] --policy-name [***policy_name***] Deletes the specified replication policy.
get-credentials replicationmanager --cluster-crn [***cluster_crn***] --credentialName [***credential_name***] --credentialId [***credential_id***] Shows the credentials for a specified cluster.
list-all-credentials replicationmanager list-all-credentials Lists all the credentials in all the clusters.
list-cluster-service-statuses replicationmanager list-cluster-service-statuses Lists the current status of the services on the specified cluster.
list-clusters replicationmanager list-clusters

Lists the clusters that are available for Replication Manager.

list-policies replicationmanager list-policies Lists the available replication policies.
suspend-policy replicationmanager suspend-policy --cluster-crn [***cluster_crn***] --policy-name [***policy_name***] Suspends a running policy.

CDP CLI options to create a policy

Only a non-machine user can run the replicationmanager create-policy CDP CLI command to create a replication policy. The following parameters are available in the replicationmanager create-policy CDP CLI option:

Parameter Description

Enter the cluster CRN where the policy is created. Enter the source cluster CRN for HDFS replication policy, and enter the destination cluster CRN for Hive replication policy.

Run list-clusters command to view the required cluster CRN.

--policy-name Enter a unique name for the replication policy.
--policy-definition Enter the policy definition in the $(cat [***policy_definition_file_name***]) format, and then enter the cluster CRN and policy name as command arguments.
--cli-input-json Enter the policy definition JSON file path using the cat command to read the data from the file to create and run a replication policy.
--generate-cli-skeleton Shows a policy definition template in JSON format. You can copy the output of this command to a file, add the required parameters, and save it as a JSON file. You can use the filename while creating a replication policy.