Is it possible to host 2 redis databases on the same linux server?
The reason why there is 2 redis dbs, is because the client we support Redis for has two environments. So each of the redis dbs have different data on.
I know that I can build another linux box and host it from there too, but the company wants to save costs.
This is kind of the flow I need.
Environment 1 -> Redis Server -> Redis db 1
Environment 2 -> Redis Server -> Redis db 2
The only dilemma is, how do you distinguish what database you want each environment to use?
3
Answers
You can install docker and operate with two redis instances at the same time, see https://github.com/ThiagoBarradas/multi-redis-docker
They would run on the same server and you would be able to communicate with both.
Not sure I understand the issue, but you can run two (or more) Redis instances on a single machine by running each instance on a different port.
So you would copy your normal
redis.conf
that runs on port 6379 and make a newredis.conf
file, maybe calledredis-6378.conf
and in there you would have some lines like this:Then, when you want to connect to the instance on port 6378, you just specify the port number:
Yes, you can! The two instances do need seperate ports however, and also different storage backends. Otherwise the data between them might be shared, which might or moght not be what you are looking for. For loadbalancing please see this question
The two redis instances should run without conflicts.