Skip to content

Instantly share code, notes, and snippets.

Forked from doejoe13/
Created April 13, 2019 07:23
  • Star 11 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Paprikas/ef55f5b2401c4beec75f021590de6a67 to your computer and use it in GitHub Desktop.
How to run multiple Redis instances on Ubuntu 18.04

Create the directory for the new instance

$ sudo install -o redis -g redis -d /var/lib/redis2

Create a new configuration file

$ sudo cp -p /etc/redis/redis.conf /etc/redis/redis2.conf

Edit the new configuration file

$ sudo nano /etc/redis/redis2.conf
pidfile /var/run/redis2/
logfile /var/log/redis/redis-server2.log
dir /var/lib/redis2
port 6380

Create new service file

$ sudo cp /lib/systemd/system/redis-server.service /lib/systemd/system/redis-server2.service

Edit the new service file

$ sudo nano /lib/systemd/system/redis-server2.service
ExecStart=/usr/bin/redis-server /etc/redis/redis2.conf

Enable and start the service

$ sudo systemctl enable redis-server2.service
$ sudo systemctl start redis-server2.service

Check status

$ ps aux |grep redis
Copy link

zastavra commented Jun 24, 2021

I'm getting this error:

255584:C 24 Jun 2021 14:44:20.189 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 255584:C 24 Jun 2021 14:44:20.189 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=255584, just started 255584:C 24 Jun 2021 14:44:20.189 # Configuration loaded 255584:C 24 Jun 2021 14:44:20.189 * supervised by systemd, will signal readiness 255584:M 24 Jun 2021 14:44:20.190 # Can't open the append-only file: Read-only file system

Any idea how to fix this?


Copy link

ShadowMonster commented Sep 24, 2021

There is small mistake. Pid file path should be: PIDFile=/var/run/redis2/ in service file

Copy link

Hi, there is some mistake in this line here right ?

Copy link

System service should be modified without changing directory. Here's the difference that works:
@@ -8 +8 @@
-ExecStart=/usr/bin/redis-server /etc/redis/redis.conf
+ExecStart=/usr/bin/redis-server /etc/redis/redis-cache-server.conf
@@ -10 +10 @@
@@ -46 +46 @@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment