Skip to content

Commit 99df7f0

Browse files
committed
Fix up README on Sentinel.
1 parent e81adfe commit 99df7f0

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,31 @@ available on [rdoc.info][rdoc].
8787

8888
## Sentinel support
8989

90-
Redis-rb is able to optionally fetch the current master address using
91-
[Redis Sentinel](http://redis.io/topics/sentinel). The new
92-
[Sentinel handshake protocol](http://redis.io/topics/sentinel-clients)
93-
is supported, so redis-rb when used with Sentinel will automatically connect
94-
to the new master after a failover, assuming you use a Recent version of
95-
Redis 2.8.
90+
The client is able to perform automatic failovers by using [Redis
91+
Sentinel](http://redis.io/topics/sentinel). Make sure to run Redis 2.8+
92+
if you want to use this feature.
9693

9794
To connect using Sentinel, use:
9895

9996
```ruby
100-
Sentinels = [{:host => "127.0.0.1", :port => 26380},
97+
SENTINELS = [{:host => "127.0.0.1", :port => 26380},
10198
{:host => "127.0.0.1", :port => 26381}]
102-
r = Redis.new(:url => "sentinel://mymaster", :sentinels => Sentinels, :role => :master)
99+
100+
redis = Redis.new(:url => "redis://mymaster", :sentinels => SENTINELS, :role => :master)
103101
```
104102

105-
* The master name, that identifies a group of Redis instances composed of a master and one or more slaves, is specified in the url parameter (`mymaster` in the example).
106-
* It is possible to optionally provide a role. The allowed roles are `master` and `slave`, and the default is `master`. When the role is `slave` redis-rb will try to fetch a list of slaves and will connect to a random slave.
107-
* When using the Sentinel support you need to specify a list of Sentinels to connect to. The list does not need to enumerate all your Sentinel instances, but a few so that if one is down redis-rb will try the next one. The client is able to remember the last Sentinel that was able to reply correctly and will use it for the next requests.
103+
* The master name identifies a group of Redis instances composed of a master
104+
and one or more slaves (`mymaster` in the example).
105+
106+
* It is possible to optionally provide a role. The allowed roles are `master`
107+
and `slave`. When the role is `slave`, the client will try to connect to a
108+
random slave of the specified master.
109+
110+
* When using the Sentinel support you need to specify a list of sentinels to
111+
connect to. The list does not need to enumerate all your Sentinel instances,
112+
but a few so that if one is down the client will try the next one. The client
113+
is able to remember the last Sentinel that was able to reply correctly and will
114+
use it for the next requests.
108115

109116
## Storing objects
110117

@@ -187,7 +194,7 @@ end
187194
to redis, AND
188195
- your own code prevents the parent process from using the redis
189196
connection while a child is alive
190-
197+
191198
Improper use of `inherit_socket` will result in corrupted and/or incorrect
192199
responses.
193200

0 commit comments

Comments
 (0)