Hi,
I configured haproxy 2.1 with postfix using the sample socket configuration found in example folder, socks4.cfg.
I managed to send mail. but it takes around 30 sec average to get a success response.
I observed that I get response near to same time when I get email. Is it working in a synchronous way. But If I call direct to one of the SMTP then it give me immediate response.
So how can I configure it in a asyn way to get immediate response
Thanks
Masuqur
Configuration file
global
log /var/log/haproxy local0
log /var/log/haproxy local1 notice
chroot /var/lib/haproxy
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
listen smtp_back
bind :2525
mode tcp
option tcplog
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
option smtpchk
no option http-server-close
balance roundrobin
server SMTPS43 10...:25 send-proxy check
server SMTPS53 10...*:25 send-proxy check
frontend http_front
bind *:8081
stats uri /haproxy?stats
default_backend http_back
backend http_back
balance roundrobin
server local 10...*:8081 check
There is no such thing as sync or async mode in haproxy.
You have some other problem, so check haproxy, postfix logs and you may need to analyze the traffic itself (tcpdump, wireshark).
I getting continuous following log. Can you help me as I already shared the configuration file
Apr 16 13:37:09 localhost haproxy[2740]: 10.5.0.52:32914 [16/Apr/2020:13:36:19.354] http_front http_back/local 0/0/0/50001/50001 504 203 - - CD-- 493/493/489/489/0 0/0 “GET /favicon.ico HTTP/1.1”
Apr 16 13:37:09 localhost haproxy[2740]: 10.5.0.52:32916 [16/Apr/2020:13:36:19.355] http_front http_back/local 0/0/0/-1/50000 504 218 - - sH-- 492/492/491/490/0 0/0 “GET /favicon.ico HTTP/1.1”
Apr 16 13:37:09 localhost haproxy[2740]: 10.5.0.52:32924 [16/Apr/2020:13:36:19.362] http_front http_back/local 0/0/0/-1/50001 504 218 - - sH-- 493/493/492/492/0 0/0 “GET /favicon.ico HTTP/1.1”
Apr 16 13:37:11 localhost haproxy[2740]: 10.5.0.52:32926 [16/Apr/2020:13:36:21.987] http_front http_back/local 0/0/0/-1/50001 504 218 - - sH-- 493/493/492/492/0 0/0 “GET /favicon.ico HTTP/1.1”
That your http front and backend. Can you tell me what that configuration is supposed to achieve because it doesn’t make any sense to me.
What is port 8081 supposed to do, exactly?
Actually I don’t need to the http_back. The Postfix load balance works with “listen smtp_back”. But I can’t keep blank the http_back, haproxy gives error. So I put the HaProxy monitoring url in that area.
Ok, then remove the backend entirely, along with the default_backend
directive in the frontend.
The error log is about a browser trying to download a favicon, which is not necessary.
Also, by pointing the backend to the frontend, you are creating an infinite loop there, which is very bad.
Then you need to fix loggin of your tcp traffic, which clearly does not work at all.
Put “mode http” in your frontend http_front
, remove the tcplog option and instead fix logging in your defaults section, by removing option dontlognull
, and replacing mode http
with mode tcp
and option httplog
with option tcplog
.
Thanks. It is working now. Now I am getting following Log. Is that right log:
Apr 19 11:34:03 localhost haproxy[54612]: 10.5.16.107:59881 [19/Apr/2020:11:33:13.441] smtp_back smtp_back/SMTPS43 1/0/50209 284 cD 2/2/1/0/0 0/0
Apr 19 11:34:36 localhost haproxy[54612]: 10.10.10.84:52140 [19/Apr/2020:11:34:36.442] http_front http_front/ 0/0/0 15321 LR 4/3/0/0/0 0/0
Apr 19 11:34:37 localhost haproxy[54612]: 10.10.10.84:52140 [19/Apr/2020:11:34:36.443] http_front http_front/ -1/-1/686 237 SC 4/3/0/0/0 0/0
Apr 19 11:34:51 localhost haproxy[54612]: 10.5.16.107:59914 [19/Apr/2020:11:34:01.832] smtp_back smtp_back/SMTPS53 1/0/50075 284 cD 3/1/0/0/0 0/0
Apr 19 11:35:06 localhost haproxy[54612]: 10.10.10.84:52142 [19/Apr/2020:11:34:36.443] http_front http_front/ -1/-1/30155 211 CR 2/2/0/0/0 0/0
Apr 19 11:35:06 localhost haproxy[54612]: 10.10.10.84:52138 [19/Apr/2020:11:34:36.443] http_front http_front/ -1/-1/30155 211 CR 2/2/0/0/0 0/0