5 .
/bin
/ceph config
set osd osd_crush_update_on_start false
7 .
/bin
/ceph osd crush move osd
.0 host=host1-1 datacenter
=site1 root
=default
8 .
/bin
/ceph osd crush move osd
.1 host=host1-2 datacenter
=site1 root
=default
9 .
/bin
/ceph osd crush move osd
.2 host=host2-1 datacenter
=site2 root
=default
10 .
/bin
/ceph osd crush move osd
.3 host=host2-2 datacenter
=site2 root
=default
12 .
/bin
/ceph osd getcrushmap
> crush.map.bin
13 .
/bin
/crushtool
-d crush.map.bin
-o crush.map.txt
14 cat <<EOF >> crush.map.txt
21 step chooseleaf firstn 2 type host
24 step chooseleaf firstn 2 type host
33 step chooseleaf firstn 2 type host
36 step chooseleaf firstn 2 type host
45 step chooseleaf firstn 2 type host
48 step chooseleaf firstn 2 type host
52 .
/bin
/crushtool
-c crush.map.txt
-o crush2.map.bin
53 .
/bin
/ceph osd setcrushmap
-i crush2.map.bin
54 .
/bin
/ceph mon
set election_strategy connectivity
56 .
/bin
/ceph mon set_location a datacenter
=site1
57 .
/bin
/ceph mon set_location b datacenter
=site2
58 .
/bin
/ceph mon set_location c datacenter
=site3
59 .
/bin
/ceph osd pool create test_stretch1
1024 1024 replicated
60 .
/bin
/ceph mon enable_stretch_mode c stretch_rule datacenter