Redis
Containing all the file necessary in order to do the experiment:
- redis-cluster
- redis-py-cluster
- redis-py
- redis-single
redis-cluster
Containing all the redis servers, 6 nodes, configuration file in order to run a redis cluster.
Installation
$ cd ./redis-cluster/redis
$ make
$ sudo make install
Instructions
- Open 6 terminals, each one for a single node.
- Perform the following command in each terminal:
$ ./redis-cluster/redis-server ./redis-cluster/7000/redis.conf
- After the above configuration
$ ./redis-cluster/redis/src/redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
-
The above command line will create 6 nodes in a 3 master - 3 nodes mode.
-
NOTE: the 7000 should be replaced as 7001, 7002, 7003, 7004, 7005 as in 6 terminals.
-
NOTE: the redis inside redis-cluster is from the unstable repo of redis that is currently under construction but perform cluster feature version of redis.
-
The official document can be found here.
-
More specific document can be found here
redis-py-cluster
- A python client to interact with redis cluster.
- NOTE: redis-py may require
- Python 3.4.0 not support
Installation
$ cd redis-py-cluster
$ sudo python setup.py install
Instructions
Small sample script that show how to get started with RedisCluster. decode_responses=True
is required to have when running on python3.
>>> from rediscluster import StrictRedisCluster
>>> startup_nodes = [{"host": "127.0.0.1", "port": "7000"}]
>>> rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
>>> rc.set("foo", "bar")
True
>>> rc.get("foo")
'bar'
The following imports can be imported from redis
package.
StrictRedisCluster
RedisCluster
StrictClusterPipeline
ClusterPubSub
StrictRedisCluster
is based on redis.StrictRedis
and RedisCluster
has the same functionality as redis.Redis
even if it is not directly based on it.
GitHub repo can be found here
redis-py
Python client for redis (not cluster)
Installation
$ cd redis-py
$ sudo python setup.py install
Instructions
>>> import redis
>>> r = redis.StrictRedis(host='localhost', port=6379, db=0)
>>> r.set('foo', 'bar')
True
>>> r.get('foo')
'bar'
GitHub repo can be found here
redis-single
A single redis NoSQL database.
Formal information can be found here