Created
September 20, 2011 16:50
-
-
Save kellymclaughlin/1229637 to your computer and use it in GitHub Desktop.
Examining the Riak ring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Get the state for the local node | |
%% The get_my_ring function really returns the ring | |
%% plus other state information about the cluster. | |
{ok, State} = riak_core_ring_manager:get_my_ring(). | |
%% Get number of partitions | |
riak_core_ring:num_partitions(State). | |
%% Get the names of custom buckets | |
riak_core_ring:get_buckets(State). | |
%% List the ring indexes owned by this node | |
riak_core_ring:my_indices(State). | |
%% Get the preflists for each vnode for a given n_val e.g. 3 | |
%% This will produce a list of lists where each sub-list will | |
%% contain 3 entries representing the first 3 preference list | |
%% entries for each vnode on the ring. | |
riak_core_ring:all_preflists(State, 3). | |
%% Show the node that owns a given vnode index. | |
%% We'll use the index 0, but you may use any of | |
%% the vnode indices. | |
riak_core_ring:index_owner(State, 0). | |
%% Produce a list of all cluster nodes | |
riak_core_ring:all_members(State). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment