vendredi 11 septembre 2015

Switching between 2 production VMs

At my job we are currently using a simple system to have backup VMs available.

We have 2 VMs, let's call them prod-1 and prod-2. They share the filesystem and home directory. There's a directory, let's call it /flags, and in there are directories for every VM, and there's an empty file called LIVE sitting in one of those directories, indicating which VM is live:

/flags/prod-1/LIVE
/flags/prod-2

The cron is live on both VMs, and we have a script called flagrun.pl that must be used to run all of the cron jobs. It checks to see if there's a file called LIVE in the directory for that VM, and if not it stops, if so it runs the cron job:

* * * * * /flags/flagrun.pl '/path/to/script.sh'

When there's an issue with prod-1, we move the LIVE file to /flags/prod-2, and all following cron jobs are executed on prod-2 instead.

My questions:

  1. Is there a better way to switch between 2 production VMs?
  2. Is there a better way to start running crons on the other VM? Should we write a script that detects when the LIVE file is moved and stop crond on the old VM and start it on the new VM?


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire