At the start of the server, I need to clean out my Redis memory. But every time a new cluster forms, it calls flushall and cleans out everything in memory. How do I run flushall only once from the very beginning first server?
Master
//run when the first server starts
If(first server){
redis.flushall();
}
//run code
Other separate clusters (running on different port/script)
//run when the first server starts
If(first server){//should be false now
redis.flushall();
}
//run code
Overview
Server 1 -- call flushall once (clean Redis memory)
Server 2 -- dont call flushall
Server 3 -- dont call flushall
...
Server n -- dont call flushall
Is there any way of doing this sort?
By the way, I'm using AWS hosting, which automatically duplicates and scales my server