Is Couchbase Single Point of Failure with PHP API 2.0?

This is the code to connect to a node.

$myCluster = new CouchbaseCluster('192.168.55.2');
$myBucket = $myCluster->openBucket('default');

According to the PHP Api reference it only accepts a string, so it is not possible to insert an array of servers.

Does it mean that I’ll need to create my own functions to check if a server is up or down, and if so, try to connect to another server and so on?

thanks.

Hey Valters,

You can pass a connection string to your CouchbaseCluster function. This connection string can contain multiple servers. For instance: 'couchbase://192.168.55.1,192.168.55.2,192.168.55.3`.

Cheers, Brett

1 Like