Manish
Manish

Reputation: 9

Riak kv SearchOperation NoNodesAvailableException

I am getting nonodesavailableexception with this code:

String query = "{\"phone\":\"111\"}";
User user = new User("222",null,null);

SearchOperation searchOp = new SearchOperation.Builder(BinaryValue.create(INDEX),jsonUtils.covertFromObjectToJson(user)).build();

RiakCluster cluster = RiakClient.newClient(8087, "127.0.0.1").getRiakCluster();

RiakFuture<com.basho.riak.client.core.operations.SearchOperation.Response,BinaryValue> riakFuture = cluster.execute(searchOp);

com.basho.riak.client.core.operations.SearchOperation.Response response = searchOp.get(); //Getting error in this line.

String queryString = searchOp.getQueryInfo().toString();

Upvotes: 0

Views: 84

Answers (1)

Nicholas Adams
Nicholas Adams

Reputation: 524

Although this is a shot in the dark, NoNodesAvailableException seems to imply that your error is client side and that it's throwing an exception because there are no nodes available.

I am afraid that I have little experience in troubleshooting the clients for Riak but I can tell you what I would do in this situation.

  1. Check Riak is actually there and running. Go to your Riak box and execute riak ping and see if it returns pong to confirm it's there. If so, run riak-admin wait-for-service riak_kv and wait until it confirms that riak_kv is up
  2. Check you can reach Riak from your client machine. Based on your above query, you should be able to run curl -v http://127.0.0.1:8098/stats -H "Accept: text/plain" and have it return a list of stats about your Riak install.
  3. Troubleshoot your query. Bear in mind that almost every query you can make from a client can also be made from curl. See https://www.tiot.jp/riak-docs/riak/kv/2.9.0p5/developing/usage/search/ for a set of search related examples to get you started. Once you have confirmed your query works in curl, you can then look carefully at the query you posted here to see whether it matches up with your curl query and adjust accordingly if not.

Based on how far you get through the above 3 point list before something goes wrong, you should be able to locate the source of your issue and focus your efforts on that either by yourself or by posting a new question here.

Upvotes: 0

Related Questions