N
N
neonko2016-02-18 13:08:59
Redis
neonko, 2016-02-18 13:08:59

How to arrange selection of "master" node.js server using Redis?

Hello. Task: when running n'th number of servers at the same time, one of them should become a message generator, the rest process them. There can be only one generator. When the generator "falls", any of the handlers replaces it. All communication must take place through Redis.
The first thing that comes to mind: at startup, everyone writes to the SETNX generator <ip> radish . Then, according to the timer, everyone checks the value of the generator key and if it is equal to its ip, the server becomes a generator.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question