3

I create a redis cluster use "redis-trib create" commond, I have a few questions about redis-cluster:

  1. can redis-trib explicitly set which host is master and which host is slave? or any other way to do so;
  2. how to set cluster auth password;
  3. when set maxmemory , how the cluster works? does one master up to the maxmemory limit then store data to another master?
neuront
  • 9,312
  • 5
  • 42
  • 71
aodavid
  • 451
  • 1
  • 4
  • 9

1 Answers1

5
  1. You are supposed to assign the roles one by one; or write a script by yourself, to properly send cluster addslots, cluster meet and cluster replicate commands to the right Redis
  2. Not suggested to do so in the cluster environment, and here are some words from antirez himself
  3. It affects only the one you send config set maxmemory to. It's possible that different nodes in a cluster have different maxmemory, and serve different numbers of slots

===

More details about #1:

First choose your master instances, use redis-trib.rb create without --replicas. Now you have a cluster that contains only masters.

Connect to each of your desired slaves with redis-cli, and send these commands

> cluster meet MASTER_IP MASTER_PORT
# wait several seconds, and use cluster nodes to ensure that it has joined the cluster

> cluster replicate MASTER_NODE_ID
# wait, and use cluster nodes to ensure it has become a slave
neuront
  • 9,312
  • 5
  • 42
  • 71