Replica distribution across instances
justin at basho.com
Thu Nov 12 10:41:06 EST 2009
On Thu, Nov 12, 2009 at 10:30 AM, Jonathan Lee <jonathan_lee at comcast.com> wrote:
> I am just starting to explore Riak, so please bear with me if I'm
> asking an obvious question: does anyone have a good method of
> guaranteeing that replicas are placed across multiple Riak instances?
It's a very good question, but Riak already handles it for you.
> >From what I understand, the suggested configuration is to have
> ring_creation_size > # instances to allow for expansion. However,
> riak_claim:default_choose_claim/1 claims partitions at random, so
> there is no guarantee that N neighboring partitions are not claimed by
> the same instance. If that node then fails, data is lost. Have I
> missed something here?
The key here is in the way that the FSMs select replica nodes. They
don't simply choose consecutive partitions, but instead choose the
first N partitions that are on separate nodes (when there are N or
more nodes). This is implemented in riak_ring:filtered_preflist.
This ensures that even when a node owns adjacent partitions, data is
spread across the maximum number of possible unique nodes.
More information about the riak-users