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.
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.
-
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
- Log into both the source and destination clusters.
-
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
NOTEThe 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 primary-secondary 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
NOTEFor information about additional parameters that you can configure, see table replica autosetup. - For primary-secondary 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, 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.