Problem when connecting to multiple nodes from PHP

Hello,

I try to connect to a couchbase cluster with this way:
$cb = new Couchbase(array("ip-20-296-110-131.ec2.internal:8091","ip-20-254-129-133.ec2.internal:8091"), COUCHBASE_USER, COUCHBASE_PASS, COUCHBASE_VIEWS_BUCKET);

When the first node in the array is down, there isn't any other connection attempt to the second node in the array. This code line just returns after 3 seconds.
If I change the order of the nodes in the array, so that the good node will be the first one, then it connects immediately.

Why does the class behave like that? I thought it should connect to all of the nodes in the list.

Thanks,
Edi.

I have tested exactly the same thing on my 3 nodes cluster and it is working as expected:
- independently of the order in my list the client connects to the cluster eventually

PS: My Couchbase cluster is running in 3 Ubuntu VMs and my PHP applications is running on OS X

That's strange... My cluster is running on AmazonAmi (CentOS) and the PHP application runs on Apache 2.4 (also on Amazon AMI).
When looking at the traffic on port 8091 on the php machine, it looks like it's trying to connect to the bad machine (lots of SYNs) and not even trying to connect to the good one (which is second on the list).
Any ideas?

It looks like you have some network issue isn't?

No, the first node in the cluster is down, that's why it doesn't answer to connection attempts.

1 Answer

« Back to question.

Hey edibusl, what libcouchbase version do you have installed? There is a known issue with older libcouchbase versions which would cause this problem. I suggest updating your libcouchbase and php-ext-couchbase to the latest versions. Cheers, Brett

Hi,

I have libcouchbase.so.2.0.6
I'll try to update to a newer version.

Thank you,
Edi.

After updating to libcouchbase 2.2 the problem was solved.
Thank you!