Reputation: 81
I try to use redis for http session data replication. My Use case is as follows:
We have 2 indepentent datacenters(RZ and RR) each of them has 4 tomcat servers. I have installed redis cluster with sentinel (One Master, 2 slaves and 3 sentinels)on one dedicated server on each datacenter. Each cluster is working as expected.
Now I want to synchrinze data between the 2 Masters nodes (cross-datacenter replication), so if our loadbalancer decide to shwitch from DC RZ(Primary) to DC RR (secondary) session data is available and no session is lost.
I tried to install dynomite framework formy purpose but failling to install it. So My question can redis handle such senario without third party tools such dynomite?
Any Help to achieve the replication between datacenter is very willcome. Sorry for my bad english.
Thank you in Advance.
Upvotes: 8
Views: 7511
Reputation: 10793
You can do it with Redisson with Sentinel or Cluster deployments located in different data centers. One deployment is active (read-write) and others are passive (read-only). Active-passive cross data center replication is managed on Redisson side an can be asynchronous or synchronous.
Config example for two Redis Clusters. More info here
Config config = new Config();
config.useMultiClusterServers()
.setReplicationMode(ReplicationMode.ASYNC)
// use "rediss://" for SSL connection
.addAddress("redis://cluster1:7000", "redis://cluster2:70002");
RedissonClient redisson = Redisson.create(config);
Config example for two Redis Sentinels. More info here
Config config = new Config();
config.useMultiSentinelServers()
.setReplicationMode(ReplicationMode.ASYNC)
.setMasterName("mymaster")
// use "rediss://" for SSL connection
.addSentinelAddress("redis://sentinel_primary:26389",
"redis://sentinel_secondary1:26379",
"redis://sentinel_secondary2:26379")
Upvotes: 0
Reputation: 769
No, Redis does not offer master-master solution. See redis replication and cluster tutorial to understand how redis replication works
https://redis.io/topics/cluster-tutorial
Dynomite is brilliant active-active solution, we have been using it for quite sometime.
Upvotes: 2