Skip to content

Commit 65a0528

Browse files
ipmbbbrowning918
andauthored
Migrated from aioredis to redis-py (#296)
Co-authored-by: bbrowning918 <[email protected]>
1 parent bba9319 commit 65a0528

File tree

8 files changed

+180
-335
lines changed

8 files changed

+180
-335
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"]``.
@@ -226,6 +236,28 @@ Your Redis server must support the following commands:
226236

227237
* ``RedisPubSubChannelLayer`` uses ``PUBLISH``, ``SUBSCRIBE``, ``UNSUBSCRIBE``
228238

239+
Local Development
240+
-----------------
241+
242+
You can run the necessary Redis instances in Docker with the following commands:
243+
244+
.. code-block:: shell
245+
246+
$ docker network create redis-network
247+
$ docker run --rm \
248+
--network=redis-network \
249+
--name=redis-server \
250+
-p 6379:6379 \
251+
redis
252+
$ docker run --rm \
253+
--network redis-network \
254+
--name redis-sentinel \
255+
-e REDIS_MASTER_HOST=redis-server \
256+
-e REDIS_MASTER_SET=sentinel \
257+
-e REDIS_SENTINEL_QUORUM=1 \
258+
-p 26379:26379 \
259+
bitnami/redis-sentinel
260+
229261
Contributing
230262
------------
231263

0 commit comments

Comments
 (0)