Skip to content

Instantly share code, notes, and snippets.

@inecmc
Created August 4, 2017 08:06
Show Gist options
  • Select an option

  • Save inecmc/f40ca0ee622e86999d9aa016c1b15e8c to your computer and use it in GitHub Desktop.

Select an option

Save inecmc/f40ca0ee622e86999d9aa016c1b15e8c to your computer and use it in GitHub Desktop.
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
@mqgmaster

Copy link
Copy Markdown

Thanks man :)

@byleese

byleese commented Nov 8, 2018

Copy link
Copy Markdown

Thank you very much!

@AdolfoP

AdolfoP commented Apr 24, 2019

Copy link
Copy Markdown

Thanks!

@NNSTH

NNSTH commented Aug 6, 2019

Copy link
Copy Markdown

very useful! thanks a lot

@34code

34code commented Aug 29, 2019

Copy link
Copy Markdown

awesome, thanks!

@Subi

Subi commented Sep 23, 2019

Copy link
Copy Markdown

Thank you for this!

@SaeedSoltoon

Copy link
Copy Markdown

Thank you so much!

@ashuroff

Copy link
Copy Markdown

Thank you!

@ariamn86

Copy link
Copy Markdown

What a great instruction!

@ShahanMirza

Copy link
Copy Markdown

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

@Muthukumaran-Banc91

Copy link
Copy Markdown

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

@ahmadpoorgholam

Copy link
Copy Markdown

that was flawless

@troublestarter

Copy link
Copy Markdown

Great

@amit-teachmint

Copy link
Copy Markdown

Do a daemon-reload before starting service.
sudo systemctl daemon-reload

@hgati

hgati commented Aug 13, 2023

Copy link
Copy Markdown

thanks. ma'am :)

@praveensharma-motherson

Copy link
Copy Markdown

after following the above steps getting following message
ubuntu on windows 10 - second instance not starting..
pls help

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

@ifeLight

ifeLight commented Sep 25, 2023

Copy link
Copy Markdown

Still working. Great job

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