Skip to content

Commit 518a96a

Browse files
ipmbbbrowning918
authored and
Shi Feng
committed
Upgrade to v4.1.0
Migrated from aioredis to redis-py (django#296) Co-authored-by: bbrowning918 <[email protected]>
1 parent 0190e89 commit 518a96a

File tree

8 files changed

+196
-351
lines changed

8 files changed

+196
-351
lines changed

README.rst

+38-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Provides Django Channels channel layers that use Redis as a backing store.
1111

1212
There are two available implementations:
1313

14-
* ``RedisChannelLayer`` is the orignal layer, and implements channel and group
14+
* ``RedisChannelLayer`` is the original layer, and implements channel and group
1515
handling itself.
1616
* ``RedisPubSubChannelLayer`` is newer and leverages Redis Pub/Sub for message
1717
dispatch. This layer is currently at *Beta* status, meaning it may be subject
@@ -65,13 +65,23 @@ Possible options for ``CONFIG`` are listed below.
6565
``hosts``
6666
~~~~~~~~~
6767

68-
The server(s) to connect to, as either URIs, ``(host, port)`` tuples, or dicts conforming to `create_connection <https://aioredis.readthedocs.io/en/v1.1.0/api_reference.html#aioredis.create_connection>`_.
69-
Defaults to ``['localhost', 6379]``. Pass multiple hosts to enable sharding,
68+
The server(s) to connect to, as either URIs, ``(host, port)`` tuples, or dicts conforming to `redis Connection <https://redis-py.readthedocs.io/en/v4.3.3/connections.html#redis.connection.Connection>`_.
69+
Defaults to ``redis://localhost:6379``. Pass multiple hosts to enable sharding,
7070
but note that changing the host list will lose some sharded data.
7171

72-
Sentinel connections require dicts conforming to `create_sentinel <https://aioredis.readthedocs.io/en/v1.3.0/sentinel.html#aioredis.sentinel.create_sentinel>`_
73-
with an additional `master_name` key specifying the Sentinel
74-
master set. Plain Redis and Sentinel connections can be mixed and matched if
72+
Sentinel connections require dicts conforming to:
73+
74+
.. code-block::
75+
76+
{
77+
"sentinels": [
78+
("localhost", 26379),
79+
],
80+
"master_name": SENTINEL_MASTER_SET,
81+
**kwargs
82+
}
83+
84+
note the additional ``master_name`` key specifying the Sentinel master set and any additional connection kwargs can also be passed. Plain Redis and Sentinel connections can be mixed and matched if
7585
sharding.
7686

7787
If your server is listening on a UNIX domain socket, you can also use that to connect: ``["unix:///path/to/redis.sock"]``.
@@ -233,6 +243,28 @@ Your Redis server must support the following commands:
233243

234244
* ``RedisPubSubChannelLayer`` uses ``PUBLISH``, ``SUBSCRIBE``, ``UNSUBSCRIBE``
235245

246+
Local Development
247+
-----------------
248+
249+
You can run the necessary Redis instances in Docker with the following commands:
250+
251+
.. code-block:: shell
252+
253+
$ docker network create redis-network
254+
$ docker run --rm \
255+
--network=redis-network \
256+
--name=redis-server \
257+
-p 6379:6379 \
258+
redis
259+
$ docker run --rm \
260+
--network redis-network \
261+
--name redis-sentinel \
262+
-e REDIS_MASTER_HOST=redis-server \
263+
-e REDIS_MASTER_SET=sentinel \
264+
-e REDIS_SENTINEL_QUORUM=1 \
265+
-p 26379:26379 \
266+
bitnami/redis-sentinel
267+
236268
Contributing
237269
------------
238270

0 commit comments

Comments
 (0)