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
# You can also specify the options as a Hash. The options are the same as for a single server connection.
108
+
(7000..7005).map { |port| { host:'127.0.0.1', port: port } }
109
+
```
110
+
111
+
You can also specify only a subset of the nodes, and the client will discover the missing ones using the [CLUSTER NODES](https://redis.io/commands/cluster-nodes) command.
112
+
113
+
```ruby
114
+
Redis.new(cluster:%w[redis://127.0.0.1:7000])
115
+
```
116
+
117
+
If you want [the connection to be able to read from any replica](https://redis.io/commands/readonly), you must pass the `replica: true`. Note that this connection won't be usable to write keys.
118
+
119
+
```ruby
120
+
Redis.new(cluster: nodes, replica:true)
121
+
```
122
+
123
+
The calling code is responsible for [avoiding cross slot commands](https://redis.io/topics/cluster-spec#keys-distribution-model).
0 commit comments