It'd be nice if redis could create a directory for it's socket (if socket is specified in config or cli).
On some systems (like Ubuntu), the /var/run directory is mounted as tmpfs and get cleaned out at reboots, so having socket path like /var/run/redis/redis.sock causes redis to fail at start:
27301:M 24 Aug 12:57:22.035 # Opening Unix socket: bind: No such file or directory
Having init.d script making the seocket directory solves the problem for those who runs redis from init.d but not for those who use cli or supervisor (etc).
can u provide redis.conf ?
I'm running several instances of redis with a default config and specify different socket files (per each instance) as a command line parameters to redis-server:
--port 6951 --unixsocket /var/run/redis/shard_6951.sock --unixsocketperm 775
I, however, need to precreate the socket directory (/var/run/redis/) after every reboot of the server.
It would be nice to add a functionality, that checks if socket's directory exists and creates it if it doesn't, before creating the socket.
i did it this way (via systemd config file for redis)
[Service]
PermissionsStartOnly=true
ExecStartPre=/usr/bin/mkdir -p /var/run/redis/6379
ExecStartPre=/usr/bin/chown -R redis: /var/run/redis
ExecStart=/usr/local/bin/redis-server /etc/redis/%i.conf --daemonize no
ExecStop=/usr/local/bin/redis-cli -h 127.0.0.1 -p %i shutdown
User=redis
Group=redis
LimitNOFILE=40128
thanks to hints from here: https://blog.hqcodeshop.fi/archives/93-Handling-varrun-with-systemd.html
Most helpful comment
I'm running several instances of redis with a default config and specify different socket files (per each instance) as a command line parameters to redis-server:
I, however, need to precreate the socket directory (/var/run/redis/) after every reboot of the server.
It would be nice to add a functionality, that checks if socket's directory exists and creates it if it doesn't, before creating the socket.