Setting Up Master-Slave Replication

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.

You can set up the basic master-slave replication or one of its variations.

Note: All updates from a source table arrive at a replica after having been authenticated at a gateway. Therefore, access control expressions on the replica that control permissions for updates to column families and columns are irrelevant; gateways have the implicit authority to update replicas.
Basic Master-Slave Replication

In this diagram, changes to the customers table in the sanfrancisco cluster are replicated to the customers table in the newyork cluster. The blue circles represent MapR gateways.

Figure: An example of basic master-slave replication

In this diagram, changes to the customersA table in the sanfrancisco cluster are replicated to the customersB table within the same cluster.

Many-to-One Replication

In this topology, two or more source tables replicate to a single replica.

In this diagram, the clusters sanfrancisco, hyderabad, and tokyo each have a table named customers. The operations on these tables are replicated to a replica in the newyork cluster. The blue circles represent gateways.

One-to-Many Replication

In this topology, a single source table replicates to two or more replicas.

In this diagram, the operations on the customers table in the cluster sanfrancisco are replicated to replicas in the newyork, tokyo, and hyderabad clusters. The blue circles represent gateways.

Master-Slave Replication in Two Directions

In this topology, a source table in replicates to a replica in a destination cluster, while a source table in that destination cluster replicates to a replica in the cluster where the first source table is located.

This replication topology is a variation of master-slave replication.

In this diagram, operations on the customers table in the sanfrancisco cluster are replicated to the newyork cluster. At the same time, operations on the products table in the newyork cluster are replicated to the sanfrancisco cluster.

Replication Loop

This replication topology is a variation of master-slave replication in which three or more clusters participate. Any one of the clusters can initiate the replication of an operation to each of the other clusters in succession.

In this diagram, there is a customers table in each of the four clusters sanfrancisco, newyork, hyderabad, and tokyo. Client applications on each cluster update the local copy of the table. MapR-DB replicates each operation serially around the loop, ending at the cluster before the originating cluster. For example, if a table operation originates in tokyo, that cluster replicates the operation to sanfrancisco. The operation is replicated from there to newyork and from there to hyderabad. Replication of the operation ends at hyderabad. MapR-DB tags each operation with a universally unique identifier (UUID) that identifies the table where the operation originated.

To set up master-slave replication:

Note: If you are setting up a replication loop for n clusters, repeat these steps for n-1 master-slave relationships to set up basic master-slave topologies.

  1. Log into both the source and destination clusters.
  2. To set up this replication topology, follow either of these procedures:
    Note: Although these procedures describe the steps to take in the maprcli, you can set up these replication topologies in the MapR Control Service (MCS). Log into MCS and select MapR Tables in the navigation menu. Select a table to be the source table and click the Replicas tab. The actions for setting up replication are in this location.