Reputation: 9
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
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.
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
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.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