summaryrefslogtreecommitdiff
path: root/docs/connections.rst
blob: b481689b9b1f4781bc4e49a6b40a29189ec65d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
Connecting to Redis
###################


Generic Client
**************

This is the client used to connect directly to a standard Redis node.

.. autoclass:: redis.Redis
   :members:


Sentinel Client
***************

Redis `Sentinel <https://redis.io/topics/sentinel>`_ provides high availability for Redis. There are commands that can only be executed against a Redis node running in sentinel mode. Connecting to those nodes, and executing commands against them requires a Sentinel connection.

Connection example (assumes Redis exists on the ports listed below):

   >>> from redis import Sentinel
   >>> sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1)
   >>> sentinel.discover_master('mymaster')
   ('127.0.0.1', 6379)
   >>> sentinel.discover_slaves('mymaster')
   [('127.0.0.1', 6380)]

Sentinel
========
.. autoclass:: redis.sentinel.Sentinel
    :members:

SentinelConnectionPool
======================
.. autoclass:: redis.sentinel.SentinelConnectionPool
    :members:


Cluster Client
**************

This client is used for connecting to a Redis Cluster.

RedisCluster
============
.. autoclass:: redis.cluster.RedisCluster
    :members:

ClusterNode
===========
.. autoclass:: redis.cluster.ClusterNode
    :members:


Async Client
************

See complete example: `here <examples/asyncio_examples.html>`_

This client is used for communicating with Redis, asynchronously.

.. autoclass:: redis.asyncio.client.Redis
    :members:


Async Cluster Client
********************

RedisCluster (Async)
====================
.. autoclass:: redis.asyncio.cluster.RedisCluster
    :members:

ClusterNode (Async)
===================
.. autoclass:: redis.asyncio.cluster.ClusterNode
    :members:

ClusterPipeline (Async)
===================
.. autoclass:: redis.asyncio.cluster.ClusterPipeline
    :members:


Connection
**********

See complete example: `here <examples/connection_examples.html>`_

Connection
==========
.. autoclass:: redis.connection.Connection
    :members:

Connection (Async)
==================
.. autoclass:: redis.asyncio.connection.Connection
    :members:


Connection Pools
****************

See complete example: `here <examples/connection_examples.html>`_

ConnectionPool
==============
.. autoclass:: redis.connection.ConnectionPool
    :members:

ConnectionPool (Async)
======================
.. autoclass:: redis.asyncio.connection.ConnectionPool
    :members: