Replicating Virtual Domains

Introduction to Domain Replication
----------------------------------------------------

If you use Cloudmin to manage one or more systems running Virtualmin, you can have it replication domains and global Virtualmin settings (like plans and templates) from a source system to multiple destinations. This can be useful for :

* Distributing common settings like plans, styles and custom scripts to multiple Virtualmin systems to avoid having to create them manually.
* Creating a hot-spare system that gets a copy of one or more domains on a regular basis, so that it can serve if the primary system goes goes.
* Replicating websites for load-balancing purposes, so that multiple machines can serve the content for a single website.

Domain replication is most useful when the systems share home directories via NFS and possibly connect to a remote MySQL database, so that dynamic content is always up to date. In this case, Cloudmin should be configured to not replicate home directory and database content.

To limit replication to just some Virtualmin features, open the *Advanced replication settings* section when adding or editing and select them from the *Virtualmin features to replicate* field. For example, you may want to select everything except home directory content and MySQL databases if they are stored on a separate system used by both the source and destinations.

Setting Up Domain Replication
---------------------------------------------

To configure Cloudmin to replicate one or more virtual servers from a source system to one or more destinations, follow these steps :

1. On the left menu, go to *Virtualmin Settings* -> *Virtual Server Replication*.
1. Click on *Add a new replication configuration*.
1. Choose the machine to copy from in the *Source system* menu.
1. Select the machines to copy to in the *Destination systems* field, by using the right-arrow button to move them to the right-hand list.
1. Select the virtual servers to copy from the *Virtualmin domains to replicate*. Only those on the source system can be selected.
1. Assuming you want replication to happen automatically on schedule, change the *Replication enabled?* field to *Yes*.
1. Select a schedule in the *When to replicate* field.
1. Enter an email address to notify about failures in the *Send email on failure to* field.
1. Click the *Create* button.

One replication has been setup, you can change what gets copied and to where by clicking on an entry in the *Virtual Server Replication* list. Replication configurations can also be deleted and started manually on the same page.

Setting Up Global Configuration Replication
-----------------------------------------------------------------

To instead copy global settings like plans between systems running Virtualmin, follow these steps :

1. On the left menu, go to *Virtualmin Settings* -> *Virtual Server Replication*.
1. Click on *Add a new replication configuration*.
1. Choose the machine to copy from in the *Source system* menu.
1. Select the machines to copy to in the *Destination systems* field, by using the right-arrow button to move them to the right-hand list.
1. Open the *Advanced replication settings* section, and check the boxes for the global settings you want copied.
1. Assuming you want replication to happen automatically on schedule, change the *Replication enabled?* field to *Yes*.
1. Select a schedule in the *When to replicate* field.
1. Enter an email address to notify about failures in the *Send email on failure to* field.
1. Click the *Create* button.