Skip to content

Commit 25d21e8

Browse files
committed
document OPT_SLAVE_FAILOVER
1 parent a67cab1 commit 25d21e8

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

docs/1.x/options.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Instead of using PhpRedis' legacy `OPT_SLAVE_FAILOVER`, consider using `OPT_DIST
111111
| `DISTRIBUTE_RANDOM` | Distribute randomly between the primary and its replicas. Stops trying replicas after the first failed attempt. |
112112
| `DISTRIBUTE_RANDOM_REPLICA` | Distribute randomly among replicas only, never the primary. Stops trying replicas after the first failed attempt. |
113113
| `DISTRIBUTE_REPLICAS` | Distribute randomly among replicas only. Iterates through all replicas until it finds a working one. |
114-
| `DISTRIBUTE_ALL` | Distribute between the primary and its replicas. Iterates through all nodes until it finds a working one. |
114+
| `DISTRIBUTE_ALL` | Distribute between the primary and its replicas. Iterates through all replicas until it finds a working one. |
115115

116116
```php
117117
$cluster->setOption(Cluster::OPT_DISTRIBUTE, Cluster::DISTRIBUTE_REPLICAS);
@@ -135,6 +135,19 @@ Instead of using PhpRedis' legacy `OPT_SLAVE_FAILOVER`, consider using `OPT_DIST
135135
$cluster->setOption(Cluster::OPT_FAILOVER, Cluster::FAILOVER_REPLICAS);
136136
```
137137

138+
## `OPT_SLAVE_FAILOVER`
139+
140+
Legacy compatibility view for PhpRedis' `OPT_SLAVE_FAILOVER`. It maps the legacy modes below onto Relay's `OPT_DISTRIBUTE` and `OPT_FAILOVER` settings.
141+
142+
| Value | Description |
143+
| --- | --- |
144+
| `FAILOVER_NONE` | Send commands to master nodes only. |
145+
| `FAILOVER_ERROR` | Send readonly commands to slave nodes if master is unreachable. |
146+
| `FAILOVER_DISTRIBUTE` | Always distribute readonly commands between master and slaves, at random. |
147+
| `FAILOVER_DISTRIBUTE_SLAVES` | Always distribute readonly commands to the slaves, at random. |
148+
149+
This is not a true alias: some `OPT_DISTRIBUTE` and `OPT_FAILOVER` combinations have no legacy representation, and `getOption(OPT_SLAVE_FAILOVER)` returns `false` for those states. Prefer `OPT_DISTRIBUTE` and `OPT_FAILOVER` for new code.
150+
138151
## `OPT_AVAILABILITY_ZONE`
139152

140153
Sets a preferred availability zone so cluster reads can be routed to nodes in the same zone, reducing cross-AZ traffic.

0 commit comments

Comments
 (0)