Perform a planned failover to the secondary AWS Region
You can conduct a planned failover to test the resiliency of your application against an unexpected event in your primary AWS region which has your source MSK cluster. A planned failover should not result in data loss.
If you’re using Identical topic name replication configuration, follow these steps:
Shutdown all producers and consumers connecting to your source cluster.
Create a new MSK Replicator to replicate data from your MSK cluster in the secondary Region to your MSK cluster in the primary Region with Identical topic name replication (Keep the same topics name in console). This is required to copy the data that you will be writing to the secondary region back to the primary Region so that you can failback to the primary Region after the unexpected event has ended.
Start producers and consumers connected to the target cluster in the secondary AWS Region.
If you’re using Prefixed topic name configuration, follow these steps to failover:
Shutdown all producers and consumers connecting to your source cluster.
Create a new MSK Replicator to replicate data from your MSK cluster in the secondary Region to your MSK cluster in the primary Region. This is required to copy the data that you will be writing to the secondary region back to the primary Region so that you can failback to the primary Region after the unexpected event has ended.
Start producers on target cluster in the secondary AWS Region.
Depending on your application’s message ordering requirements, follow the steps in one of the following tabs.
Wait for all the consumers of replicated topics on the target MSK cluster to finish processing all data, so that consumer lag is 0 and the number of records processed is also 0. Then, stop consumers for the replicated topics on target cluster. At this point, all records that were replicated from the source MSK cluster to target MSK cluster have been consumed.
Start consumers for the local topics (for example,
topic
) on the target MSK cluster.