-
Notifications
You must be signed in to change notification settings - Fork 26
Bucket Inspector
Luke Bakken edited this page Oct 5, 2016
·
1 revision
This Erlang function will read every key in a bucket and force read-repair on that bucket.
The function takes the 2 arguments:
bucket_inspector:inspect(bucket, node)
-module(bucket_inspector).
-export([inspect/2]).
inspect(Bucket, Server) ->
{ok, C} = riak:client_connect(Server),
{ok, Keys} = C:list_keys(Bucket),
inspect_objects(Bucket, Keys, C).
inspect_objects(_Bucket, [], _Client) ->
ok;
inspect_objects(Bucket, [H|T], Client) ->
Client:get(Bucket, H),
inspect_objects(Bucket, T, Client).
NOTE: If interested in reading all chunks from Luwak, please check out this snippet.
To inspect a bucket run as follows (Bucket should be a binary and Riak node an Atom):
bucket_inspector:inspect(<<"bucket">>, '[email protected]').