Setting Up Stream Replication Using the CLI
Describes how to run the maprcli stream replica autosetup
command to
set up primary-secondary or multi-master replication from an existing source
stream.
About this task
maprcli
command to manually set up
primary-secondary replication.- You must replicate all of the topics that are in a stream. You cannot select only a subset of topics to replicate.
- The maximum number of replicas that a stream can replicate to is 64.
- The maximum number of upstream sources that a replica can accept data from is 64.
- In multi-master replication, names of topics must be unique on all streams. Messages are assigned sequential offsets. The offsets for messages in a topic in one copy could conflict with the offsets for messages in the other copy. As a result, messages could be lost.
- In many-to-one replication, topics with the same name should not be replicated to an aggregate replica.
In general, you should store your streams on their own volumes to avoid overlap with volume mirroring. Otherwise, if a source volume fails, you may have a scenario where a stream in the promoted mirror lags behind the stream's replica. See Preparing Clusters for Table Replication for more details.
Set up replication automatically by following these steps:
Procedure
- Log into both the source and destination clusters.
-
Run the command
maprcli stream replica autosetup
:- For primary-secondary
replication:
maprcli stream replica autosetup -path <path to source stream> -replica <path to replica stream>
For example, to set up primary-secondary replication from the
activity
stream in thesanfrancisco
cluster to a newactivity
stream in thenewyork
cluster, you could use this command:maprcli stream replica autosetup -path /mapr/sanfrancisco/activity -replica /mapr/newyork/activity
- For multi-master replication:
maprcli stream replica autosetup -path <path to source stream> -replica <path to replica stream> -multimaster yes
For example, to set up multi-master replication between the
activity
stream in thesanfrancisco
cluster and a newactivity
stream in thenewyork
cluster, you could use this command:maprcli stream replica autosetup -path /mapr/sanfrancisco/activity -replica /mapr/newyork/activity -multimaster yes
NOTEThe parameter-multimaster
is an optional parameter that you use to set up multi-master replication.
NOTEBy default,maprcli stream replica autosetup
sets up asynchronous replication. If you want to set up synchronous replication or use any of the other optional parameters, seestream replica autosetup
. - For primary-secondary
replication:
- To check the replication status, run stream replica list.