Adding JSON Table Replicas

You can register a MapR Database JSON table as a replica of another MapR Database JSON table using MCS and CLI. When you add a replica using the MCS, you can also setup and start replication between a source MapR Database JSON table to a replica MapR Database JSON table. Before you begin, complete the steps to prepare MapR clusters for table replication.

Adding JSON Table Replica Using the MapR Control System

To create a replica:
  1. Go to the table information page.
  2. Click Replicas tab.
    The list of replicas associated with the table displays.
  3. Click Add Replica.
    The Add Replica page displays.
  4. Specify the following settings:
    Destination Cluster The destination cluster for the replica, where gateways are configured to allow source cluster to send updates.
    Path to Replica
    The path to the replica.
    • For a table on the local cluster, start the path at the volume mount point. For example, for a table named testdst under a volume with a mount point at /volume1, specify the following path: /volume1/testdst
    • For a table on another cluster, you must also specify the cluster name in the path. For example, for a table named customerdst under volume1 in the sanfrancisco cluster, specify the following path: /mapr/sanfrancisco/volume1/customerdst
    Note: For replication to a table, the command will fail if the replica path you specify points to table that already exists.
    Replication State Specify whether or not to start replication by choosing one of the following:
    • Automatic Setup — Creates the table on the destination cluster, registers the table on the destination cluster as a replica, adds the current table as an upstream source, copies the content of the current table into the replica, and starts replication.
    • Pause Replication — Registers the table on the destination cluster as a replica and adds the current table as an upstream source, but prevents replication from immediately starting after. Pausing replica like this allows you to load the data into the replica from the current table, after which you can restart replication.
      Note: Although visible, this option is not supported if the source or replica is on a remote secure cluster.
    Multi-Master Setup (Available only with Automatic Setup) Multi-master topology, in which there are two master-slave relationships, with each table playing both the role of a master and a slave. Client applications update both tables and each table replicates updates to the other.

    See Multi-Master replication.

    If this is not selected, table replication will be basic master-slave topology. In this topology, you replicate one way from source tables to replicas. The replicas can be in a remote cluster or in the cluster where the source tables are located.

    See Master-slave replication.

    Note: Access control expressions on the replica that control permissions for updates to column families and columns are irrelevant because all updates from a source table arrive at a replica after having been authenticated at a gateway, which has the implicit authority to update replicas.
  5. Set the following optional properties:
    Throttle Specify whether (Yes) or not (No) to throttle replication operations. Throttle the replication stream to minimize the impact of the replication process on incoming operations during periods of heavy load.
    Replicate Synchronously Specify whether replication is synchronous (Yes) or asynchronous (No). See Modes of replication for more information.
    Encrypt On Wire Specify whether (Yes) or not (No) to enable on-wire encryption. If you enable this, the local cluster and any other cluster that is part of the replication process must be enabled for security.
    Compress On Wire The type of on-wire compression. Choose one of the following:
    • Inherited
    • OFF
    • LZF
    • LZ4
    • ZLib
  6. Choose whether to:
    • Replicate Entire Document
    • Replicate Selected Field Paths — Specify the full path to the field in dotted notation. For example, suppose the table contained JSON documents that were of this general structure:
      {
           "_id" : "ID",
           "a" :
                {
                     "b" : 
                          {
                               "c" : "value",
                          },
                     "e" : "value"
                }
      }
      To replicate field c, you must specify a.b.c as the field path. Do not use quotation marks and do not include spaces after each dot. Click:
      • Add Field to add another field to replicate.
      • to remove a field.
    By default, the entire document in the source table is replicated.
    Note: If a field is added at a later date, replication for that field will start at that time.
  7. Click Add Replica.
    A table with the specified fields is created in the destination cluster, the new table is declared to be a replica of the source table, and the source table is registered as an upstream source for the replica.

Adding JSON Table Replica Using the CLI or the REST API

To add a replica, run the following command:

maprcli table replica add -path <table path> -replica <replica table path>
To run this command, your user ID must have the following permissions:
  • readAce and writeAce on both the source volume and the target volume
  • lookupdir on directories in the paths of both tables
  • readperm and replperm permissions on the source table
For complete reference information, see table replica add.
Note: You also have the option to use maprcli table replica autosetup which will setup and start replication. For more information, see table replica autosetup.