Search code examples
redis

How can I use local redis client to connect to socket


I know if I do redis-cli -h {ip_address} -p {port} I can connect to a specific port/ip but I've set my instance to not listen to any tcp/ip ports instead it listens to local socket.

How can I establish a socket connection with the redis client?


Solution

  • You can connect from redis-cli or redis-benchmark simply by using the -s option and providing the path of your unix domain socket.

    For instance:

    redis-cli -s /tmp/redis.sock
    redis-benchmark -q -n 10000 -s /tmp/redis.sock