Code Monkey home page Code Monkey logo

pyredis's Introduction

Introduction

Redis Client implementation for Python. The Client only supports Python 3 for the moment. If there is enough interest, i will make it work with Python 2.

Currently implemented Features:
  • Base Redis Client
  • Publish Subscribe Client
  • Sentinel Client
  • Connection Pool
  • Sentinel Backed Connection Pool
  • Client & Pool for Redis Cluster
  • Bulk Mode ( Not supported with Redis Cluster )
  • Client & Pool with Static Hash Cluster (Supports Bulk Mode)
  • Sentinel Backed Pool with Static Hash Cluster (Supports Bulk Mode)

Documentation

http://pyredis.readthedocs.org/

Installing

pyredis can be installed via pip as follows:

pip install python_redis

Author

Stephan Schultchen <[email protected]>

License

Unless stated otherwise on-file pyredis uses the MIT license, check LICENSE file.

Contributing

If you'd like to contribute, fork the project, make a patch and send a pull request.

pyredis's People

Contributors

alozovskoy avatar schlitzered avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyredis's Issues

1025 file descriptors

Hi i need a redis python library that uses poll or epoll to connect rather than select.

On linux select only allows 1024 file descriptors, i need a lot more. Does this package use this and if not is it difficult to convert?

AttributeError: CCITT

Hi,

the crc package got a breaking change with https://github.com/Nicoretti/crc/releases/tag/7.0.0,

which leads to run-time errors like

/site-packages/pyredis/helper.py", line 12, in <module>
crc16 = crc.Calculator(crc.Crc16.CCITT)
AttributeError: CCITT

With my limited knowledge I think solution 2 from the migration guide that is added to the above releasenotes of crc applies:

Solution: Replace all usages of Crc16.CCITT in your code with Crc16.XMODEM.

What do you think?

Best regards,
Maurice

crc16 is not supported ?

Hi,

Thanks for the great package, we are using this for rate-limiting application. Due to advancements in other packages, this version is incompatible. I get the below error :

Building wheel for crc16 (setup.py): started

Building wheel for crc16 (setup.py): finished with status 'error'
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
running bdist_wheel
running build
running build_py
Generating grammar tables from /usr/lib/python3.10/lib2to3/Grammar.txt
Generating grammar tables from /usr/lib/python3.10/lib2to3/PatternGrammar.txt
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/crc16
copying python3x/crc16/init.py -> build/lib.linux-x86_64-3.10/crc16
copying python3x/crc16/test.py -> build/lib.linux-x86_64-3.10/crc16
copying python3x/crc16/crc16pure.py -> build/lib.linux-x86_64-3.10/crc16
running build_ext
building 'crc16._crc16' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/src
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.10 -I/var/lib/openstack/include/python3.10 -c src/_crc16module.c -o build/temp.linux-x86_64-3.10/src/_crc16module.o
error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for crc16
Running setup.py clean for crc16
Successfully built raven watcher-middleware audit-middleware rate-limit-middleware glance_store
Failed to build crc16
64.88 ERROR: Could not build wheels for crc16, which is required to install pyproject.toml-based projects
ERROR: process "/bin/sh -c /opt/loci/scripts/install.sh" did not complete successfully: exit code: 1

Could you please provide a fix ?

Regards,
Rajiv

Unable to execute simple cluster commands using ClusterClient when slave_ok=True

I have a Redis Cluster with 9 instances—3 masters and 6 slaves. I want to connect pyredis to this cluster and execute simple commands like get and set. Without informing pyredis of any of the slave nodes, this works fine. For example:

cc = ClusterClient(seeds=[("master1_ip",6379), ("master2_ip",6379), ("master3_ip",6379)], slave_ok=False)
cc.set("key", "value")

correctly sets "key" to "value" on the appropriate master instance. Furthermore, even if I list all the instances, as long as slave_ok is still False, get and set seem to behave correctly. For example:

cc = ClusterClient(seeds=[("master1_ip",6379), ("master2_ip",6379), ("master3_ip",6379), ("slave1_ip",6380), ("slave2_ip",6380), ("slave3_ip",6380), ("slave4_ip",6381), ("slave5_ip",6381), ("slave6_ip",6381)], slave_ok=False)
cc.get("key")

will similarly correctly get the value at "key". However, as soon as I toggle slave_ok to True in either of the above examples (with or without listing the slave instances in seeds—I'm also not sure which form is correct), I get the following error:

pyredis.exceptions.PyRedisError: Slot moved to often or wrong shard_key, giving up,

and the get or set request is never processed by the cluster. It seems, at least, that requests are hitting the cluster, because preceding the above PyRedisError, I see errors of the form pyredis.exceptions.ReplyError: MOVED (hashslot) (ip):(port)—this seems like a response from the cluster telling pyredis that it should redirect a request from one instance/shard to another.

I'm curious as to the cause of this error. And furthermore, what does the slave_ok option actually do/change? I thought that enabling it might allow me to do something like direct sets to masters and gets to slaves, but I can't find any description other than "Set to True if this Client should use slave nodes" in the documentation.

Thank you.

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.