Could I change redis to unix socket?


#1

Hi

Does anyone know how to change redis from tcp/ip to unix socket?

Thanks very much


#2

Instead of:

connectPort = PortNumber 6379

you would have:

connectPort = UnixSocket “/tmp/redis.sock”

Of course, /tmp/redis.sock should be declared in the server-side Redis configuration file using the following parameters:

unixsocket /tmp/redis.sock unixsocketperm 755

Please note by default, unix domain socket parameters are commented out.


#3

In upstream.conf

I change to pstream redis { server unix:/run/redis/redis.sock; #server 127.0.0.1:6379; keepalive 10; }

And it’s not working


#4