Skip to content

[26.1] Ordered rack/region preference for leader pinning#1598

Open
kbatuigas wants to merge 9 commits intov-WIP/26.1from
DOC-1607-Document-feature-Support-ordered-rack-region-preference-for-leader-pinning
Open

[26.1] Ordered rack/region preference for leader pinning#1598
kbatuigas wants to merge 9 commits intov-WIP/26.1from
DOC-1607-Document-feature-Support-ordered-rack-region-preference-for-leader-pinning

Conversation

@kbatuigas
Copy link
Contributor

@kbatuigas kbatuigas commented Mar 4, 2026

Description

This pull request updates the documentation for Leader Pinning in Redpanda, introducing support for the new ordered_racks configuration value and clarifying how Leader Pinning works, its limitations, and failover behavior. The changes enhance the explanation of how to configure Leader Pinning, especially for multi-region or multi-AZ deployments, and add guidance to avoid common pitfalls.

Key changes include:

Leader Pinning feature enhancements:

  • Added documentation for the new ordered_racks configuration, which allows specifying preferred racks in priority order for partition leaders. This enables explicit failover sequencing for disaster recovery scenarios and is supported in Redpanda v26.1 and later. [1] [2]
  • Clarified the difference between racks: (uniform distribution) and ordered_racks: (priority-based failover) in both the main Leader Pinning docs and the release notes. [1] [2]

Configuration and usage guidance:

  • Updated instructions and terminology throughout the Leader Pinning documentation to consistently capitalize "Leader Pinning" and reflect the new configuration options. [1] [2]
  • Added best practices to ensure replicas are placed in preferred racks, including when to set Leader Pinning properties and how to align replication factor with rack count.

Limitations and failover behavior:

  • Introduced a new "Limitations" section explaining scenarios where Leader Pinning cannot guarantee preferred leader placement, with actionable steps to avoid indefinite non-preferred leaders.
  • Expanded the failover documentation to describe how leader election proceeds with both racks: and ordered_racks: under AZ/rack failures.

These updates provide clearer, more actionable documentation for users configuring advanced leader placement strategies in Redpanda.

Resolves https://redpandadata.atlassian.net/browse/
Review deadline: 11 Mar

Page previews

Self-Managed - Leader Pinning
Topic properties > redpanda.leaders.preference
What's New
Cloud - Leader Pinning (need learning objectives added)

Checks

  • New feature
  • Content gap
  • Support Follow-up
  • Small fix (typos, links, copyedits, etc)

@kbatuigas kbatuigas requested a review from a team as a code owner March 4, 2026 16:28
@netlify
Copy link

netlify bot commented Mar 4, 2026

Deploy Preview for redpanda-docs-preview ready!

Name Link
🔨 Latest commit 1a1ec82
🔍 Latest deploy log https://app.netlify.com/projects/redpanda-docs-preview/deploys/69ab7ae227304d0008725490
😎 Deploy Preview https://deploy-preview-1598--redpanda-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 4, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 534b2a97-17f5-419e-a30c-57bd7d975ead

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch DOC-1607-Document-feature-Support-ordered-rack-region-preference-for-leader-pinning

Comment @coderabbitai help to get the list of available commands and usage tips.

@kbatuigas kbatuigas requested a review from joe-redpanda March 4, 2026 16:49

* Enable config_ref:enable_rack_awareness,true,properties/cluster-properties[`enable_rack_awareness`] to distribute replicas across racks automatically.
* Set config_ref:default_leaders_preference,true,properties/cluster-properties[`default_leaders_preference`] before creating topics, so that rack-aware replica placement aligns with the preferred racks.
* Use xref:manage:cluster-maintenance/cluster-balancing.adoc[partition balancing] to move existing replicas to preferred racks.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sufficient or should we link/mention a specific kind of balancing listed on this page? https://deploy-preview-1598--redpanda-docs-preview.netlify.app/current/manage/cluster-maintenance/cluster-balancing/

= Leader Pinning
:description: Learn about leader pinning and how to configure a preferred partition leader location based on cloud availability zones or regions.
:description: Learn about Leader Pinning and how to configure a preferred partition leader location based on cloud availability zones or regions.
:page-topic-type: how-to
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent this scenario:

* Enable config_ref:enable_rack_awareness,true,properties/cluster-properties[`enable_rack_awareness`] to distribute replicas across racks automatically.
* Set config_ref:default_leaders_preference,true,properties/cluster-properties[`default_leaders_preference`] before creating topics, so that rack-aware replica placement aligns with the preferred racks.
Copy link

@joe-redpanda joe-redpanda Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. The default leader preference will not influence the replica placement. As of right now there is no automatic solution for this scenario.

It is possible to place the replicas manually, though there is no guarantee that a balancer action will not move it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// tag::single-source[]

Produce requests that write data to Redpanda topics go through the topic partition leader, which syncs messages across its follower replicas. For a Redpanda cluster deployed across multiple availability zones (AZs), leader pinning ensures that a topic's partition leaders are geographically closer to clients, which helps decrease networking costs and guarantees lower latency.
Produce requests that write data to Redpanda topics route through the topic partition leader, which syncs messages across its follower replicas. For a Redpanda cluster deployed across multiple availability zones (AZs), Leader Pinning ensures that a topic's partition leaders are geographically closer to clients, which helps decrease networking costs and guarantees lower latency.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Produce requests that write data to Redpanda topics route through the topic partition leader, which syncs messages across its follower replicas. For a Redpanda cluster deployed across multiple availability zones (AZs), Leader Pinning ensures that a topic's partition leaders are geographically closer to clients, which helps decrease networking costs and guarantees lower latency.
Produce requests that write data to Redpanda topics are routed through the topic partition leader, which syncs messages across its follower replicas. For a Redpanda cluster deployed across multiple availability zones (AZs), Leader Pinning ensures that a topic's partition leaders are geographically closer to clients, which helps decrease networking costs and guarantees lower latency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, @kbatuigas can you add a glossterm for Leader Pinning and link to it from here? thx

Produce requests that write data to Redpanda topics route through the topic partition leader, which syncs messages across its follower replicas. For a Redpanda cluster deployed across multiple availability zones (AZs), Leader Pinning ensures that a topic's partition leaders are geographically closer to clients, which helps decrease networking costs and guarantees lower latency.

If consumers are located in the same preferred region or AZ for leader pinning, and you have not set up xref:develop:consume-data/follower-fetching.adoc[follower fetching], leader pinning can also help reduce networking costs on consume requests.
If consumers are located in the same preferred region or AZ for Leader Pinning, and you have not set up xref:develop:consume-data/follower-fetching.adoc[follower fetching], Leader Pinning can also help reduce networking costs on consume requests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking maybe you should also mention Cloud Topics, as this is another way to reduce networking costs (at a slight expense to latency, but great for logs, data not reliant on speed).

== Set leader rack preferences

You can use both a topic configuration property and a cluster configuration property to configure leader pinning.
You can use both a topic configuration property and a cluster configuration property to configure Leader Pinning.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an either/or? You can configure Leader Pinning using either a topic configuration property or cluster configuration property? Or, do you have to configure both the topic and cluster configs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the explanation for this sentence in a separate paragraph? Maybe keep together so people won't ask the same questions I asked above?

This configuration is based on the following scenario: you have Redpanda deployed in a multi-AZ or multi-region cluster, and you have configured each broker so that the config_ref:rack,true,properties/broker-properties[] configuration property contains racks corresponding to the AZs:

* Set the topic configuration property xref:reference:properties/topic-properties.adoc#redpandaleaderspreference[`redpanda.leaders.preference`]. The property accepts the following string values:
* Set the topic configuration property xref:reference:properties/topic-properties.adoc#redpanda-leaders-preference[`redpanda.leaders.preference`]. The property accepts the following string values:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Set the topic configuration property xref:reference:properties/topic-properties.adoc#redpanda-leaders-preference[`redpanda.leaders.preference`]. The property accepts the following string values:
* Set the topic configuration property xref:reference:properties/topic-properties.adoc#redpanda-leaders-preference[`redpanda.leaders.preference`]. This property accepts the following string values:

Comment on lines 51 to +65
This property inherits the default value from the cluster property `default_leaders_preference`.
+
To find the rack identifiers of all brokers, run:
+
[,bash]
----
rpk cluster info
----
+
To set the topic property:
+
[,bash]
----
rpk topic alter-config <topic-name> --set redpanda.leaders.preference=ordered_racks:<rack1>,<rack2>
----
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is part of the topic config, shouldn't it all be indented under that bullet?

Image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's appears it looks in Cloud, which looks correct:

Image

+
[,bash]
----
rpk cluster config set default_leaders_preference ordered_racks:<rack1>,<rack2>
Copy link
Contributor

@Feediver1 Feediver1 Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, why is this set/formatted differently from

rpk topic alter-config <topic-name> --set redpanda.leaders.preference=ordered_racks:<rack1>,<rack2>?

rpk cluster config set default_leaders_preference ordered_racks:<rack1>,<rack2>


ifdef::env-cloud[]
== Configure leader pinning
== Set leader rack preferences
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI--the learning objectives are not rendering in the Cloud output:

Image

Comment on lines +134 to +136
* A topic with `A` as the preferred leader AZ will have its partition leaders uniformly distributed across B and C.
* A topic with `A,B` as the preferred leader AZs will have its partition leaders in B.
* A topic with `B` as the preferred leader AZ will have its partition leaders in B as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* A topic with `A` as the preferred leader AZ will have its partition leaders uniformly distributed across B and C.
* A topic with `A,B` as the preferred leader AZs will have its partition leaders in B.
* A topic with `B` as the preferred leader AZ will have its partition leaders in B as well.
* The topic with `A` as the preferred leader AZ will have its partition leaders uniformly distributed across B and C.
* The topic with `A,B` as the preferred leader AZs will have its partition leaders in B.
* The topic with `B` as the preferred leader AZ will have its partition leaders in B as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first it was confusing to see the init "A"...especially since it is also the name of one of the AZs.

For a topic configured with `ordered_racks:A,B,C`:

If there are three AZs: A, B, and C, and A becomes unavailable, the failover behavior is as follows:
* A topic with `A` as the first-priority rack will have its partition leaders in A.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* A topic with `A` as the first-priority rack will have its partition leaders in A.
* The topic with `A` as the first-priority rack will have its partition leaders in A.

* A topic with “B” as the preferred leader AZ will have its partition leaders in B as well.
If a higher-priority rack recovers and the topic's replication factor ensures that rack receives a replica, Redpanda automatically moves leaders back to the highest available preferred rack.

== Suggested reading
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add Cloud Topics?

Comment on lines 1289 to 1290
| Corresponding cluster property
| xref:reference:cluster-properties.adoc#default_leaders_preference[default_leaders_preference]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not render correctly--should have xref:reference:cluster-properties.adoc#default_leaders_preference[default_leaders_preference], no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants