1

How to configure the java client for couchbase to auto-reconnect?

Is it turned on by default? Also, it will be great if somebody can help to show how to do it using spring-data-couchbase.

Mike Laren
  • 8,028
  • 17
  • 51
  • 70
Aris
  • 77
  • 1
  • 6

1 Answers1

2

Both the 1.4.x and 2.x generations of Couchbase Java SDKs will auto-reconnect when a node is (re)introduced to the cluster through a rebalance event. Spring-data-couchbase being (currently) based on the 1.4.x SDK, it should transparently reconnect as well.

Simon Baslé
  • 27,105
  • 5
  • 69
  • 70
  • In case of server went down for few minutes and then come back up, will it auto-reconnect too? – Aris Jul 13 '15 at 03:08
  • to add to my answer, you still have to detect and protect from individual operations failing (for instance attempting to do gets in a loop on a cluster with a node failing may give you `RequestCancelledException`s and `TimeoutException`s). What the SDK will pick up is a change in the topology of the cluster: has a node been marked as failed over? Has a node been removed and the cluster rebalanced? If a node isn't manually or automatically failed over, the SDK will still try to contact it and give you timeouts. – Simon Baslé Jul 13 '15 at 14:50
  • you probably want to refer to the documentation on cluster maintenance and server maintenance concepts : http://docs.couchbase.com/admin/admin/Tasks/cluster-maintenance.html and http://docs.couchbase.com/admin/admin/Tasks/maintenance-server-node.html – Simon Baslé Jul 13 '15 at 14:55