Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResponseError: NOWRITE You can't write against a non-write redis #131

Open
blindspoter opened this issue Apr 29, 2018 · 1 comment
Open

Comments

@blindspoter
Copy link

Hi:

I encountered a problem that returned this error:

/env/lib/python2.7/site-packages/twisted/internet/defer.py\", line 577, in _runCallbacks"}
current.result = callback(current.result, *args, **kw)"}
/env/lib/python2.7/site-packages/txredisapi.py\", line 463, in handle_reply"}
{"":"    raise r"}
{"":"txredisapi.ResponseError: NOWRITE You can't write against a non-write redis."}

and I use txredisapi.ConnectionPool to build a connection pool.

The redis is a sharding cluster,master sometimes will encounter the hardware failure,and cause the master-slave switching. The problem is that the master-slave switching will cause the cluster 30S to be read-only.,so this error occurs.

I have checked the code, the error raise from:

    @staticmethod
    def handle_reply(r):
        if isinstance(r, Exception):
            raise r
        return r

My proplem is how can i handle this error?disconnect the current connection and reconnect it? or disconnect all the connections from pool and recreate the pool?

@IlyaSkriblovsky
Copy link
Owner

Sorry, but txredisapi has no support for Redis Cluster yet. And I'm personally haven't used Cluster too.
So unfortunately, I can't help you here.

The cited code from handle_reply is just a common dispatcher all protocol errors are raised from.

Seems like the problem is that Redis node you are issuing write to is read-only. Probably txredisapi should be able to discover new master node, but for now it is only implemented for Redis Sentinel, but not for Redis Cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants