Couchbase PHP SDK gives a common network error

I am running a website with 2 servers for site code (in PHP) and 1 server as load balancer. All 3 also run couchbase instances as part of a single cluster.

enter image description here

In PHP code, I use buchets couchbase as follows:

$cluster = new \CouchbaseCluster('http://127.0.0.1:8091');
$greyloftWebbucket = $cluster->openBucket('some_bucket');
$query = \CouchbaseViewQuery::from('abcd', 'pqrs');

This layout works fine when all couchbase instances are running. When any of them is closed and I try to access the buckets, I get the following error randomly:

[2015-07-17 13:46:08] production.ERROR: exception 'CouchbaseException' with message 'Generic network failure. Enable detailed error codes (via LCB_CNTL_DETAILED_ERRCODES, or via `detailed_errcodes` in the connection string) and/or enable logging to get more information' in [CouchbaseNative]/CouchbaseBucket.class.php:282
Stack trace:
#0 [CouchbaseNative]/CouchbaseBucket.class.php(282): _CouchbaseBucket->http_request(1, 1, '/_design/abcd...', NULL, 1)
#1 [CouchbaseNative]/CouchbaseBucket.class.php(341): CouchbaseBucket->_view(Object(_CouchbaseDefaultViewQuery))
#2 /var/www/greyloft-laravel/app/couchbasemodel.php(25): CouchbaseBucket->query(Object(_CouchbaseDefaultViewQuery))
#3 /var/www/greyloft-laravel/app/Http/Controllers/Listing.php(42): App\couchbasemodel::listings()
#4 [internal function]: App\Http\Controllers\Listing->index()

That is, once the page loads correctly and shows the contents of the bucket, and then once shows me the above errors. It doesn’t matter if I can directly access the load balancer or any of the servers.

, autofailover enabled , 1 couchbase. 3 LCB_LOGLEVEL=5

? Couchbase PHP SDK - ? .

Update:

,

$cluster = new \CouchbaseCluster('http://127.0.0.1:8091?detailed_errcodes=1');

. - ( ):

CouchbaseException in CouchbaseBucket.class.php line 74: The remote host refused the connection. Is the service up?

. Couchbase:

Failed over 'ns_1@<ip_address>': ok
Node ('ns_1@<ip_address>') was automatically failovered.

, SDK node. ? ?

+4

Source: https://habr.com/ru/post/1598623/


All Articles