n1ql connection failover

When invoking N1QL , we need to call;

cbq -engine=http://<IP_QUERY_NODE>:8093

I have configured 2 query nodes in my cluster and my question is;
is there a way to direct the cbq connection to the available query node at a time.
If my query node server 1 is down or unreachable for any reason, I want the cbq to try the second node IP.


Hi W,

That feature is not yet available with cbq, it will be in the next release of cbq. However, if you use the go_n1ql library (https://github.com/couchbaselabs/go_n1ql) then that supports failover.


1 Like

Hi @manik
I don’t use that library … is there a way to catch an exception in a shell UNIX script when connecting to one query node or a timeout?
I only have 2 query nodes, so this can work also.

Hi @couchbwiss,
I hope this can help you detect the error, https://www.turnkeylinux.org/blog/shell-error-handling