Skip to content

Instantly share code, notes, and snippets.

@mattsta
Created October 21, 2014 21:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattsta/5d142b3c614b86b48822 to your computer and use it in GitHub Desktop.
Save mattsta/5d142b3c614b86b48822 to your computer and use it in GitHub Desktop.
redis systemd voodoo
[Unit]
Description=Redis Demo
After=network.target
[Service]
# Port 0 stops Redis from listening to ports by itself
ExecStart=/home/matt/repos/redis/src/redis-server --dir /tmp --port 0
PrivateTmp=yes
# Redis requires non-blocking sockets or else _nothing_ works
NonBlocking=yes
# Redis likes nodelay sockets (not supported by my version of systemd)
#NoDelay=yes
# Set your user and group Redis should run as here
User=matt
Group=matt
# Set ulimit before startup so Redis can accept over 10,000 connections
LimitNOFILE=30000
[Install]
WantedBy=multi-user.target
[Socket]
ListenStream=127.0.0.1:9994
ListenStream=/run/%p.sock
# If you use this as an instantiated unit, use per-instance sockets:
#ListenStream=/run/%p@%i.sock
# Redis likes a 511 backlog
Backlog=511
[Install]
WantedBy=sockets.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment