Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to run multiple Redis instances on Ubuntu 16.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/redis/redis-server2.pid
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 vim /lib/systemd/system/redis-server2.service
ExecStart=/usr/bin/redis-server /etc/redis/redis2.conf
PIDFile=/var/run/redis/redis-server2.pid
ReadWriteDirectories=-/var/lib/redis2
Alias=redis2.service

Enable and start the service

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

Check status

$ ps aux |grep redis
@jcconnell

This comment has been minimized.

Copy link

@jcconnell jcconnell commented Apr 7, 2018

Huge help, thank you!

@ndianabasi

This comment has been minimized.

Copy link

@ndianabasi ndianabasi commented May 23, 2018

Thank you. This was very apt and functional.

@khalana

This comment has been minimized.

Copy link

@khalana khalana commented Jul 13, 2018

Why is this better or different than starting a new instance by just specifying the port?

@mqgmaster

This comment has been minimized.

Copy link

@mqgmaster mqgmaster commented Aug 10, 2018

Thanks man :)

@byleese

This comment has been minimized.

Copy link

@byleese byleese commented Nov 8, 2018

Thank you very much!

@AdolfoP

This comment has been minimized.

Copy link

@AdolfoP AdolfoP commented Apr 24, 2019

Thanks!

@NNSTH

This comment has been minimized.

Copy link

@NNSTH NNSTH commented Aug 6, 2019

very useful! thanks a lot

@34code

This comment has been minimized.

Copy link

@34code 34code commented Aug 29, 2019

awesome, thanks!

@Subi

This comment has been minimized.

Copy link

@Subi Subi commented Sep 23, 2019

Thank you for this!

@SaeedSoltoon

This comment has been minimized.

Copy link

@SaeedSoltoon SaeedSoltoon commented Nov 24, 2019

Thank you so much!

@smwaycoder

This comment has been minimized.

Copy link

@smwaycoder smwaycoder commented Feb 29, 2020

Thank you!

@ariamn86

This comment has been minimized.

Copy link

@ariamn86 ariamn86 commented Jul 21, 2020

What a great instruction!

@ShahanMirza

This comment has been minimized.

Copy link

@ShahanMirza ShahanMirza commented Dec 8, 2020

Thanks a lot you saved my day, your notes help me a lot

@Muthukumaran-Banc91

This comment has been minimized.

Copy link

@Muthukumaran-Banc91 Muthukumaran-Banc91 commented Jan 7, 2021

can u say how to start the server with port 6380??

@ahmadpoorgholam

This comment has been minimized.

Copy link

@ahmadpoorgholam ahmadpoorgholam commented Jan 14, 2021

that was flawless

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