For any given database, NuoDB recommend running two or more SMs to ensure high-availability and redundancy. Additional SMs do not typically make the database faster to read or write data. (Additional TEs on the other hand can provide increased performance by allowing more queries to be run concurrently).
When running multiple SMs, by default each archive contains a complete copy of the database. Each SM is thus a backup for the other SMs.
|Multiple SMs act as backups for each other. Consider this when thinking about scheduling actual backups.|
Multiple SMs also allow for Archive Synchronization.
An SM needs to be taken down for maintenance, is scaled-in because it is no longer needed or was restarted due to a failure.
When the SM is up and running again, it goes into SYNC mode (you can see this in the output of
nuocmd show domain or
nuocmd show database).
In SYNC mode, the SM requests a copy of all data that has changed since the last transaction it committed to its archive (just before going down).
Once the archive is up-to-date again, it switches to RUNNING mode and recommences managing data in the usual way.
Even if the entire archive has been lost (perhaps due to disk failure), it can be restarted with an empty archive and it can use synchronization to import the entire database from the other SMs. In this way, the loss of an SM causes no database downtime or loss of data.
To create a new database from a backup, initialize the first archive from the backup and create the database (it will run a single SM). Once up and running, you can start additional SMs which will use Archive Synchronization to populate their empty archives.
All the archives belonging to all the SMs have failed. This is a highly unlikely scenario. However, you can restore the database from a backup in the same way as creating the clone database. Delete any remaining archive directories, then restore one archive and restart the database. Once the SM is up and running, start additional SMs as desired. They will SYNC from the first SM.