Yes, this is possible with step chooseleaf firstn 0 type osd
. If that makes sense is another question, for example your storage overhead would be very high. If you have the capacity you could do that, but ceph is designed as a highly scalable solution, with this setup you have kind of a corner case. Usually, host based replication is enough with min_size = 2
and size = 3
. That way it doesn't matter how many OSDs fail on one host, and even a second host goes down your data won't be lost yet, just degraded until you bring OSDs back online. But also note that with only three hosts you wouldn't be able to recover a failed node, so the cluster would operate in a degraded state until the node is repaired or a new node joins the cluster.
You can edit your crush rule (or create a new one to test it first) so it chooses all available hosts first and then the number of OSDs, it could look like this:
step choose firstn 0 type host
step chooseleaf firstn 2 type osd
You should test it before applying with crushtool
.