Can I use redis-cli with a connection URL?

Alessandro Cosentino picture Alessandro Cosentino · Jul 8, 2016 · Viewed 13.6k times · Source

I am used to psql which I can use by feeding it the connection string without having to break it in different arguments, that is,

psql postgres://<username>:<password>@<host>:<port>

This is useful when I have such string from Heroku, for example. Can I do something similar with redis-cli? I want to feed it directly a connection string, such as the one that is stored on Heroku as environment variable when I install a Redis add-on. Is that possible? Example of the syntax I would like to use:

redis-cli redis://<username>:<password>@<host>:<port>

Answer

Itamar Haber picture Itamar Haber · Jul 8, 2016

No, at the moment (v3.2.1) redis-cli does not support the URI connection schema. If you want, you can make a feature or pull request for that in the Redis repository.

UPDATE: The -u option was released with Redis 4.0, see Release notes.