]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | #!/usr/bin/env bash |
2 | ||
3 | set -x | |
4 | ||
5 | ./bin/ceph config set osd osd_crush_update_on_start false | |
6 | ||
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 | |
11 | ||
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 | |
15 | rule stretch_rule { | |
16 | id 1 | |
17 | type replicated | |
f67539c2 TL |
18 | step take site1 |
19 | step chooseleaf firstn 2 type host | |
20 | step emit | |
21 | step take site2 | |
22 | step chooseleaf firstn 2 type host | |
23 | step emit | |
24 | } | |
522d829b TL |
25 | rule stretch_rule2 { |
26 | id 2 | |
27 | type replicated | |
522d829b TL |
28 | step take site1 |
29 | step chooseleaf firstn 2 type host | |
30 | step emit | |
31 | step take site2 | |
32 | step chooseleaf firstn 2 type host | |
33 | step emit | |
34 | } | |
35 | rule stretch_rule3 { | |
36 | id 3 | |
37 | type replicated | |
522d829b TL |
38 | step take site1 |
39 | step chooseleaf firstn 2 type host | |
40 | step emit | |
41 | step take site2 | |
42 | step chooseleaf firstn 2 type host | |
43 | step emit | |
44 | } | |
f67539c2 TL |
45 | EOF |
46 | ./bin/crushtool -c crush.map.txt -o crush2.map.bin | |
47 | ./bin/ceph osd setcrushmap -i crush2.map.bin | |
48 | ./bin/ceph mon set election_strategy connectivity | |
49 | ||
50 | ./bin/ceph mon set_location a datacenter=site1 | |
51 | ./bin/ceph mon set_location b datacenter=site2 | |
52 | ./bin/ceph mon set_location c datacenter=site3 | |
53 | ./bin/ceph osd pool create test_stretch1 1024 1024 replicated | |
54 | ./bin/ceph mon enable_stretch_mode c stretch_rule datacenter |