Cluster Configuration - MailCleaner/MailCleaner8 GitHub Wiki

Installation

Independently install each host. If you are building the whole cluster from scratch, you can clone the VM, but then be sure to follow the extra steps mentioned. If you've been using the first machine for any period of time in production, do not clone it; just start a new machine from scratch.

During the installation process you will be asked to set up the networking, including setting up a hostname and Host ID. Be sure to set each with a hostname or IP which will be resolvable/routable by the other nodes.

If you are cloning a new machine, you will want to do so after finishing the first-run configuration, then leaving the machine for about an hour to finish installing update. Then shut it down, perform the cloning of the VM, then start each of the duplicates one at a time and run /usr/mailcleaner/scripts/installer/installer.pl again. You will need to reconfigure them with unique networking information, hostnames and Host IDs. You can start the initial VM again once the duplicates are done being re-configured. This will prevent their IPs and hostnames from conflicting.

While the nodes have yet to be clustered, this is the best time to register each, since they will attempt to redirect HTTP(S) connections to the master after they are clustered.

Once installed and registered, you will have to get the passwords created for each during the installation process. You can find these in the file /etc/mailcleaner.conf as MYMAILCLEANERPWD.

Add nodes to cluster

On the master:

  • Run the script /usr/mailcleaner/scripts/configuration/slaves.pl once for each slave node:
  • Select option 4) to add a slave and enter the hostname or IP of the new slave node and enter the password that is configured as that slave's MYMAILCLEANERPWD.
  • Back in the main menu, hit “q” to apply changes.

On the slave(s):

  • Run the script /usr/mailcleaner/scripts/configuration/slaves.pl once on each slave node:
  • Select option 5) to set this host as a slave. Enter hostname or IP of the master node and enter the password this is configured as the master's MYMAILCLEANERPWD.
  • Back in the main menu, hit “q” to apply changes.

Utilisation

You can now reach the admin interface of any host. The slave nodes will try to re-direct to the master, but if you rewrite the URL again, it should prevent the redirection the second time. The slave nodes will now have only the options to configure settings local to that machine (eg. DNS, registration, and networking). All filtering and domain settings will only be available on the master.

The user interface will only be available on the master also.

In order to balance your incoming mail on all nodes you can either add one MX record for each node, or set up one MX record with all nodes behind a load-balanced A record.

Removing a node from the cluster

Preparation

You should first ensure that the node is removed from your domain's MX record. You will want to wait for at least your TTL duration to ensure that the node stops receiving mail. If you were to take the machine offline before this, most mail will attempt to send via a different MX host, but some may get unlucky and connect only to the disabled node for the period of their (short) queue time.

Warnings about data

All MailCleaner nodes store their own data locally. Spam and Content quarantine items are located on each nodes.

If you remove the node, you won't be able to easily release these items, because the web interface (on the master node) now no longer queries the removed machine and does not know where to locate it when provide with the Host ID that no longer exists.

A best practice would be to remove the node from MX record and wait until the quarantines have all expired, or for a reasonable period such as a month.

Remove the node from the cluster

To remove a mode from the cluster you have to run /usr/mailcleaner/scripts/configuration/slaves.pl on the master.

If you are uncertain of the Host ID that you would like to remove, select 2) and note the ID

Select 3) and enter the slave ID.

Select q to quit and apply changes to MailCleaner Firewall.

At this point, you can log in to the web admin interface and go to Monitoring->Status to confirm that the node is not in the cluster anymore.