Lang thang
Lang thang

Reputation: 291

How to configure multiple Redis ports in the host server

I'm using the MVC for personal projects.

I use Redis to cache data.

Here is my configuration:

    <add key="RedisCacheHost" value="127.0.0.1" />
    <add key="RedisCachePort" value="6379" />

But in this server, I have two website that used Redis with the same Cache_key. So, it shows data incorrect.

How to configure for one server with port 6379, and the another server with port 6380?

Please advise.

Thanks.

Upvotes: 0

Views: 1434

Answers (1)

Carl Dacosta
Carl Dacosta

Reputation: 891

You can create two redis conf files, say redis.6379.conf and redis.6380.conf. Make sure to set the port appropriately as 6379 or 6380 in these conf files. Then run the two redis servers with it's respective conf file as an argument. Like this: redis-server redis.6379.conf redis-server redis.6379.conf

You now have two redis servers, one listening on port 6379 and one listening on port 6380.

Upvotes: 1

Related Questions