Postfix smtp outgoing load balancing

I got good workaround for balancing smtp outgoing from postfix mailing list archives(not using expensive real load balancer). suppose we have 4 smtp servers for outgoing email, and we need to configure/load balance like this:
                                                             +------------+
| |
+----------> smtp backend a -------->| |
| | |
clients --------> smtp lb -----> smtp backend b -------->| Intenet |
| | |
+----------> smtp backend c -------->| |
| |
+------------+


Here’s the configuration :

Postfix section


main.cf (smtp lb/load balancer)
/etc/postfix/main.cf:
relayhost = example.com

Here’s the configuration :

Dns sections.


named.conf
/etc/named.conf:

options {
directory "/var/named/data";
};

zone "example.com" in {
type master;
file "example.com";
};

example.com zone file

/var/named/data/example.com
$TTL 2D;

@ IN SOA a.ns.example.com hostmaster.example.com (
1 ; Serial
10800 ; Refresh after 3 hours
3600 ; Retry after 1 hour
604800 ; Expire after 1 week
3600 ) ; Minimum TTL of 1 hour
@ IN NS a.ns
@ IN NS b.ns
a.ns IN A 192.0.2.1
b.ns IN A 192.0.2.2

@ IN MX 0 a.mx
@ IN MX 0 b.mx
@ IN MX 0 c.mx

a.mx IN A 192.0.2.3
b.mx IN A 192.0.2.4
c.mx IN A 192.0.2.5

By default relayhost(in main.cf) will listing all available mx on example.com and randomly shuffles mx with equal preference(Postfix client makes a random selection between equal-preference MX hosts), in this case these mx are our smtp backend for balancing outgoing mail.





 

Source : postfix manual (relayhost)

Kaynak site: https://www.kutukupret.com/2009/10/03/postfix-smtp-outgoing-load-balancing/
caylakpenguen
caylakpenguen

Truva Linux takımıyla 2006'da tanışan "Çaylak Penguen" -BASH- betiklerine bayılır. Truva'nıñ çekirdek derleme işleri ile çalışan cd tasarımıyla uğraşmaktadır.

Hiç yorum yok:

Yorum Gönderme