Search code examples
linuxserverdaemonredundancy

Redundant daemons across linux multiserver configuration


My problem consists on writing a daemon that will be replicated accross four redundant linux servers. The daemon is rather simple, extract from DB, process, and store a resulting file in the filesystem. Then, send some of these files via email. I´m trying to avoid redundant emails. Which would be the best approach to this? Thanks in advance for the help provided.


Solution

  • You need a logic for orchestrating the sending of those emails.

    IMHO the simplest is a centralized/unique/master control entity. For redundancy you can make any of the daemons play that "master" role, with a master arbitration scheme in place to elect the current master and eventually to allow another daemon to take over if/when the current master fails to do its job for whatever reason.

    If the master has enough bandwidth (and the files to be emailed are in a shared location accessible by all daemons) it may be the only one sending the emails - no duplicates.

    Otherwise the master would just keep track of the "sanity" of the other "worker" daemons and distribute the emailing jobs between the sane ones, each job being handled by a single worker (thus no duplicate emails). The master can also help as a worker, if needed (assigning some of the jobs to itself).