Skip to content

Instantly share code, notes, and snippets.

@dreverri
Created July 15, 2010 01:26
Show Gist options
  • Save dreverri/476365 to your computer and use it in GitHub Desktop.
Save dreverri/476365 to your computer and use it in GitHub Desktop.
Fun = fun(Nodes) ->
{ok, LocalRing} = riak_core_ring_manager:get_my_ring(),
LocalOwners = riak_core_ring:all_owners(LocalRing),
case (catch lists:foldl(fun(Node, _) ->
{ok, R} = rpc:call(Node, riak_core_ring_manager, get_my_ring, []),
true = riak_core_ring:all_owners(R) =:= LocalOwners
end,
true,
Nodes)) of
true -> true;
_ -> false
end
end.
@dreverri
Copy link
Author

Used to check if nodes in a Riak cluster all have the same view of the ring (partition distribution).

Run the function on a Riak node. Pass a list of nodes and the function will compare the local node to all the nodes in the list.

Fun(['dev1@127.0.0.1','dev2@127.0.0.1']).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment