Redis-Sentinel-Url-1.0.1
توضیحات
A factory for redis connection that supports using Redis Sentinel
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | Redis-Sentinel-Url-1.0.1 |
| نام | Redis-Sentinel-Url |
| نسخه کتابخانه | 1.0.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Martin Sucha |
| ایمیل نویسنده | martin.sucha@exponea.com |
| آدرس صفحه اصلی | https://github.com/exponea/redis-sentinel-url |
| آدرس اینترنتی | https://pypi.org/project/Redis-Sentinel-Url/ |
| مجوز | Apache 2.0 |
Redis-Sentinel-Url
==================
.. image:: https://travis-ci.org/exponea/redis-sentinel-url.svg
:target: https://travis-ci.org/exponea/redis-sentinel-url
:alt: Travis CI
Redis-Sentinel-Url provides parser and connection factory for `redis://` and `redis+sentinel://` URLs (the latter
being defined by this package).
* Supports Python 2.7 and 3.3+
* Licensed using Apache License 2.0
Installation
------------
Install with pip::
pip install Redis-Sentinel-Url
URL scheme for connecting via Sentinel
--------------------------------------
This package defines `redis+sentinel://` scheme for connecting to Redis via Sentinel::
redis+sentinel://[:password@]host:port[,host2:port2,...][/service_name[/db]][?param1=value1[¶m2=value=2&...]]
- You can specify multiple sentinel host:port pairs separated by comma.
- If `service_name` is provided, it is used to create a default client
- `service_name` and `db` can also be specified as URL parameters (URL parameters take precedence)
- Client options (keyword arguments to `redis.StrictRedis`) are specified as URL parameters
- Options for connecting to Sentinel (keyword arguments to `redis.sentinel.Sentinel`) are specified
with `sentinel_` prefix
- There is special `client_type` option to specify whether the default client should be `master` (the default) or
`slave` service when connecting via Sentinel
Basic usage
-----------
Supports schemes supported by `redis.StrictRedis.from_url` and also `redis+sentinel://` scheme described above:
.. code-block:: python
import redis_sentinel_url
sentinel, client = redis_sentinel_url.connect('redis://localhost/0')
# None, StrictRedis(...)
sentinel, client = redis_sentinel_url.connect('rediss://localhost/0')
# None, StrictRedis(...)
sentinel, client = redis_sentinel_url.connect('unix://[:password]@/path/to/socket.sock?db=0')
# None, StrictRedis(...)
sentinel, client = redis_sentinel_url.connect('redis+sentinel://localhost:26379,otherhost:26479/mymaster/0')
# Sentinel(...), StrictRedis(...)
نیازمندی
| مقدار | نام |
|---|---|
| >=2.10.3 | redis |
نحوه نصب
نصب پکیج whl Redis-Sentinel-Url-1.0.1:
pip install Redis-Sentinel-Url-1.0.1.whl
نصب پکیج tar.gz Redis-Sentinel-Url-1.0.1:
pip install Redis-Sentinel-Url-1.0.1.tar.gz