GithubHelp home page GithubHelp logo

cloudxtreme / redis-py-cluster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from baranbartu/redis-py-cluster

0.0 1.0 0.0 518 KB

Python cluster client for the official cluster support targeted for redis 3.0

Makefile 4.08% Python 79.19% Ruby 16.73%

redis-py-cluster's Introduction

redis-py-cluster

This client provides a working client for redis cluster that was added in redis 3.0.

This project is a port of redis-rb-cluster by antirez, with alot of added functionality. The original source can be found at https://github.com/antirez/redis-rb-cluster

Build Status Coverage Status PyPI version Code Health

Project status

If you have a problem with the code or general questions about this lib, you can ping me inside the gitter channel that you can find here ![Gitter](https://badges.gitter.im/Join Chat.svg) and i will help you out with problems or usage of this lib.

As of release 1.0.0 this project will be considered stable and usable in production. If you are going to use redis cluster in your project, you should read up on all documentation that you can find in the bottom of this Readme file. It will contain usage examples and descriptions of what is and what is not implemented. It will also describe how and why things work the way they do in this client.

On the topic about porting/moving this code into redis-py there is currently work over here redis/redis-py#604 that will bring cluster support based on this code. But my suggestion is that until that work is completed that you should use this lib.

Installation

Latest stable release from pypi

$ pip install redis-py-cluster

or from source

$ python setup.py install

Usage example

Small sample script that shows how to get started with RedisCluster. It can also be found in examples/basic.py

>>> from rediscluster import StrictRedisCluster

>>> startup_nodes = [{"host": "127.0.0.1", "port": "7000"}]

>>> # Note: decode_responses must be set to True when used with python3
>>> rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)

>>> rc.set("foo", "bar")
True
>>> print(rc.get("foo"))
'bar'

Upgrading instructions

Please read the following documentation that will go through all changes that is required when upgrading redis-py-cluster between versions.

Dependencies & supported python versions

  • Python: redis >= 2.10.2, <= 2.10.5 is required. Older versions in the 2.10.x series can work but using the latest one is allways recommended.
  • Optional Python: hiredis >= 0.2.0. Older versions might work but is not tested.
  • A working Redis cluster based on version >= 3.0.0 is required. Only 3.0.x releases is supported.

Latest release of Hiredis is tested on all supported python versions.

List of all supported python versions.

  • 2.7
  • 3.3
  • 3.4.1+
  • 3.5

Experimental:

  • Python 3.6.0a0

Python 3.4.0

A segfault was found when running redis-py in python 3.4.0 that was introduced into the codebase in python 3.4.0. Because of this both redis-py and redis-py-cluster will not work when running with 3.4.0. This lib has decided to block the lib from execution on 3.4.0 and you will get a exception when trying to import the code. The only solution is to use python 3.4.1 or some other higher minor version in the 3.4 series.

Testing

All tests are currently built around a 6 redis server cluster setup (3 masters + 3 slaves). One server must be using port 7000 for redis cluster discovery.

The easiest way to setup a cluster is to use either a Docker or Vagrant. They are both described in Setup a redis cluster. Manually, Docker & Vagrant.

To run all tests in all supported environments with tox read this Tox multienv testing

More documentation

More detailed documentation can be found in docs folder.

Disclaimer

Both Redis cluster and redis-py-cluster is considered stable and production ready.

But this depends on what you are going to use clustering for. In the simple use cases with SET/GET and other single key functions there is not issues. If you require multi key functinoality or pipelines then you must be very careful when developing because they work slightly different from the normal redis server.

If you require advance features like pubsub or scripting, this lib and redis do not handle that kind of use-cases very well. You either need to develop a custom solution yourself or use a non clustered redis server for that.

Finally, this lib itself is very stable and i know of atleast 2 companies that use this in production with high loads and big cluster sizes.

License & Authors

MIT (See docs/License.txt file)

The license should be the same as redis-py (https://github.com/andymccurdy/redis-py)

redis-py-cluster's People

Contributors

72squared avatar alisaifee avatar artiom avatar awestendorf avatar davidjfelix avatar dobrite avatar etng avatar grokzen avatar imzack avatar mumumu avatar orthographic-pedant avatar pci avatar svrana avatar tpiron avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.