1

I'm trying to test connectivity to couchbase server using the .NET sdk.

I've tried to get a test key in order to do it, but I'm getting "null" (instead of getting an exception mention that couchbase server is done).

I've also read this: http://www.couchbase.com/docs//couchbase-manual-2.0/couchbase-getting-st...

But it doesn't say anything about testing connectivity from an application code.

Is there any way of testing connection to couchbase server via code ?

1 Answer 1

1

The couchbase client sdk manages the connections for you, whatever node urls you pass to it during construction it attempts to authenticate to, if the client can't authenticate to one of the nodes then it throws ConnectException (I'm using the JAVA sdk but I imagine .NET is very similar).

So really you don't have to test the connectivity, the smart client handles that. After construction you can ask the client to list all the available servers

client.getAvailableServers();

Or for a more detailed status of your nodes and statistics do:

client.getStats();
Sign up to request clarification or add additional context in comments.

8 Comments

getAvailableServers() - doesn't exist in .NET sdk. getStats() - I couldn't find any property or method in ServerStats class regarding if the server is up.. I just need a very basic check that takes minimal time
Even without those methods, the client authenticates itself to the nodes you've passed it. If it hasn't thrown an exception then everything is good (unless .net is completely different). Have you run into any problems with the client? If you really want a simple test why don't you just do client.set("test",1).get(); then grab that value back and check it is not null client.get("test");
because performence considerations. I don't want to use "get" twice when I can only use it once.
Like I said, the client already authenticates to the nodes for you, plus you are only doing one get, the first get is for the operation future.
Also to add to above, the client has the vbucket map, you don't have knowledge of the nodes, you can't force the set to go to a specific node.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.