Skip to content

Commit 5b7bad4

Browse files
authored
docs: add usage examples to readme (#117)
1 parent 78e2e24 commit 5b7bad4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ RedisClient.cluster(timeout: 3.0).new_client
5050
RedisClient.cluster(nodes: %w[redis://node1:6379 redis://node2:6379]).new_client
5151
```
5252

53+
```ruby
54+
# To connect with a subset of auth-needed nodes for startup
55+
56+
# User name and password should be URI encoded and the same in every node.
57+
username = 'myuser'
58+
password = URI.encode_www_form_component('!&<123-abc>')
59+
60+
# with URL:
61+
RedisClient.cluster(nodes: %W[redis://#{username}:#{password}@node1:6379 redis://#{username}:#{password}@node2:6379]).new_client
62+
63+
# with options:
64+
RedisClient.cluster(nodes: %w[redis://node1:6379 redis://node2:6379], username: username, password: password).new_client
65+
```
66+
5367
```ruby
5468
# To connect to single endpoint
5569
RedisClient.cluster(nodes: 'redis://endpoint.example.com:6379').new_client

0 commit comments

Comments
 (0)