creating a connection to a couchbase server,
I have few questions regarding the php documentation:
1) what does $object->getMultiByKey($master_key, $keyn [, $cas_token ] [, $flags ]) , mean?
-$master_key Master key used for consistent server references , Does it mean array of servers?
2) Assuming I have 3 servers, should I make a connection to one only:
$cb = new Couchbase("192.168.1.200:8091", "user", "pass");
or $hosts = array(
"server1",
"server2",
"server3"
);
3) If I have 3servers, and I always create a connection to one, wouldn't it cause a slight delay? Since, everytime it connects, it gets the location and server link, from vbucket and then fetches the result from the server that has the data? . Is there a way that it randomly connects to a particular server thus reducing the load of creating a connection on one server!
Hi,
first to your connection question:
You can pass either a String (more nodes delimited with ";") or an array to the constructor. This is only supported in 1.1 (I _think_ the ";" delimiter works in 1.0 too but I'm not 100% sure).
At this point, this list is used to find a live node in your cluster and start talking to it. When it finds one, it - behind the scenes - throws away your information and updates it with the latest one provided from the cluster. This means in practice that your list is only needed during the bootstrap-phase. This has the big advantage that changes to the cluster during runtime are taken into account.
ad 1)
I'm not aware of a getMultiByKey operation, I guess you mean getMulti? Maybe its outdated documentation. For some examples on getMulti, look at the following tests: https://github.com/couchbase/php-ext-couchbase/blob/master/tests/GetMult...
Best,
Michael