How to find which nodes host a particular bucket/key?

Charlie Voiselle cvoiselle at
Tue Jan 13 12:14:49 EST 2015

You can use the following Erlang snippet in `riak attach`:

{ok,Ring} = riak_core_ring_manager:get_my_ring(),
DocIdx = riak_core_util:chash_key({<<"my_bucket">>, <<"my_key">>}),
<<I:160/integer>> = DocIdx,
Preflist = riak_core_ring:preflist(DocIdx, Ring),
{Targets, Fallbacks} = lists:split(N, Preflist),

Verify that `N` matches your clusters N-val. Change `my_bucket` and `my_key` as appropriate.  If all of your nodes are up and healthy, this will give you the primaries in the `Targets` variable and the fallback partitions in order of preference in `Fallbacks`.

Charlie Voiselle
Basho Client Services

> On Jan 12, 2015, at 4:28 PM, Jay Doane <jay.s.doane at> wrote:
> Can anyone suggest how to determine the nodes on which a particular bucket/key are hosted in a cluster?
> Thanks,
> Jay
> _______________________________________________
> riak-users mailing list
> riak-users at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list