Creating Hive replication policy using CDP CLI

You can use CDP CLI to create an Hive replication policy. Only a non-machine user can run the "replicationmanager create-policy" CDP CLI command to create a replication policy.

  1. Log into Replication Manager CDP CLI setup:
    cdp --profile [***PROFILE NAME***] replicationmanager
  2. List the clusters to verify whether the required clusters are available:
    cdp --profile [***PROFILE NAME***] replicationmanager list-clusters
  3. Verify whether the required services are running on the source cluster:
    cdp --profile [***PROFILE NAME***] replicationmanager list-cluster-service-statuses
  4. Ensure that the cloud credentials are available:
    cdp --profile [***PROFILE NAME***] replicationmanager list-all-credentials
  5. Perform the following steps to create a policy definition JSON file.
    1. Open a policy definition JSON file, or copy the output of the command to a JSON file to generate a policy definition JSON file.
      cdp --profile [***PROFILE NAME***] replicationmanager create-policy --generate-cli-skeleton
      cdp --profile hive1 replicationmanager create-policy --generate-cli-skeleton > rm_hive1.json
    2. Enter the required parameters. Remove the key-value pairs that are not required in the policy definition JSON file for the specific policy.
    3. Save the file.
  6. Create the Hive replication policy.
    cdp --profile [***PROFILE NAME***] replicationmanager create-policy --cli-input-json [****POLICY DEFINITION JSON FILE PATH USING CAT***]
    The cat command reads the data from the policy definition JSON file.
    cdp --profile local-dev replicationmanager create-policy --cli-input-json “$(cat temp/rm_hive1.json)”
Replication Manager creates the replication policy and initiates data replication.
Verify whether the replication policy is running as expected on the Cloudera Replication Manager > Replication Policies page, or run the following command:
cdp --profile [***PROFILE NAME***] replicationmanager list-policies --cluster-crn [***CRN OF THE CLUSTER WHERE THE REPLICATION POLICIES ARE STORED***]