rule stretch_rule {
id 1
- min_size 1
- max_size 10
type replicated
step take site1
step chooseleaf firstn 2 type host
#. Run the monitors in connectivity mode. See `Changing Monitor Elections`_.
+ .. prompt:: bash $
+
+ ceph mon set election_strategy connectivity
+
#. Command the cluster to enter stretch mode. In this example, ``mon.e`` is the
tiebreaker monitor and we are splitting across data centers. The tiebreaker
monitor must be assigned a data center that is neither ``site1`` nor
- ``site2``. For this purpose you can create another data-center bucket named
- ``site3`` in your CRUSH and place ``mon.e`` there:
+ ``site2``. This data center **should not** be defined in your CRUSH map, here
+ we are placing ``mon.e`` in a virtual data center called ``site3``:
.. prompt:: bash $
ceph mon set_location e datacenter=site3
ceph mon enable_stretch_mode e stretch_rule datacenter
+#. Set the replication levels for each pool. Here we are setting the standard
+ replication levels for a stretch mode cluster. Where ``4`` copies will be kept
+ in total, with a minimum of ``2`` in each data center:
+
+ .. prompt:: bash $
+
+ ceph osd pool set ceph_data min_size 2
+ set pool 2 min_size to 2
+ ceph osd pool set ceph_data size 4
+ set pool 2 size to 4
+ ceph osd pool set ceph_metadata min_size 2
+ set pool 3 min_size to 2
+ ceph osd pool set ceph_metadata size 4
+ set pool 3 size to 4
+
When stretch mode is enabled, PGs will become active only when they peer
across data centers (or across whichever CRUSH bucket type was specified),
assuming both are alive. Pools will increase in size from the default ``3`` to