On our test environment I've got three nodes on the local network in one cluster with one web server. I've created a virtual machine remotely to set up XDCR which worked perfectly.
I then tried to imitate a datacentre going offline by unplugging the network cable from each of the three nodes in the local cluster.
I'd already changed my PHP to be something along the lines of:
I have three classes, one to connect to the data bucket and perform view queries amongst others, one to connect to the session bucket and store sessions in JSON format and another to cache the generated HTML in the web bucket.
Each class initiates the connection via:
$couchbase = new Couchbase(COUCHBASE_SERVERS, COUCHBASE_USER, COUCHBASE_PASS, COUCHBASE_WEB_BUCKET);
Obviously with the respective bucket.
When I unplugged the three network cables and refreshed, I get this error:
Fatal error: Uncaught exception 'CouchbaseLibcouchbaseException' with message 'Failed to get a value from server: Operation timed out'
The PHP extension documentation states "The connection obtains the cluster configuration from the first host to which it has connected." which to me implies that there is some sort of loop that goes through each node to find an active node. It doesn't even seem like it's using the first node in the array as I moved the only active one to the top of the list and it still failed.