Setting Up Table Replication Using the CLI
You can run the maprcli table replica autosetup
command to set up
master-slave or multi-master replication from an existing source table.
Prerequisites
maprcli
to automatically
setup table replication. As an alternative, you can use the MapR Control Service (MCS) to automatically setup table replication or
use the maprcli
to manually setup
master-slave replication or manually setup
multi-master replication.Complete the following steps before you begin:
- Verify that you have complete the steps to configure the clusters for table replication. For more information, see Preparing Clusters for Table Replication.
- Run the
maprcli table info
command on the source table 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.
-
- Run the
maprcli table info
command on the destination table (if it already exists) 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.
-
About this task
Procedure
- Log into both the source and destination clusters.
-
Run the
maprcli table replica autosetup
command.- For master-slave replication:
maprcli table replica autosetup -path <path to source table> -replica <path to replica>
- For multi-master replication:
maprcli table replica autosetup -path <path to source table> -replica <path to replica> -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 thesanfrancisco
cluster and a newcustomers
table in thenewyork
cluster, you could use this command:maprcli table replica autosetup -path /mapr/sanfrancisco/customers -replica /mapr/newyork/customers -multimaster true
To set up master-slave replication between thecustomersA
table in thesanfrancisco
cluster and a newcustomersB
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. - For master-slave replication:
- To check the replication status, run table replica list.
What to do next
- With multi-master replication, if one of the tables goes offline, 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
-
You can check for alarms related to replication and whether synchronous replication is switched temporarily to asynchronous replication by looking in MCS. See Table-Replication Alarms.