Search code examples
pythonherokuflaskredisredistogo

How to get client addr from redis?


I am testing Redis in heroku. I have simple flask app that can create the redis client and kill the client but ...

@app.route('/client-status')
def client_status():
    redis.client_setname("first")
    redis.client_kill('addr') #10.157.2.68:60097
    return "Success"

The question is how to get addr ? I know a way to get name redis.client_getname()...


Solution

  • you should use the command CLIENT LIST http://redis.io/commands/client-list to get all the information about the client connections server, and then retrieve the address field