Details
-
Bug
-
Resolution: Won't Fix
-
Critical
-
None
-
None
-
None
-
Security Level: Public
-
PHP 5.4.9-4ubuntu2.2
Couchbase 2.1
Couchbase PHP Extension 1.1.5
libcouchbase2 2.0.7-2282
Description
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:
define('COUCHBASE_SERVERS', couchbase1.office:8091;couchbase2.office:8091;couchbase3.office:8091;'remote.vnode.com:8091');
define('COUCHBASE_USER', 'username');
define('COUCHBASE_PASS', 'pass');
define('COUCHBASE_DATA_BUCKET', 'data');
define('COUCHBASE_WEB_BUCKET', 'web');
define('COUCHBASE_SESSION_BUCKET', 'session');
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.