diff options
author | Terence Honles <terence@honles.com> | 2021-11-08 16:54:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-08 17:54:24 +0200 |
commit | fea7b85dde375a228f485d27737de66592b28848 (patch) | |
tree | 9faee58304479a7c66ce0755c838b07f402a03ae /README.md | |
parent | 325fcd9e15bf0125f9a60012d7eb7824e7b4ab33 (diff) | |
download | redis-py-fea7b85dde375a228f485d27737de66592b28848.tar.gz |
Export Sentinel, and SSL like other classes (#1671)
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -365,7 +365,7 @@ Connecting redis-py to the Sentinel instance(s) is easy. You can use a Sentinel connection to discover the master and slaves network addresses: ``` pycon ->>> from redis.sentinel import Sentinel +>>> from redis import Sentinel >>> sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1) >>> sentinel.discover_master('mymaster') ('127.0.0.1', 6379) @@ -373,6 +373,18 @@ Sentinel connection to discover the master and slaves network addresses: [('127.0.0.1', 6380)] ``` +To connect to a sentinel which uses SSL ([see SSL +connections](#ssl-connections) for more examples of SSL configurations): + +``` pycon +>>> from redis import Sentinel +>>> sentinel = Sentinel([('localhost', 26379)], + ssl=True, + ssl_ca_certs='/etc/ssl/certs/ca-certificates.crt') +>>> sentinel.discover_master('mymaster') +('127.0.0.1', 6379) +``` + You can also create Redis client connections from a Sentinel instance. You can connect to either the master (for write operations) or a slave (for read-only operations). |