Skip to content

Instantly share code, notes, and snippets.

@wido
Created February 19, 2018 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wido/af80033798d09126627dcec22237e976 to your computer and use it in GitHub Desktop.
Save wido/af80033798d09126627dcec22237e976 to your computer and use it in GitHub Desktop.
Ceph CRUSHMap to replicate over datacenters
# begin crush map
tunable choose_local_tries 0
tunable choose_local_fallback_tries 0
tunable choose_total_tries 50
tunable chooseleaf_descend_once 1
tunable chooseleaf_vary_r 1
tunable chooseleaf_stable 1
tunable straw_calc_version 1
tunable allowed_bucket_algs 54
# devices
device 0 osd.0 class ssd
device 1 osd.1 class ssd
device 2 osd.2 class ssd
device 3 osd.3 class ssd
device 4 osd.4 class ssd
device 5 osd.5 class ssd
# types
type 0 osd
type 1 host
type 2 chassis
type 3 rack
type 4 row
type 5 pdu
type 6 pod
type 7 room
type 8 datacenter
type 9 region
type 10 root
# buckets
host alpha {
id -3 # do not change unnecessarily
id -4 class ssd # do not change unnecessarily
# weight 0.010
alg straw2
hash 0 # rjenkins1
item osd.0 weight 0.010
}
host bravo {
id -5 # do not change unnecessarily
id -6 class ssd # do not change unnecessarily
# weight 0.010
alg straw2
hash 0 # rjenkins1
item osd.1 weight 0.010
}
host charlie {
id -7 # do not change unnecessarily
id -8 class ssd # do not change unnecessarily
# weight 0.010
alg straw2
hash 0 # rjenkins1
item osd.2 weight 0.010
}
datacenter dc1 {
id -15 # do not change unnecessarily
id -16 class ssd # do not change unnecessarily
# weight 0.029
alg straw2
hash 0 # rjenkins1
item alpha weight 0.010
item bravo weight 0.010
item charlie weight 0.010
}
host delta {
id -9 # do not change unnecessarily
id -10 class ssd # do not change unnecessarily
# weight 0.010
alg straw2
hash 0 # rjenkins1
item osd.3 weight 0.010
}
host echo {
id -11 # do not change unnecessarily
id -12 class ssd # do not change unnecessarily
# weight 0.010
alg straw2
hash 0 # rjenkins1
item osd.4 weight 0.010
}
host foxtrot {
id -13 # do not change unnecessarily
id -14 class ssd # do not change unnecessarily
# weight 0.010
alg straw2
hash 0 # rjenkins1
item osd.5 weight 0.010
}
datacenter dc2 {
id -17 # do not change unnecessarily
id -18 class ssd # do not change unnecessarily
# weight 0.029
alg straw2
hash 0 # rjenkins1
item delta weight 0.010
item echo weight 0.010
item foxtrot weight 0.010
}
root default {
id -1 # do not change unnecessarily
id -2 class ssd # do not change unnecessarily
# weight 0.058
alg straw2
hash 0 # rjenkins1
item dc1 weight 0.029
item dc2 weight 0.029
}
# rules
# Works best with 4 replicas
# Two different hosts will be selected in each datacenter
# This allows for a DC to fail
rule replicated_rule {
id 0
type replicated
min_size 1
max_size 4
step take default
step choose firstn 2 type datacenter
step chooseleaf firstn 2 type host
step emit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment