redisjedis

How can Jedis connect to a redis server using a socket connection?


I'm having problems figuring out how to use the Jedis library to connect to a redis socket connection.

I know how to connect through a network port:

Jedis jedis = new Jedis("localhost");
//Jedis jedis = new Jedis(unix_socket_path="/tmp/redis.sock");

But the socket connection(second in the list) doesn't work. The commands looked simlair to redis-py(python client) but when I tried the same syntax it didn't work. I also looked through the jedis sourcecode on github but couldn't see anything. Any ideas?


Solution

  • I don't think Jedis support unix domain sockets.

    The constructor with a single parameter only accepts a hostname (using default TCP port).

    Java is portable. It is supposed to provide the same API on different platforms. Unix domain sockets are specific to Unix/Linux. So the Java standard API does not support unix domain sockets. There are separate Java packages for this, but AFAIK, Jedis do not use them.