{"id":3129,"date":"2018-05-04T13:30:18","date_gmt":"2018-05-04T18:30:18","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=3129"},"modified":"2018-05-04T13:30:18","modified_gmt":"2018-05-04T18:30:18","slug":"load-balance-and-failover-sendmail-mailertable-relays","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=3129","title":{"rendered":"Load Balance and Failover Sendmail Mailertable Relays"},"content":{"rendered":"<p>A coworker asked me today how to get the mailertable relays to load balance instead of fail over. Trick is to think beyond sendmail. The square brackets around hosts tell sendmail\u00a0<em>not<\/em> to check for an MX record (you&#8217;re generally using an A record, so this saves a tiny little bit of time &#8230; not to mention *if* there <em>is<\/em> an MX record there, it creates a whole heap-o confusion). *But* the MX lookup is right useful when setting up load balanced or failover relay targets.<\/p>\n<p>Single host relay in the mailertable looks like this:<br \/>\nyourdomain.gTLD\u00a0 \u00a0 \u00a0 relay:[somehost.mydomain.gTLD]<\/p>\n<p>If you want to fail over between relays (that is try #1, if it is unavailable try #2, and so on), you\u00a0<em>can<\/em> stay within the mailertable and use:<br \/>\nyourdomain.gTLD\u00a0 \u00a0 \u00a0 relay:[somehost.mydomain.gTLD]:[someotherhost.mydomain.gTLD]<\/p>\n<p>Or even try direct delivery and fail back to a smart host:<br \/>\nyourdomain.gTLD\u00a0 \u00a0 \u00a0 relay:%1:smart-host<\/p>\n<p>But none of this evenly distributes traffic across multiple servers. The trick to load balancing within the mailertable is to create equal weight MX records in your domain to be used as the relay.<\/p>\n<p>In ISC Bind, this looks like:<br \/>\nyourdomainmailrouting.mydomain.gTLD\u00a0 \u00a0 \u00a0IN MX 10 somehost.mydomain.gTLD.<br \/>\nyourdomainmailrouting.mydomain.gTLD\u00a0 \u00a0 \u00a0IN MX 10 somehost.mydomain.gTLD.<\/p>\n<p>Once you have created the DNS records, simply use the MX record hostname in your mailertable:<\/p>\n<p>yourdomain.gTLD\u00a0 \u00a0 \u00a0 relay:yourdomainmailrouting.mydomain.gTLD<\/p>\n<p>By leaving out the square brackets, sendmail will resolve an MX record for &#8216;yourdomainmailrouting.mydomian.gTLD&#8217;, find the equal weight MX records, and do the normal sendmail thing to use both.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A coworker asked me today how to get the mailertable relays to load balance instead of fail over. Trick is to think beyond sendmail. The square brackets around hosts tell sendmail\u00a0not to check for an MX record (you&#8217;re generally using an A record, so this saves a tiny little bit of time &#8230; not to &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[583,259],"class_list":["post-3129","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-mailerable","tag-sendmail"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3129"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3129\/revisions"}],"predecessor-version":[{"id":3130,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/3129\/revisions\/3130"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}