Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dboyliao/redis_replica
https://github.com/dboyliao/redis_replica
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dboyliao/redis_replica
- Owner: dboyliao
- Created: 2015-04-06T08:20:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-07T07:37:29.000Z (over 9 years ago)
- Last Synced: 2024-03-15T01:43:11.859Z (8 months ago)
- Language: Python
- Size: 117 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redis Replication Set Client
**Warning**: This is not the offical redis-py package. I write this since I didn't find a way to automatically connect to available hosts in a redis replication set using StricRedis from the offical redis-py package.
(If you know there is a way to do that, please let me know.....I google it for a long time and did not see useful information.)
## Basic Usage
```
# Suppose you have two redis-server on localhost at port 6379 and 6380, respectively, and the one at port 6380 is the primary host.from redis_replica import RedisReplicaClient
hosts = ["localhost:6379", "localhost:6380"]
r_rs = RedisReplicaClient(hosts = hosts)
r_rs.connection_info() # Current connection established on: localhost:6380
```- `RedisReplicaClient` will automatically connect to the primary host.
- all the keyword arguments apply to `StricRedis` are also valid in `RedisReplicaClient`.## Installation
- `git clone https://github.com/dboyliao/redis_replica.git && cd redis_replica`
- `python setup.py install`I hope you enjoy using it. :)