Setting Up Primary-Secondary Stream Replication Manually
Describes how to setup a primary-secondary stream replica that replicates in one direction.
About this task
Replica streams can be in a remote Data Fabric
cluster or in the Data Fabric cluster where their
source streams are located. All updates from a source stream arrive at a replica
stream after having been authenticated at a gateway. Therefore, the
produceperm access control expressions on the replica stream is
irrelevant; gateways have the implicit authority to publish messages to topics in
replica streams.
To set up primary-secondary replication of streams:
Procedure
-
Create the replica manually with the
maprcli stream createcommand. Use the-copymetafromoption to ensure that the metadata for the replica is identical to the metadata for the source stream.maprcli stream create -path <path to replica> -copymetafrom <path to source stream>For example, to create the replica
activityin thenewyorkcluster and use the metadata from the source stream in thesanfranciscocluster, you could use this command:maprcli stream create -path /mapr/newyork/activity -copymetafrom /mapr/sanfrancisco/activity -
Register the replica as a replica of the source stream by running the
maprcli stream replica addcommand.maprcli stream replica add -path <path to source stream> -replica <path to replica> -paused trueFor example, to register the
activitystream in thenewyorkcluster as a replica of theactivitystream in thesanfranciscocluster, you could use this command:maprcli stream replica add -path /mapr/sanfrancisco/activity -replica /mapr/newyork/activity -paused trueThe
-pausedparameter ensures that replication does not start immediately after you register the source stream as a source for this replica. You do this registration in step 4. -
Verify that you specified the correct replica by running the
maprcli stream replica listcommand.maprcli stream replica list -path <path to source stream>To verify that the
activitystream in thenewyorkcluster is a replica of theactivitystream in thesanfranciscocluster, you could look at the output of this command:maprcli stream replica list -path /mapr/sanfrancisco/activity -
Authorize replication between the streams by defining the source stream as the
upstream stream for the replica by running the
maprcli stream upstream addcommand.Definition of the upstream stream ensures that a stream cannot replicate updates to any replica. Replication depends on a two-way agreement between the owners of the two streams.maprcli stream upstream add -path <path to replica> -upstream <path to source stream>To add the
activitystream in thesanfranciscocluster as an upstream source for theactivitystream in thenewyorkcluster:maprcli stream upstream add -path /mapr/newyork/activity -upstream /mapr/sanfrancisco/activity -
Verify that you specified the correct source stream by running the
maprcli stream upstream listcommand.maprcli stream upstream list -path <path to the replica>To verify this in our example scenario, you could use this command:
maprcli stream upstream list -path /mapr/newyork/activity -
Load the replica with data from the source stream by using the
mapr copystreamutility. -
Start replication with the command
maprcli stream replica resume.maprcli stream replica resume -path <path to the source stream> -replica <path to the replica>For our example scenario, you could use this command:
maprcli stream replica resume -path mapr/sanfrancisco/activity -replica /mapr/newyork/activity