Sets up and starts replication between a source table and replica. 

The maprcli table replica autosetup command performs the following steps to set up replication:

  1. Creates a table with the required column families in the destination cluster.

  2. Declares the new table to be a replica of the source table and ensures that replication does not begin immediately after the next step.
  3. Declares the source table as an upstream source for the replica.
  4. Runs the CopyTable utility to load a copy of the source data into the replica.
  5. Clears the paused replication state to start the replication stream.

Required Permissions

The user that runs the command must have the following permissions for the replica:

  • Write permission on the directory where you want to create the replica

The user that runs the command must have the following permissions on the source table:

  • ACE permissions to perform column-family and column reads (readperm). 
  • ACE permissions to perform replication (replperm) 

Syntax

CLI

maprcli table replica autosetup
-path table path
-replica replica table path
[ -columns comma separated list of <family>[:<column>] ]
[ -synchronous is synchronous replication. default: false ]
[ -multimaster is multi master replication. default: false ]
[ -throttle throttle replication ops. default: false ]
[ -networkencryption enable on-wire encryption. default: false ]
[ -networkcompression on-wire compression type: off|on|lzf|lz4|zlib. default: on ]

RESThttp[s]://<host>:<port>/rest/table/replica/autosetup?path=<path>&replica=<path>...

Parameters

path

The path to the source table that you want to replicate.

  • For a path on the local cluster, start the path at the volume mount point. For example, for a table named testsrc under a volume with a mount point at /volume1, specify the following path: /volume1/testsrc
  • For a path on another cluster, you must also specify the cluster name in the path. For example, for a table named customersrc under volume1 in the sanfrancisco cluster, specify the following path:/mapr/sanfrancisco/volume1/customersrc
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 undervolume1 in the sanfrancisco cluster, specify the following path: /mapr/sanfrancisco/volume1/customerdst

For replication to a table, the command will fail if the replica path you specify points to table that already exists. 

columns

By default, all columns in the source table are replicated. If you do not want to replicate all columns in the table, you can specify specific columns to replicate. Provide a comma-separated list of column families or columns from a certain column family (column family:qualifier). For example, use the following syntax to replicate the column family purchases and the column stars in the reviews column family: -columns purchases,reviews:stars

While the column families that you specify must already exist in the source table, the columns that you specify do not have to exist in the destination table for replication to succeed. If the column is added at a later date, replication for that column will start at that time.
synchronousA Boolean value that specifies whether replication is synchronous or asynchronous. The values are true or false. Asynchronous (false) is the default.
multimasterA Boolean value that specifies whether or not to set up a multi-master topology. The values are true or false. Basic master-slave topology (false) is the default.
throttleA Boolean value that specifies whether or not to throttle replication operations. Throttle the replication stream to minimize the impact of the replication process on incoming operations during periods of heavy load. The values are true or false. No throttle (false) is the default.
networkencryptionA Boolean value that specifies whether or not to enable on-wire encryption. The values are true or false. No encryption (false) is the default. If you set this to true, the local cluster and any other cluster that is part of the replication process must be enabled for security.
networkcompression

The type of on-wire compression.

The types are:

  • off
  • on (default)
  • lzf
  • lz4 
  • zlib

lz4 is the default compression which it set by parameter values on or lz4.

Examples

CLI

maprcli table replica autosetup -path /volume1/custBsrc -replica /volume2/custBdst

RESThttps://<host>:<port>/rest/table/replica/autosetup?path=%2Fvolume2%2FcustAsrc&replica=%2Fvolume2%2FcustBdst