How to Prevent the Leader from Switching to the Same City in a Non-Dual-Active Design

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 应用非双活设计情况下,怎么控制Leader不会切换到同城

| username: TiDBer_iLonNMYE

【TiDB Usage Environment】Production\Test Environment\POC
【TiDB Version】V5
【Encountered Problem】High availability design issue
【Reproduction Path】What operations were performed that caused the issue
【Problem Phenomenon and Impact】
In a scenario with two data centers in the same city, raft will automatically elect a leader during a leader switch, which may switch to a node in the same city. Since the application is not designed for active-active, how can we control the leader to be elected only in the local data center? Can this be achieved with labels? Thank you.

| username: BraveChen | Original post link

Yes, it is possible to control the leader to be in only one data center, allowing that data center to provide read and write capabilities.

| username: TiDBer_iLonNMYE | Original post link

How can this be done? By labeling?

| username: BraveChen | Original post link

I’m looking at this section of the official documentation. I’ve seen it before and have an impression of it: Same-City Multi-Data Center Deployment TiDB | PingCAP Docs

| username: TiDBer_iLonNMYE | Original post link

Okay, thank you. It’s just that there is no description of how to do it specifically.

| username: BraveChen | Original post link

I remember there is a case, take a look at this one! Placement Rules 使用文档 | PingCAP Docs

| username: TiDBer_iLonNMYE | Original post link

Got it, it’s Placement Rule. Thanks.

| username: system | Original post link

This topic was automatically closed 1 minute after the last reply. No new replies are allowed.