我正在运行一个网站,其中有2台服务器用于网站代码(在PHP中),1台服务器用作负载均衡器 . 所有3个也都运行couchbase实例,作为一个集群的一部分 .

enter image description here

在PHP代码中,我使用couchbase存储桶如下:

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

当所有couchbase实例运行时,此安排正常工作 . 当其中任何一个关闭并且我尝试访问存储桶时,我会随机获得以下错误:

[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()

也就是说,一次页面将正确加载并显示存储桶内容,然后一次将显示上面的错误 . 如果我直接访问负载均衡器或任何服务器并不重要 .

此外,在 enabled 中自动转换,并在couchbase群集中将复制设置为 1 . 在所有3台服务器中,我设置了 LCB_LOGLEVEL=5

怎么了?是Couchbase PHP SDK中的问题还是其他什么问题?我会感激任何帮助 .

Update:

根据mnunberg的建议,我正在使用新的连接字符串

$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仍在尝试读取故障转移节点 . 为什么会这样?任何可能的解决方