-
Notifications
You must be signed in to change notification settings - Fork 3
Cloning Migration Guide
Between major MailCleaner releases (OS upgrades) it is necessary to perform a migration to the newer appliance. Your MailCleaner server could also be corrupted my enough manual modifications that it is easier to resolve that issue by spinning up a new machine rather than trying to fix it in place. In the even that either of these things happen, you can use the instructions below to create a new appliance with the same Host ID, network configuration (ie. IP address) and role within the cluster, while preserving all of your configuration and bulk data.
This procedure DOES NOT apply to creating an extra node for the cluster. For that, please follow the Clustering Guide.
In this guide, we will use server01 to refer to the already existing node that you would like to replace and server02 to refer to the new node which will be replacing it.
- First, install server02 and ensure that you have completed the first-run configuration script, using the same hostname, Host ID and other details, except for the networking details.
- Verify that
/root/Updater4MC/updater4mc.sh
has successfully completed all updates by running it again manually or checking the end of the log/var/mailcleaner/log/mailcleaner/updater4mc.log
. - Verify that it is registered with the same credentials as server01 at
Configuration->Base system->Registration
. - If you use any add-ons, also install those before proceeding.
Next, prepare server01 to be taken out of service:
- If server02 is not going to re-use an identical hostname and IP, you will need to modify the MX records accordingly (including possibly redirecting directly to the mail server temporarily if you want zero downtime).
- Also be sure to remove server01 as an outgoing relay if it is currently used as one.
- If you are going to re-use the same hostname and IP for server02, be sure to follow those optional steps below.
/etc/init.d/mailcleaner stop
There are two ways to do this :
Use rsync to copy all of the data over the network from server01:
rsync -av --delete --exclude 'spool/tmp' /var/mailcleaner/* root@server02:/var/mailcleaner/
Also copy the main configuration file:
rsync -av /etc/mailcleaner.conf root@server02:/etc/mailcleaner.conf
(Optional) If you will be re-using the same hostname and IP, then copy the networking configuration:
rsync -av /etc/network/interfaces root@server02:/etc/network/interfaces
Make a tar compressed archive
cd /var && tar -cvzf mailcleaner_data.tgz mailcleaner/
Copy the archive mailcleaner_data.tgz
to server02 by whatever means you have available. If there is no network connection, you may need to use hypervisor tools, such as mounting a new disk to server01, copying the file to that disk, re-mounting on server02 and moving onto it. If server01 is offline, for example, if it is failing to boot, you should be able to mount it's disk to the new machine and perform the copy while connected to server02.
Also copy the main configuration file /etc/mailcleaner.conf
(and optionally, the networking configuration file /etc/network/interfaces
) to server02, overwriting the existing files.
On server02, move the existing mailcleaner data folder :
cd /var && mv mailcleaner mailcleaner_old
then extract the archive :
tar -xvzf /var/tmp/mailcleaner_data.tgz
Delete temporary files on server02
rm -rf /var/mailcleaner/spool/tmp/*
Shutdown, or at least disable networking on server01:
halt
# or
/etc/init.d/networking stop
If you are re-using the same hostname and IP, then you will need to restart the network services on server02 to take over server01's now free IP (assuming you copied the /etc/network/interfaces
file and that it uses a static IP):
/etc/init.d/networking restart
Now start MailCleaner on server02. All the datas (databases, quarantine) from server01 will now be present on server02:
/etc/init.d/mailcleaner start
Ensure that the database has initialized correctly by running a check and repair command. If the server is the master node, run :
/usr/mailcleaner/bin/check_db.pl -m --myrepair
If the server is a slave node, run :
/usr/mailcleaner/bin/check_db.pl -s --myrepair
If it is a member of a cluster, and you have re-used the same hostname and IP, server02 should seamlessly take over the role of server01. If you only have a one-node cluster, you will also not need to do anything, since it is not in a cluster to begin with. Otherwise, if the node is the member of a cluster, you may need to reconfigure the cluster.
If the node is a Master, then you will need to run /usr/mailcleaner/scripts/configuration/slaves.pl
on each of the Slave nodes and use 5) set this host as slave
to configure the new hostname or IP of server02 as the master node.
If the node is a Slave, then you will need to run /usr/mailcleaner/scripts/configuration/slaves.pl
on the Master and use 3) delete slave
, then 4) add slave
to remove server01 from the cluster (by it's ID, check 2) view slaves
first if you don't know it), then re-add server02 with the same ID.
- Installation
- Overview of Admin Interface
- General Administration and Maintenance Issues
- Clustering
- Upgrading
- FAQ
Expand ▶ Pages
above to view the Table of Contents for the article you are already reading, or to browse additional topics. You can also search for keywords in the Wiki.