In many cases, there is a need to write data to the master, and read from one of the slave nodes. The rediscala library supports such functionality using class redis.RedisClientMasterSlaves. I implemented support for RedisClientMasterSlaves by specifying the configuration source: master-slaves. Example:
play.cache.redis {
source: master-slaves
# username to your redis hosts (optional)
username: some-username
# password to your redis hosts, use if not specified for a specific node (optional)
password: "my-password"
# number of your redis database, use if not specified for a specific node (optional)
database: 1
# master node
master: {
host: "localhost"
port: 6380
# number of your redis database on master (optional)
database: 1
# username on master host (optional)
username: some-username
# password on master host (optional)
password: something
}
# slave nodes
slaves: [
{
host: "localhost"
port: 6381
# number of your redis database on slave (optional)
database: 1
# username on slave host (optional)
username: some-username
# password on slave host (optional)
password: something
}
]
}
In many cases, there is a need to write data to the master, and read from one of the slave nodes. The rediscala library supports such functionality using class
redis.RedisClientMasterSlaves
. I implemented support forRedisClientMasterSlaves
by specifying the configurationsource: master-slaves
. Example: