You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cluster.markdown
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,8 @@ $obj_cluster = new RedisCluster('mycluster');
38
38
39
39
On construction, the RedisCluster class will iterate over the provided seed nodes until it can attain a connection to the cluster and run CLUSTER SLOTS to map every node in the cluster locally. Once the keyspace is mapped, RedisCluster will only connect to nodes when it needs to (e.g. you're getting a key that we believe is on that node.)
40
40
41
-
# Timeouts
42
-
Because Redis cluster is intended to provide high availability, timeouts do not work in the same way they do in normal socket communication. It's fully possible to have a timeout or even exception on a gien socket (say in the case that a master node has failed), and continue to serve the request if and when a slave can be promoted as the new master.
41
+
##Timeouts
42
+
Because Redis cluster is intended to provide high availability, timeouts do not work in the same way they do in normal socket communication. It's fully possible to have a timeout or even exception on a given socket (say in the case that a master node has failed), and continue to serve the request if and when a slave can be promoted as the new master.
43
43
44
44
The way RedisCluster handles user specified timeout values is that every time a command is sent to the cluster, we record the the time at the start of the request and then again every time we have to re-issue the command to a different node (either because Redis cluster responded with MOVED/ASK or because we failed to communicate with a given node). Once we detect having been in the command loop for longer than our specified timeout, an error is raised.
45
45
@@ -65,7 +65,7 @@ $obj_cluster->setOption(
65
65
</pre>
66
66
67
67
## Main command loop
68
-
With the exception of commands that are directed to a specific node, each command executed via RedisCluster is processed through a command loop, where we make the request, handle any MOVED or ASK redirection, and repeat if neccsary. This continues until one of the following conditions is met:
68
+
With the exception of commands that are directed to a specific node, each command executed via RedisCluster is processed through a command loop, where we make the request, handle any MOVED or ASK redirection, and repeat if necessary. This continues until one of the following conditions is met:
69
69
70
70
1. We fail to communicate with *any* node that we are aware of, in which case a ```RedisClusterExecption``` is raised.
71
71
2. We have been bounced around longer than the timeout which was set on construction.
@@ -80,11 +80,14 @@ When you call ```RedisCluster->multi()```, the cluster is put into a MULTI state
80
80
Consider the following example:
81
81
82
82
<pre>
83
-
$obj_cluster->multi(); // Cluster is put into MULTI state locally
83
+
// Cluster is put into MULTI state locally
84
+
$obj_cluster->multi();
85
+
84
86
for ($i = 0; $i < 10; $i++) {
85
87
// MULTI will be delivered only once per node
86
88
$obj_cluster->get("key:$i");
87
89
}
90
+
88
91
// This always returns an array of 10 elements, of which some could be false
0 commit comments