Cloning the same MailCleaner

Julien Groselle
Added about 9 years ago

This procedure DO NOT apply to create a extra node for the cluster.

For emergency recovery, you can clone a MailCleaner. It will give you the same MailCleaner node which can only replace the existing MailCleaner.
This documentation will help you to migrate all your data from one MailCleaner server to another.
To be clear the server we want to replace will be named server01 and the new one, server02

  • First you have to stop using the node you want to clone. Update your MX record in consequence
    • also remove it from outgoing SMTP if used.
  • You have to install a new server with the same ID that the one you want to replace
    • If you have some modules installed (Cyren, messagesniffer, etc.) contact the support to install it on your new MailCleaner.
  • Register it on Configuration -> Base system -> Registration

  • Stop MailCleaner on server01 and server02

/etc/init.d/mailcleaner stop
  • Backup your datas
    There are two ways to backup your datas :

    • make a tar compressed archive
    cd /var && tar -cvzf mailcleaner_data.tgz mailcleaner/
    
    • sync the datas between the two servers (old and new) trought the network
    rsync -av --delete --exclude 'spool/tmp' /var/mailcleaner/* root@server02:/var/mailcleaner/
    

    If you have chosen the tar archive, you have to send this archive to server02 :

    scp mailcleaner_data.tgz root@server02:/var/tmp
    
    • On server02, move the mailcleaner folder :
    cd /var && mv mailcleaner mailcleaner_ori
    
    • On server 02, restore the backup you have done before :
    cd /var &&  tar -xvzf /var/tmp/mailcleaner_data.tgz
    

Clean up on server02

  • Delete useless files
rm -rf /var/mailcleaner/spool/tmp/*
  • Copy the MailCleaner configuration file : /etc/mailcleaner.conf
  • Copy your network configuration : /etc/network/interfaces
  • Stop network services on server01
halt
# or
/etc/init.d/networking stop
  • Restart the network on server02
/etc/init.d/networking restart
  • Now restart MailCleaner on server02. All the datas (databases, quarantine) have to be present. Beware of IP address and network configuration.
/etc/init.d/mailcleaner start
  • Execute a database repairing script

If the server you want to clone is the master :

/usr/mailcleaner/bin/check_db.pl -m --myrepair

If the server you want to clone is a slave :

/usr/mailcleaner/bin/check_db.pl -s --myrepair