10 pmgcm - Proxmox Mail Gateway Cluster Management Toolkit
16 include::pmgcm.1-synopsis.adoc[]
28 We are living in a world where email becomes more and more important -
29 failures in email systems are just not acceptable. To meet these
30 requirements we developed the Proxmox HA (High Availability) Cluster.
32 The {pmg} HA Cluster consists of a master and several slave nodes
33 (minimum one node). Configuration is done on the master. Configuration
34 and data is synchronized to all cluster nodes over a VPN tunnel. This
35 provides the following advantages:
37 * centralized configuration management
39 * fully redundant data storage
45 We use a unique application level clustering scheme, which provides
46 extremely good performance. Special considerations where taken to make
47 management as easy as possible. Complete Cluster setup is done within
48 minutes, and nodes automatically reintegrate after temporary failures
49 without any operator interaction.
51 image::images/Proxmox_HA_cluster_final_1024.png[]
57 There are no special hardware requirements, although it is highly
58 recommended to use fast and reliable server with redundant disks on
59 all cluster nodes (Hardware RAID with BBU and write cache enabled).
61 The HA Cluster can also run in virtualized environments.
67 Each host in a cluster has its own subscription. If you want support
68 for a cluster, each cluster node needs to have a valid
69 subscription. All nodes must have the same subscription level.
75 It is usually advisable to distribute mail traffic among all cluster
76 nodes. Please note that this is not always required, because it is
77 also reasonable to use only one node to handle SMTP traffic. The
78 second node is used as quarantine host, and only provides the web
79 interface to the user quarantine.
81 The normal mail delivery process looks up DNS Mail Exchange (`MX`)
82 records to determine the destination host. A `MX` record tells the
83 sending system where to deliver mail for a certain domain. It is also
84 possible to have several `MX` records for a single domain, they can have
85 different priorities. For example, our `MX` record looks like that:
88 # dig -t mx proxmox.com
91 proxmox.com. 22879 IN MX 10 mail.proxmox.com.
93 ;; ADDITIONAL SECTION:
94 mail.proxmox.com. 22879 IN A 213.129.239.114
97 Please notice that there is one single `MX` record for the Domain
98 `proxmox.com`, pointing to `mail.proxmox.com`. The `dig` command
99 automatically puts out the corresponding address record if it
100 exists. In our case it points to `213.129.239.114`. The priority of
101 our `MX` record is set to 10 (preferred default value).
104 Hot standby with backup `MX` records
105 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107 Many people do not want to install two redundant mail proxies, instead
108 they use the mail proxy of their ISP as fallback. This is simply done
109 by adding an additional `MX` Record with a lower priority (higher
110 number). With the example above this looks like that:
113 proxmox.com. 22879 IN MX 100 mail.provider.tld.
116 In such a setup, your provider must accept mails for your domain and
117 forward them to you. Please note that this is not advisable, because
118 spam detection needs to be done by the backup `MX` server as well, and
119 external servers provided by ISPs usually don't.
121 However, you will never lose mails with such a setup, because the sending Mail
122 Transport Agent (MTA) will simply deliver the mail to the backup
123 server (mail.provider.tld) if the primary server (mail.proxmox.com) is
126 NOTE: Any reasonable mail server retries mail delivery if the target
127 server is not available, i.e. {pmg} stores mail and retries delivery
128 for up to one week. So you will not lose mail if your mail server is
129 down, even if you run a single server setup.
132 Load balancing with `MX` records
133 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
135 Using your ISPs mail server is not always a good idea, because many
136 ISPs do not use advanced spam prevention techniques, or do not filter
137 SPAM at all. It is often better to run a second server yourself to
138 avoid lower spam detection rates.
140 Anyways, it’s quite simple to set up a high performance load balanced
141 mail cluster using `MX` records. You just need to define two `MX` records
142 with the same priority. Here is a complete example to make it clearer.
144 First, you need to have at least 2 working {pmg} servers
145 (mail1.example.com and mail2.example.com) configured as cluster (see
146 section xref:pmg_cluster_administration[Cluster administration]
147 below), each having its own IP address. Let us assume the following
148 addresses (DNS address records):
151 mail1.example.com. 22879 IN A 1.2.3.4
152 mail2.example.com. 22879 IN A 1.2.3.5
155 It is always a good idea to add reverse lookup entries (PTR
156 records) for those hosts. Many email systems nowadays reject mails
157 from hosts without valid PTR records. Then you need to define your `MX`
161 example.com. 22879 IN MX 10 mail1.example.com.
162 example.com. 22879 IN MX 10 mail2.example.com.
165 This is all you need. You will receive mails on both hosts, more or
166 less load-balanced using round-robin scheduling. If one host fails the
173 Multiple address records
174 ^^^^^^^^^^^^^^^^^^^^^^^^
176 Using several DNS `MX` records is sometimes clumsy if you have many
177 domains. It is also possible to use one `MX` record per domain, but
178 multiple address records:
181 example.com. 22879 IN MX 10 mail.example.com.
182 mail.example.com. 22879 IN A 1.2.3.4
183 mail.example.com. 22879 IN A 1.2.3.5
187 Using firewall features
188 ^^^^^^^^^^^^^^^^^^^^^^^
190 Many firewalls can do some kind of RR-Scheduling (round-robin) when
191 using DNAT. See your firewall manual for more details.
194 [[pmg_cluster_administration]]
195 Cluster administration
196 ----------------------
198 Cluster administration can be done on the GUI or using the command
199 line utility `pmgcm`. The CLI tool is a bit more verbose, so we suggest
200 to use that if you run into problems.
202 NOTE: Always setup the IP configuration before adding a node to the
203 cluster. IP address, network mask, gateway address and hostname can’t
209 image::images/screenshot/pmg-gui-cluster-panel.png[]
211 You can create a cluster from any existing {pmg} host. All data is
214 * make sure you have the right IP configuration
215 (IP/MASK/GATEWAY/HOSTNAME), because you cannot change that later
217 * press the create button on the GUI, or run the cluster creation command:
223 NOTE: The node where you run the cluster create command will be the
230 The GUI shows the status of all cluster nodes, and it is also possible
231 to use the command line tool:
235 --NAME(CID)--------------IPADDRESS----ROLE-STATE---------UPTIME---LOAD----MEM---DISK
236 pmg5(1) 192.168.2.127 master A 1 day 21:18 0.30 80% 41%
244 image::images/screenshot/pmg-gui-cluster-join.png[]
246 When you add a new node to a cluster (using `join`) all data on that node is
247 destroyed. The whole database is initialized with cluster data from
250 * make sure you have the right IP configuration
252 * run the cluster join command (on the new node):
255 pmgcm join <master_ip>
258 You need to enter the root password of the master host when asked for
259 a password. When joining a cluster using the GUI, you also need to
260 enter the 'fingerprint' of the master node. You get that information
261 by pressing the `Add` button on the master node.
263 CAUTION: Node initialization deletes all existing databases, stops and
264 then restarts all services accessing the database. So do not add nodes
265 which are already active and receive mails.
267 Also, joining a cluster can take several minutes, because the new node
268 needs to synchronize all data from the master (although this is done
271 NOTE: If you join a new node, existing quarantined items from the other nodes are not synchronized to the new node.
277 Please detach nodes from the cluster network before removing them
278 from the cluster configuration. Then run the following command on
285 Parameter `<cid>` is the unique cluster node ID, as listed with `pmgcm status`.
291 It is highly recommended to use redundant disks on all cluster nodes
292 (RAID). So in almost any circumstances you just need to replace the
293 damaged hardware or disk. {pmg} uses an asynchronous
294 clustering algorithm, so you just need to reboot the repaired node,
295 and everything will work again transparently.
297 The following scenarios only apply when you really lose the contents
304 * delete failed node on master
310 * add (re-join) a new node
313 pmgcm join <master_ip>
320 * force another node to be master
326 * tell other nodes that master has changed
329 pmgcm sync --master_ip <master_ip>
333 Total Cluster Failure
334 ^^^^^^^^^^^^^^^^^^^^^
336 * restore backup (Cluster and node information is not restored, you
337 have to recreate master and nodes)
339 * tell it to become master
347 * add those new nodes to the cluster
350 pmgcm join <master_ip>
355 include::pmg-copyright.adoc[]