Setting Up Primary-Secondary Replication Manually
You can run maprcli commands to set up primary-secondary replication
manually.
Procedure
-
Ensure that you have followed these prerequisite steps:
- 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 infocommand 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 infocommand 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.
-
-
Create the replica manually with the
maprclicommandtable create. Use the-copymetafromoption to ensure that the metadata for the replica is identical to the metadata for the source table. Metadata includes column families, access control expressions (ACEs), and other attributes.maprcli table create -path <path to the replica> -copymetafrom <path to the source table>For example, to create the replicacustomersin thenewyorkcluster and use the metadata from the source table in thesanfranciscocluster, you could use this command:maprcli table create -path /mapr/newyork/customers -copymetafrom /mapr/sanfrancisco/customers -
Register the replica as a replica of the source table by running the
maprcli table replica addcommand.maprcli table replica add -path <path to the source table> -replica <path to the replica> -paused trueFor example, to register thecustomerstable in thenewyorkcluster as a replica of thecustomerstable in thesanfranciscocluster, you could use this command:maprcli table replica add -path /mapr/sanfrancisco/customers -replica /mapr/newyork/customers -paused trueThe-pausedparameter ensures that replication does not start immediately after you register the source table as a source for this replica. You do this registration in step 4.NOTEFor more information about additional parameters that you can configure, see table replica add. -
Verify that you specified the correct replica by running the
maprcli table replica listcommand.maprcli table replica list -path <path to the source table>To verify that the customers table in thenewyorkcluster is a replica of thecustomerstable in thesanfranciscocluster, you could look at the output of this command:maprcli table replica list -path /mapr/sanfrancisco/customers -
Authorize replication between the tables by defining the source table as the
upstream table for the replica by running the
maprcli table upstream addcommand. Definition of the upstream table ensures that a table cannot replicate updates to any replica. Replication depends on a two-way agreement between the owners of the two tables.maprcli table upstream add -path <path to the replica> -upstream <path to the source table>To add thecustomerstable in thesanfranciscocluster as an upstream source for thecustomerstable in thenewyorkcluster:maprcli table upstream add -path /mapr/newyork/customers -upstream /mapr/sanfrancisco/customers -
Verify that you specified the correct source table by running the
maprcli table upstream listcommand.maprcli table upstream list -path <path to the replica>To verify this in our example scenario, you could use this command:maprcli table upstream list -path /mapr/newyork/customers -
If you set
-pausedtotruewhen adding the replica, follow these steps:
What to do next
- 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 the Control System. See Table-Replication Alarms.