On Tue, Nov 24, 2015 at 1:37 PM, Wido den Hollander <wido@xxxxxxxx> wrote: > On 11/24/2015 07:00 PM, Emmanuel Lacour wrote: >> >> Dear ceph users, >> >> >> I try to write a crush ruleset that will, for a pool size of 3, put a >> copy in another host in the local rack and a copy in another rack. I now >> how to do the later, but I do not understand how to match the current >> rack. Here is my try: >> >> >> rule replicate_three_times { >> ruleset 1 >> type replicated >> min_size 3 >> max_size 3 >> step take default >> step chooseleaf firstn 1 type rack >> step emit >> step take rack >> step chooseleaf firstn 1 type host > > You probably want 'firstn -1 type host' there. > >> step emit >> } >> >> >> I thought that "take rack" will select the rack the primary host is in, >> but it does not compile and claims that it's undefined. > > 'take rack' selects a 'root' with the name 'rack', that's probably missing. > > How many racks do you have? Two? I don't fully understand what you are > trying to do. Yeah, this is the old "two copies in one rack, a third copy elsewhere" replication scheme that lots of stuff likes but CRUSH doesn't really support. Assuming new enough clients and servers (some of the older ones barf when you do this), you can do rule replicate_three_times { ruleset 1 type replicated min_size 3 max_size 3 step take default step choose firstn 2 type rack step chooseleaf firstn 2 type host step emit } That will pick 2 racks and emit 2 OSDs (on separate hosts) in each, but the list will get truncated down to three OSDs. -Greg _______________________________________________ ceph-users mailing list ceph-users@xxxxxxxxxxxxxx http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com