Skip to Content
FeaturesReplication Factor

Replication Factor

Pilot can automatically increase the replication factor (RF) of partitions that are below a configured target. This is useful for gradually improving data durability across your cluster.

Configuration

PILOT_BALANCE_MIN_RF=3 # Target replication factor (0 = disabled)

When set, Pilot proposes additional replicas for all partitions with an RF below this value.

Behavior

When the target replication factor is configured:

  1. Detection - the proposal engine scans all partitions and identifies those below the target RF
  2. Replica addition - for each partition below the target, new replica brokers are selected
  3. Rack awareness - new replicas go to the racks that hold the fewest replicas of the partition. With PILOT_BALANCE_RACK_AWARE=true, Pilot does not crowd a rack. See Repairs
  4. Followers added - new replicas join as followers; existing replicas move only to spread a crowded rack
  5. Load balancing - among the brokers that qualify, new replicas go to the one with the least disk

Example

Before (RF = 2)

topic: my-topic, partition: 0 replicas: [1, 2] leader: 1

After (target RF = 3)

topic: my-topic, partition: 0 replicas: [1, 2, 3] leader: 1 (unchanged)

The proposal output includes the reason:

{ "topic": "my-topic", "partition": 0, "currentReplicas": [1, 2], "proposedReplicas": [1, 2, 3], "reason": "RF increase" }

A replica moved out of a crowded rack is part of the same change, with the same reason.

Safety Features

  • No RF decreases - the system will never reduce replication factor
  • Rack awareness - all new replicas respect rack constraints
  • Broker availability - only online, non-maintenance brokers without follower lag are selected
  • Duplicate prevention - no duplicate brokers in the replica set
  • Leader preservation - the leader remains in the replica set, unless its broker is unavailable or in maintenance and its rack must give up a replica

Self-Healing Integration

RF increases can run automatically via the self-healing RF loop:

PILOT_HEAL_RF_ENABLED=true PILOT_HEAL_RF_INTERVAL=15m PILOT_HEAL_DRY_RUN=false

The loop applies the whole change, including a replica moved out of a crowded rack. See Self-Healing for details on enabling automatic healing.

Limitations

  • Rack constraints - Pilot stops short of the target RF rather than crowd a rack, for example when the racks with room have no available broker
  • Broker availability - requires sufficient online brokers to host additional replicas
  • Maintenance mode - brokers in maintenance are not selected for new replicas

Use Cases

  • Gradual RF increase - safely increase RF across your cluster without manual intervention
  • Compliance - ensure all partitions meet minimum durability requirements
  • Cluster expansion - increase RF when adding new brokers and racks
  • Data protection - automatically add replicas to topics below the target RF
Last updated on