Upgrade postfix2 to postfix3 - random.pl is compatible?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Upgrade postfix2 to postfix3 - random.pl is compatible?

Emanuel
Hello,

i work in updating my version of postfix, i use the 2.10.1 version, in
Centos 7 arch 64 bits, with an randomize outgoing smtp service, through
a perl script call randomize.pl. Here code example:
http://marinovl.blogspot.com/2012/09/postfix-how-to-balance-outgoing-emails.html?m=1

I remove postfix 2 with the command "yum remove postfix" and install the
new version with:

rpm -Uhv
http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
yum install postfix3 postfix3-mysql postfix-perl-scripts python-dns
--enablerepo=gf-plus

Up to this point is all fine.

Reading the documentation, you can make a random to send the mail
through the parameter: sender_dependent_default_transport_maps

Here is my question, what is the best way to perform a round robin of IP
addresses for sending? Did someone try the random.pl script in version 3
of postfix?

The sender_dependent_default_transport_maps parameter does not support
weights to give a higher or lower priority to an exit mta.

Regards,

--


Reply | Threaded
Open this post in threaded view
|

Re: Upgrade postfix2 to postfix3 - random.pl is compatible?

Wietse Venema
Emanuel:
[ Charset windows-1252 converted... ]

> Hello,
>
> i work in updating my version of postfix, i use the 2.10.1 version, in
> Centos 7 arch 64 bits, with an randomize outgoing smtp service, through
> a perl script call randomize.pl. Here code example:
> http://marinovl.blogspot.com/2012/09/postfix-how-to-balance-outgoing-emails.html?m=1
>
> I remove postfix 2 with the command "yum remove postfix" and install the
> new version with:
>
> rpm -Uhv
> http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
> yum install postfix3 postfix3-mysql postfix-perl-scripts python-dns
> --enablerepo=gf-plus
>
> Up to this point is all fine.
>
> Reading the documentation, you can make a random to send the mail
> through the parameter: sender_dependent_default_transport_maps
>
> Here is my question, what is the best way to perform a round robin of IP
> addresses for sending? Did someone try the random.pl script in version 3
> of postfix?
>
> The sender_dependent_default_transport_maps parameter does not support
> weights to give a higher or lower priority to an exit mta.

To give A more weight than B, specify A multiple times.

"A, A, B" gives A twice the weight as B.

"A, A, A, B, B" gives A 1.5* the weight as B.

BTW You don't need random.pl. Postfix 3 has randmap built-in.

/etc/postfix/main.cf
   foo_maps = randmap:{A,A,A,B,B}

More in http://www.postfix.org/postconf.1.html

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade postfix2 to postfix3 - random.pl is compatible?

Viktor Dukhovni
On Tue, Feb 04, 2020 at 09:45:50AM -0500, Wietse Venema wrote:

> BTW You don't need random.pl. Postfix 3 has randmap built-in.
>
> /etc/postfix/main.cf
>    foo_maps = randmap:{A,A,A,B,B}

Demo:

    $ yes . | head -n 10000 | postmap -q - "randmap:{A,A,A,B,B}" | sort | uniq -c
    5957 .  A
    4043 .  B

The standard deviation for 10000 binomial trials with p=0.6 is ~49, so
this is pretty much the sort of variation from the mean one would
expect.

--
    Viktor.