Redis /etc/systemd/redis-server.service

Original 📋 Debian 9 (Stretch) 40 lines

Details

Size
40 lines
MD5
f1219ac0b2acfb3d20175177ccac190c
SHA256
ef83034af879b8425b07a1a5d9a184a27c8c9e72f45ceb81ba64a01c719dcc25
/etc/systemd/redis-server.service
[Unit]
Description=Advanced key-value store
After=network.target
Documentation=http://redis.io/documentation, man:redis-server(1)

[Service]
Type=forking
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
PIDFile=/var/run/redis/redis-server.pid
TimeoutStopSec=0
Restart=always
User=redis
Group=redis
RuntimeDirectory=redis

ExecStartPre=-/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d
ExecStartPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-up.d
ExecStop=-/bin/run-parts --verbose /etc/redis/redis-server.pre-down.d
ExecStop=/bin/kill -s TERM $MAINPID
ExecStopPost=-/bin/run-parts --verbose /etc/redis/redis-server.post-down.d

UMask=007
PrivateTmp=yes
LimitNOFILE=65535
PrivateDevices=yes
ProtectHome=yes
ReadOnlyDirectories=/
ReadWriteDirectories=-/var/lib/redis
ReadWriteDirectories=-/var/log/redis
ReadWriteDirectories=-/var/run/redis
CapabilityBoundingSet=~CAP_SYS_PTRACE

# redis-server writes its own config file when in cluster mode so we allow
# writing there (NB. ProtectSystem=true over ProtectSystem=full)
ProtectSystem=true
ReadWriteDirectories=-/etc/redis

[Install]
WantedBy=multi-user.target
Alias=redis.service

Copy & Paste

curl:
curl https://exampleconfig.com/api/v1/config/original/f1219ac0b2acfb3d20175177ccac190c?hint=redis-server.service
wget:
wget -O redis-server.service https://exampleconfig.com/api/v1/config/original/f1219ac0b2acfb3d20175177ccac190c?hint=redis-server.service

For AI Agents

<prompt><role>DevOps agent</role><source url='https://exampleconfig.com/api/v1/config/original/f1219ac0b2acfb3d20175177ccac190c?hint=redis-server.service' /><config><app>Redis</app><os>Debian 9 (Stretch)</os><location>/etc/systemd/redis-server.service</location><lines>40</lines><md5>f1219ac0b2acfb3d20175177ccac190c</md5><sha256>ef83034af879b8425b07a1a5d9a184a27c8c9e72f45ceb81ba64a01c719dcc25</sha256></config></prompt>

Paste into Claude, ChatGPT, or any AI assistant.

Install Redis

Alpine Linux

sudo apk add redis

Debian

sudo apt update && sudo apt install redis-server

Ubuntu

sudo apt update && sudo apt install redis-server

File Location

File Path
/etc/systemd/redis-server.service
Directory
/etc/systemd/
Significance
System-wide configuration directory
Description
Files in /etc/ contain system-wide configuration settings that affect all users.

FAQ

When should I use this redis-server.service?

Use it to restore a missing default, confirm what shipped, or diff against your current Redis config.

How do I restore Redis defaults?

Download the file, back up the current one in /etc/systemd/redis-server.service, replace it, then reload or restart Redis.

Is redis-server.service safe for production?

It is the vendor default for Debian 9 (Stretch). Treat it as a baseline and review security and performance settings before production use.

How does this differ from other OS versions?

Defaults vary by distro and version. This copy matches Debian 9 (Stretch).

Can I use this for Redis troubleshooting?

Yes. Diff it against yours to find drift, then restore only the sections you need.