]>
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 | |
18 | min_size 1 | |
19 | max_size 10 | |
20 | step take site1 | |
21 | step chooseleaf firstn 2 type host | |
22 | step emit | |
23 | step take site2 | |
24 | step chooseleaf firstn 2 type host | |
25 | step emit | |
26 | } | |
522d829b TL |
27 | rule stretch_rule2 { |
28 | id 2 | |
29 | type replicated | |
30 | min_size 1 | |
31 | max_size 10 | |
32 | step take site1 | |
33 | step chooseleaf firstn 2 type host | |
34 | step emit | |
35 | step take site2 | |
36 | step chooseleaf firstn 2 type host | |
37 | step emit | |
38 | } | |
39 | rule stretch_rule3 { | |
40 | id 3 | |
41 | type replicated | |
42 | min_size 1 | |
43 | max_size 10 | |
44 | step take site1 | |
45 | step chooseleaf firstn 2 type host | |
46 | step emit | |
47 | step take site2 | |
48 | step chooseleaf firstn 2 type host | |
49 | step emit | |
50 | } | |
f67539c2 TL |
51 | EOF |
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 | |
55 | ||
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 |