Tushar
Tushar

Reputation: 1155

How to setup max memory for a redis5.0.5 cluster

I have a redis cluster with 4 servers with 24 GB memory each. Each server has a master and a slave instance running.

Cluster topology: (A-->B means A is slave of B)

server2 slave-->server1 master
server3 slave-->server2 master
server4 slave-->server3 master
server1 slave-->server4 master

These servers are for redis alone, so I can allot upto 22 GB memory for redis.

But I am not sure how to setup maxmemory for these instances. Do I need to set it at 11 GB on master and slave each, on each server? Or I need to set it to 22 GB for both servers?

Also, what would be the overall memory available for data on redis, 22*4 = 88GB, or 22 GB only?

Upvotes: 0

Views: 1018

Answers (2)

louis770
louis770

Reputation: 3

redis-cli -h <host_name> -p <port> -a <password> config get maxmemory
redis-cli -h <host_name> -p <port> -a <password> config set maxmemory <Bytes>
redis-cli -h <host_name> -p <port> -a <password> config get maxmemory

# cat your redis.conf to see max memory
cat redis.conf
# you will find redis.conf has old maxmemory
# so you can rewrite redis.conf
redis-cli -h <host_name> -p <port> -a <password> config rewrite

Upvotes: 0

for_stack
for_stack

Reputation: 22886

Since your master and slave are located on the same server, you should set maxmemory to 11GB for each master and slave. Also, the overall memory available for the cluster is 11 * 4 = 44G.

Upvotes: 1

Related Questions