Riak: "Failed to read test value: {error,{insufficient_vnodes,0,need,1}}" after running "riak-admin test"

StackOverflow https://stackoverflow.com/questions/19654480

  •  01-07-2022
  •  | 
  •  

Question

Getting this error soon after running riak start despite a config file that should be working correctly.

Was it helpful?

Solution

Turns out that this is a limit of Riak's error messaging: you will get the above message if you try to do a riak-admin test on your setup before the configuration has finished loading.

OTHER TIPS

I encountered the same problem while starting new Riak clusters over and over again during automated testing. My solution was, in my test fixture setup, to execute code that keeps trying to put an object into a Riak bucket and then eventually succeeding.

Granted, my solution here is an Erlang snippet but it generally solves this problem in lieu of any Riak-supplied admin/wait functions. But since I've used a number of different Riak versions this technique here seems to work for all of them.

wait_for_riak() ->
    {ok, C} = riak:local_client(),
    io:format("Waiting for Raik..."),
    wait_for_riak(C),
    io:format("and had a successful put.~n").

wait_for_riak(C) ->
    Strawman = riak_object:new(<<"test">>, <<"strawman">>, []),
    case C:put(Strawman, 1) of
        ok ->
            ok;
        _Error ->
            receive after 1000 -> ok end,
            wait_for_riak(C)
    end.

adding sleep 4 like so:

brew install riak
riak start
sleep 4
riak-admin test

should help

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top