cluster health check using riak-java-client

Luke Bakken lbakken at
Thu Jan 14 11:08:37 EST 2016

> Of course I have yet another question.  Even if I assume the state of each
> node is correct, how do I know if the cluster overall is considered healthy?
> This may not be a valid question, but I hope it is.  For example, if the
> cluster configuration requires 3 nodes to write, I can write some fairly
> detailed code in riak-java-client to realize that's the configuration and
> count that there are enough healthy nodes. However, if I'm using something
> like haproxy, I'm not sure there's a great spot to put that logic.
> Is there a way to query the cluster overall to ask a health question like
> this?

Hi David,

Alex's suggestion to use the PR and PW parameters for reads and writes
could be used to create a health check within your application.

However, I recommend not worrying too much about this issue within
your application, as Riak is designed to be fault-tolerant. Instead
focus on having a robust monitoring system in place for both Riak and
your servers:

Monitoring the performance of your cluster and alerting on increased
latency or other outlier situations is a better approach, in my

Luke Bakken
lbakken at

> On 12/8/15 1:09 PM, Alexander Sicular wrote:
>> Besides just plainly writing a key, you could also do something like
>> (pseudo code):
>> Riak.put(canaryKey, pw=n_val){
>>    If ok -> cool!
>>    If borked -> sad face
>> }
>> The important bit is the pw (primary write) equals your replication value.
>> This means that all copies in the virtual node replica set need to go to
>> virtual nodes allocated to their primary physical machines. This is a way
>> you can check cluster status from the app level as in , is the cluster in
>> some kind of borked state.
>> -Alexander

More information about the riak-users mailing list