Bidirectional replication example of two active clusters
Review the bidirectional replication example to learn how you can configure and start
replication with Streams Replication Manager in a deployment with two active clusters configured
with bidirectional replication.
In a typical scenario, you may have two active Kafka clusters within the same region but in
separate availability zones. With bidirectional replication, clients can connect to either
cluster in case one is temporarily unavailable.
This example demonstrates the steps required to configure the deployment shown below.
Additionally, it also provides example commands to start replication between clusters.
The following list of steps assume that both clusters are unsecured.
The following list of steps assume that the Streams Replication Manager Service role is
running on all Kafka broker hosts and is targeting its co-located cluster (the cluster it
is running in).
Steps 1 through 6 must be carried out on all clusters for all SRM services. The steps
highlight when the configuration differs from cluster to cluster or if it is identical on
all clusters.
The following list of steps assume that the
DefaultReplicationPolicy is in use.
Define external clusters:
In Cloudera Manager, go to
Administration > External
Accounts.
Go to the Kafka Credentials tab.
On this
tab you will create a credential for each external cluster taking part in the
replication process.
Click Add Kafka credentials.
Configure the Kafka credential:
On the primary cluster you have
to add a credential that defines secondary. For
example:
If credential creation is
successful, a new entry corresponding to the Kafka credential you specified appears on
the page.
Define the co-located Kafka cluster:
In Cloudera Manager, go to Clusters and select the
Streams Replication Manager service.
Go to Configuration.
Find and enable the Kafka Service
property.
Find and configure the Streams Replication Manager Co-located
Kafka Cluster Alias property.
The alias you configure
represents the co-located cluster. Enter an alias that is unique and easily
identifiable. On the primary cluster:
primary
On the secondary
cluster:
secondary
Add the clusters defined with Kafka credentials to SRM’s configuration:
Find and configure the External Kafka Accounts
property.
Click the add button and add new lines for each Kafka credential you
created.
Add the names of all Kafka credentials.
Each Kafka credential
must be added to a new line. On the primary cluster:
secondary
On
the secondary cluster:
primary
Find and configure the Streams Replication Manager Cluster
alias property.
Add all cluster aliases to this property. This
includes the aliases present in both the External Kafka Accounts and Streams
Replication Manager Co-located Kafka Cluster Alias properties. Delimit the aliases
with commas. In the case of this example the configuration is identical on both
clusters:
primary, seconadry
Configure Driver role target clusters:
Find the Streams
Replication Manager Driver Target Cluster property.
Add the cluster aliases that you want the driver role to target.
In the case of this example, each Driver should target its co-located
cluster. On the primary cluster:
primary
On the secondary
cluster:
secondary
Add and enable replications:
Find the Streams Replication Manager's Replication
Configs property.
Click the add button and add new lines for each unique replication you want
to add and enable.
Add and enable your replications.
In the case of this example, the configuration will be identical on both
clusters: