Changing stretch mode

Change the stretch mode state by entering or exiting stretch mode as needed to support your cluster’s availability and data‑placement requirements.

Entering stretch mode

Stretch mode is designed to handle two sites. There is a lesser risk of component availability outages with 2-site clusters.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • Root-level access to the nodes.
  • The CRUSH location is set to the hosts.
  • The CRUSH map configured to include stretch rule.
  • No erasure coded pools in the cluster.
  • Weights of the two sites are the same.

Procedure

  1. Check the current election strategy being used by the monitors.
    ceph mon dump | grep election_strategy
    Note: The Ceph cluster election_strategy is set to 1, by default.
    For example,
    [ceph: root@host01 /]# ceph mon dump | grep election_strategy
    
    dumped monmap epoch 9
    election_strategy: 1
  2. Change the election strategy to connectivity.
    ceph mon set election_strategy connectivity
    For more information about configuring the election strategy, see Configuring monitor election strategy.
  3. Use the ceph mon dump command to verify that the election strategy was updated to 3.
    For example,
    [ceph: root@host01 /]# ceph mon dump | grep election_strategy
    
    dumped monmap epoch 22
    election_strategy: 3
  4. Set the location of the tiebreaker monitor so that it is split across the data centers.
    ceph mon set_location TIEBREAKER_HOST datacenter=DC3
    For example,
    [ceph: root@host01 /]# ceph mon set_location host07 datacenter=DC3
  5. Verify that the tiebreaker monitor is set as expected.
    ceph mon dump
    For example,
    [ceph: root@host01 /]# ceph mon dump
    
    epoch 8
    
    fsid 4158287e-169e-11f0-b1ad-fa163e98b991
    
    last_changed 2025-04-11T07:14:48.652801+0000
    
    created 2025-04-11T06:29:24.974553+0000
    
    min_mon_release 19 (squid)
    
    election_strategy: 3
    
    0: [v2:10.0.57.33:3300/0,v1:10.0.57.33:6789/0] mon.host07; crush_location {datacenter=DC3}
    
    1: [v2:10.0.58.200:3300/0,v1:10.0.58.200:6789/0] mon.host05; crush_location {datacenter=DC2}
    
    2: [v2:10.0.58.47:3300/0,v1:10.0.58.47:6789/0] mon.host02; crush_location {datacenter=DC1}
    
    3: [v2:10.0.58.104:3300/0,v1:10.0.58.104:6789/0] mon.host04; crush_location {datacenter=DC2}
    
    4: [v2:10.0.58.38:3300/0,v1:10.0.58.38:6789/0] mon.host01; crush_location {datacenter=DC1}
    
    dumped monmap epoch 8
    0
     
  6. Enter stretch mode.
    ceph mon enable_stretch_mode TIEBREAKER_HOST STRETCH_RULE STRETCH_BUCKET
    In the following example:
    [ceph: root@host01 /]# ceph mon enable_stretch_mode host07 stretch_rule datacenter

What to do next

Verify that stretch mode was implemented correctly by continuing to Verifying stretch mode.

Exiting stretch mode

Disable stretch mode by moving pools to a specified CRUSH rule or to the default replicated rule.

Procedure

Disable stretch mode.
You can specify a CRUSH rule to move all pools to. If you do not specify a rule, Ceph moves the pools to the default replicated CRUSH rule.
ceph mon disable_stretch_mode CRUSH_RULE --yes-i-really-mean-it