-1

More specifically, let us say that I trip on a network cable and split a ReDiS cluster's masters from that cluster's ReDiS slaves. If the number of masters doubles, can I just make my client only write to the "first" masters from before the split?

For example, if I have a cluster with the following properties, and I trip on the network cable between subnet 192.168.53.* and 192.168.105.* do I wind up with 6 masters?

ReDiS 1 on 192.168.53.1:7000 (master)
ReDiS 2 on 192.168.53.1:7001 (master)
ReDiS 3 on 192.168.53.1:7002 (master)
ReDiS 4 on 192.168.105.2:7000 (slave)
ReDiS 5 on 192.168.105.2:7001 (slave)
ReDiS 6 on 192.168.105.2:7002 (slave)

I'm guessing that ReDiS 4, ReDiS 5, and ReDiS 6 would quickly make themselves masters, and that I'd end up with the following:

ReDiS 1 on 192.168.53.1:7000 (master)
ReDiS 2 on 192.168.53.1:7001 (master)
ReDiS 3 on 192.168.53.1:7002 (master)
=======//Snapped Cable//========
ReDiS 4 on 192.168.105.2:7000 (master)
ReDiS 5 on 192.168.105.2:7001 (master)
ReDiS 6 on 192.168.105.2:7002 (master)

Also, when I replace the snapped cable, I'd end up with the following again, right?

ReDiS 1 on 192.168.53.1:7000 (master)
ReDiS 2 on 192.168.53.1:7001 (master)
ReDiS 3 on 192.168.53.1:7002 (master)
ReDiS 4 on 192.168.105.2:7000 (slave)
ReDiS 5 on 192.168.105.2:7001 (slave)
ReDiS 6 on 192.168.105.2:7002 (slave)

Is it wise if I write my clients to be aware of what the masters "should" be, and have them only write to the masters in 192.168.53.*?

An example for mitigating problems from this scenario, could I make the following variable only update when one of the ReDiS represented by members of firstThreeMasters becomes a slave?

    firstThreeMasters = [ "192.168.53.1:7000", "192.168.53.1:7001", "192.168.53.1:7002" ]

(Although my client code's behavior is the subject of this question, do you think this belongs in serverfault.com? Please advise in comments or recommend to move it, if so.)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Nathan Basanese
  • 8,475
  • 10
  • 37
  • 66

1 Answers1

1

"I'm guessing that ReDiS 4, ReDiS 5, and ReDiS 6 would quickly make themselves masters"

Actually no, the slaves won't failover when at least half of the masters are disconnected. In fact only masters with slots assigned would participate in election process when slaves ask a automatic failover.

And do not try to presume which nodes are arbitrary masters in your client because the client shouldn't be involved in the cluster affairs. If you definitely want a set of nodes to be the masters constantly, you'd better write a daemon who watches them and send a cluster failover command to the node who becomes a slave.

neuront
  • 9,312
  • 5
  • 42
  • 71
  • // , Half of the masters would not disconnect, it would be _all_ of the masters that would disconnect. Was this supposed to read, "... when half of the ReDiS are disconnected."? – Nathan Basanese Jun 17 '16 at 07:02
  • @NathanBasanese A slave failovers and becomes a master because other masters have elected it. If **at least** half of the masters were disconnected (I should add "at least") the election wouldn't come to a result so that no slaves would automatically become masters. – neuront Jun 17 '16 at 07:42