I have tried a snippet from Basho's docs which is given as below :
public class TasteOfRiak {
public static void main(String[] args) throws UnknownHostException, ExecutionException, InterruptedException
{
RiakClient client = RiakClient.newClient(port, "IP");
Location location = new Location(new Namespace("Bucket"), "bucketType");
FetchValue fv = new FetchValue.Builder(location).build();
FetchValue.Response response = client.execute(fv);
String value = response.getValue(String.class);
System.out.println(value);
client.shutdown();
}
}
But, this throws exception :
[main] ERROR com.basho.riak.client.core.RiakNode - Connection attempt failed: java.net.ConnectException: Connection timed out: no further information: Exception in thread "main" [pool-1-thread-2] INFO com.basho.riak.client.core.DefaultNodeManager - NodeManager moved node to unhealthy list; 3.34.211.202:8098 java.util.concurrent.ExecutionException: com.basho.riak.client.core.NoNodesAvailableException at com.basho.riak.client.core.FutureOperation.get(FutureOperation.java:260) at com.basho.riak.client.api.commands.CoreFutureAdapter.get(CoreFutureAdapter.java:52) at com.basho.riak.client.api.RiakCommand.execute(RiakCommand.java:89) at com.basho.riak.client.api.RiakClient.execute(RiakClient.java:293) at TasteOfRiak.main(TasteOfRiak.java:20) Caused by: com.basho.riak.client.core.NoNodesAvailableException at com.basho.riak.client.core.DefaultNodeManager.executeOnNode(DefaultNodeManager.java:95) at com.basho.riak.client.core.RiakCluster.execute(RiakCluster.java:197) at com.basho.riak.client.core.RiakCluster.retryOperation(RiakCluster.java:328) at com.basho.riak.client.core.RiakCluster.access$800(RiakCluster.java:44) at com.basho.riak.client.core.RiakCluster$RetryTask.run(RiakCluster.java:340) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744)