Setting Up Table Replication Using the CLI

You can run the maprcli table replica autosetup command to set up primary-secondary or multi-master replication from an existing source table.

Prerequisites

NOTE
This procedure describes how to use the maprcli to automatically set up table replication. As an alternative, you can use the Control System to automatically setup table replication or use the maprcli command to manually setup primary-secondary replication or manually setup multi-master replication.

Before you begin, complete the following steps:

  • Verify that you have completed the steps to configure the clusters for table replication. For more information, see Preparing Clusters for Table Replication.
  • On the source table, run the maprcli table info command to verify that you have the following permissions:
    • readperm, which is required for reading from the table.
    • replperm, which is required for replicating from the table.
    On the destination table (if it already exists), run the maprcli table info command to verify that you have the following permissions:
    • bulkload, which is required for the initial copy of source data into the destination table.
    • replperm, which is required for receiving replicated updates from the source table.
    All updates from a source table arrive at a replica after having been authenticated at a gateway. Therefore, access control expressions on the replica that control permissions for updates to column families and columns are irrelevant; gateways have implicit authority to update replicas.

About this task

NOTE
If you are setting up a primary-secondary replication loop for n clusters, repeat these steps for n-1 primary-secondary relationships to set up basic primary-secondary topologies.

Procedure

  1. Log into both the source and destination clusters.
  2. Run the maprcli table replica autosetup command.
    • For primary-secondary replication:
      maprcli table replica autosetup -path /mapr/<source cluster>/<path to table> -replica /mapr/<destination cluster>/<path to table>
    • For multi-master replication:
      maprcli table replica autosetup -path /mapr/<source cluster>/<path to table> -replica /mapr/<destination cluster>/<path to table> -multimaster true
      NOTE

      The parameter -multimaster is an optional parameter that you use to set up multi-master replication.

    For example, to set up multi-master replication between the customers table in the sanfrancisco cluster and a new customers table in the newyork cluster, you could use this command:

    maprcli table replica autosetup -path /mapr/sanfrancisco/customers -replica /mapr/newyork/customers -multimaster true
    To set up primary-secondary replication between the customersA table in the sanfrancisco cluster and a new customersB table in the same cluster, you could use this command:
    maprcli table replica autosetup -path /mapr/sanfrancisco/customersA -replica /mapr/sanfrancisco/customersB
    NOTE
    For information about additional parameters that you can configure, see table replica autosetup.
  3. To check the replication status, run table replica list.

What to do next

Additional Information:
  • With multi-master replication, if one of the tables goes offline, you can direct client applications to the other table. For more information, see Multi-Master Replication.
  • Be aware that changes to the structure of a source table are not replicated automatically to replicas. For more information, see Adding a Column Family to a Replica
  • Check the Control System for alarms related to replication and whether synchronous replication is switched temporarily to asynchronous replication. See Table-Replication Alarms.