You can set up geo-replication using the Event Streams UI or CLI. You can then switch your applications to use another cluster when needed.
Ensure you plan for geo-replication before setting it up.
Defining destination clusters
To be able to replicate topics, you must define destination clusters. The process involves logging in to your intended destination cluster and copying its connection details to the clipboard. You then log in to the origin cluster and use the connection details to point to the intended destination cluster and define it as a possible target for your geo-replication.
Using the UI
- Log in to your destination Event Streams cluster as an administrator.
- Click Topics in the primary navigation and then click Geo-replication.
- Click the Origin locations tab, and click Generate connection information for this cluster.
- Copy the connection information to the clipboard. This information is what you need to specify the cluster as a destination for replication when you log in to your origin cluster.
Note: This information includes the security credentials for your destination cluster, which is then used by your origin cluster to authenticate with the destination. - Log in to your origin Event Streams cluster as an administrator.
- Click Topics in the primary navigation and then click Geo-replication.
- Click Add destination cluster on the Destination location tab.
- Paste the information you copied in step 4, wait for the validation of your payload to complete and click Connect cluster.
The cluster is added as a destination to where you can replicate topics to.
Note: When logged in to the destination cluster, the origin cluster will not show up in the Origin locations section until you define topics to replicate, and the geo-replicator is created.
Alternatively, you can also use the following steps:
- Log in to your destination Event Streams cluster as an administrator.
- Click Connect to this cluster on the right, and then go to the Geo-replication tab.
- Click the I want this cluster to be able to receive topics from another cluster tile.
- Copy the connection information to the clipboard. This information is what you need to specify the cluster as a destination for replication when you log in to your origin cluster.
Note: This step includes the security credentials for your destination cluster which is then used by your origin cluster to authenticate. - Log in to your origin Event Streams cluster as an administrator.
- Click Connect to this cluster on the right, and then go to the Geo-replication tab.
- Click I want to replicate topics from this cluster to another cluster.
- Paste the information you copied in step 4, wait for the validation of your payload to complete and click Connect cluster.
The cluster is added as a destination to where you can replicate topics to.
Note: When logged in to the destination cluster, the origin cluster will not show up in the Origin locations section until you define topics to replicate, and the geo-replicator is created.
Using the CLI
- Go to your destination cluster. Log in to your cluster as an administrator by using the IBM Cloud Pak CLI:
cloudctl login -a https://<cluster_address>:<cluster_router_https_port>
- Run the following command to initialize the Event Streams CLI:
cloudctl es init
- Run the following command to display the connection details for your destination cluster:
cloudctl es geo-cluster-connect
The command returns a base64 encoded string consisting of the API URL and the security credentials required for creating a destination cluster that should be used to configure geo-replication using the CLI. If the connection details are to be used to configure geo-replication using the UI, add the--json
option to return a JSON-formatted string. - Go to your origin cluster. Log in to your cluster as an administrator by using the IBM Cloud Pak CLI:
cloudctl login -a https://<cluster_address>:<cluster_router_https_port>
- Run the following command to initialize the Event Streams CLI:
cloudctl es init
- Run the following command to add the cluster as a destination to where you can replicate your topics to:
cloudctl es geo-cluster-add --cluster-connect <base64-encoded-string-from-step-3>
Specifying what and where to replicate
To select the topics you want to replicate and set the destination cluster to replicate to, use the following steps.
Using the UI
- Log in to your origin Event Streams cluster as an administrator.
- Click Topics in the primary navigation and then click Geo-replication.
- Choose a destination cluster to replicate to by clicking the name of the cluster from the Destination locations list.
-
Choose the topics you want to replicate by selecting the checkbox next to each, and click Geo-replicate to destination.
Tip: You can also click the icon in the topic’s row to add it to the destination cluster. The icon turns into a Remove button, and the topic is added to the list of topics that are geo-replicated to the destination cluster.Note: A prefix of the origin cluster name will be added to the name of the new replicated topic that is created on the destination cluster, resulting in replicated topics named such as
<origin-cluster>.<topic-name>
.Message history is included in geo-replication. This means all available message data for the topic is copied. The amount of history is determined by the message retention options set when the topics were created on the origin cluster.
- Click Create to create a geo-replicator for the selected topics on the chosen destination cluster. Geo-replication starts automatically when the geo-replicator for the selected topics is set up successfully.
Note: After clicking Create, it might take up to 5 to 10 minutes before geo-replication becomes active.
For each topic that has geo-replication set up, a visual indicator is shown in the topic’s row. If topics are being replicated from the cluster you are logged in to, the Geo-replication column displays the number of clusters the topic is being replicated to. Clicking the column for the topic expands the row to show details about the geo-replication for the topic. You can then click View to see more details about the geo-replicated topic in the side panel:
Using the CLI
To set up replication by using the CLI:
- Go to your origin cluster. Log in to your cluster as an administrator by using the IBM Cloud Pak CLI:
cloudctl login -a https://<cluster_address>:<cluster_router_https_port>
- Run the following command to initialize the Event Streams CLI:
cloudctl es init
- Choose a destination cluster to replicate to by listing all available destination clusters, making the ID of the clusters available to select and copy:
cloudctl es geo-clusters
- Choose the topics you want to replicate by listing your topics, making their names available to select and copy:
cloudctl es topics
- Specify the destination cluster to replicate to, and set the topics you want to replicate. Use the required destination cluster ID and topic names retrieved in the previous steps. List each topic you want to replicate by using a comma-separated list without spaces in between:
cloudctl es geo-replicator-create --destination <cluster-ID-from-step-3> --topics <comma-separated-list-of-topic-names-from-step-4>
Geo-replication starts automatically when the geo-replicator for the selected topics is set up successfully.
Note: A prefix of the origin cluster name will be added to the name of the new replicated topic that is created on the destination cluster, resulting in replicated topics named such as <origin-cluster>.<topic-name>
.
Message history is included in geo-replication. This means all available message data for the topic is copied. The amount of history is determined by the message retention option set when the topics were created on the origin cluster.
Considerations
Event Streams geo-replication uses Kafka’s MirrorMaker 2.0 to replicate data from the origin cluster to the destination cluster.
Replication Factor
Event Streams sets the number of replicas of geo-replicated topics to 3, or if there are fewer brokers available then to the number of brokers in the destination cluster.
If a different number of replicas are required on the destination topic, edit the value of the sourceConnector configuration property replication.factor on the MirrorMaker2 instance that is created by Event Streams for the geo-replication pairing. The change will apply to all new topics created by the geo-replicator on the destination cluster after the changes is made. It will not be applied to topics already configured for geo-replication.
Topic configuration
MirrorMaker 2.0 has a list of topic properties that are not copied from the source cluster topic:
follower.replication.throttled.replicas
leader.replication.throttled.replicas
message.timestamp.difference.max.ms
message.timestamp.type
unclean.leader.election.enable
min.insync.replicas
It is not possible to override the value of these properties using MirrorMaker 2.0 configuration, instead the values are taken from the settings of the destination cluster.
To query the current values set on the destination cluster:
- Go to your destination cluster. Log in to your cluster as an administrator by using the IBM Cloud Pak CLI:
cloudctl login -a https://<cluster_address>:<cluster_router_https_port>
- Run the following command to initialize the Event Streams CLI:
cloudctl es init
- List the broker configuration by using
cloudctl es broker 0
- Update the broker configuration to set these properties to the values if required before configuring geo-replication.