grails-redis icon indicating copy to clipboard operation
grails-redis copied to clipboard

Configuring connections for reading and writing in the same cluster

Open raffian opened this issue 11 years ago • 0 comments

The documentation says NOT to use multiple connections for redis instances in the same cluster, but we have a use case where we must write to a master (obviously) in one data center while making sure "reads" go to a different data center, but both instances belong to the same cluster name.

To address this, we set up F5 with virtual host names with rules using webdis "/info" to find the master for writing, and the nearest redis instance for reading. We configure the application using the virtual host names like this:

grails {
   redis {
      port = 6379
      host = 'dataCenter1-RW' 
      poolConfig {
         maxTotal = -1
      }
      connections {
         readOnly {
            poolConfig {
               maxTotal = -1
            }
            port = 6379
            host = 'dataCenter1-RO'
         }
      }
   }
}

Is this a valid configuration? It seems to work fine, although we have not performed serious testing on it.

raffian avatar Oct 03 '14 16:10 raffian