jaikuai 1 year ago
parent
commit
0255ec2344
2 changed files with 44 additions and 0 deletions
  1. 3 0
      Dockerfile
  2. 41 0
      haproxy.cfg

+ 3 - 0
Dockerfile

@@ -0,0 +1,3 @@
+FROM haproxy
+
+ADD haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

+ 41 - 0
haproxy.cfg

@@ -0,0 +1,41 @@
+global
+    log 127.0.0.1 local0 info
+    maxconn 4096
+
+defaults
+    option  dontlognull        # Do not log connections with no requests
+    option  contstats          # Enable continuous traffic statistics updates
+    retries 3                  # Try to connect up to 3 times in case of failure
+    timeout connect 5s         # 5 seconds max to connect or to stay in queue
+    timeout http-keep-alive 1s # 1 second max for the client to post next request
+    timeout http-request 15s   # 15 seconds max for the client to send a request
+    timeout queue 30s          # 30 seconds max queued on load balancer
+    timeout client 30s  # 客户端超时时间设置为30秒,你可以根据需要调整这个值
+    timeout connect 10s # 连接超时时间设置为10秒,你也可以根据需要调整
+    timeout server 30s  # 服务端超时时间设置为30秒,根据需要调整
+    backlog 10000              # Size of SYN backlog queue
+
+frontend ftp_fe
+    bind 0.0.0.0:20-21 name ftp-control
+    bind 0.0.0.0:21100-21110 name ftp-data
+    mode tcp
+    option tcplog
+    log global
+    default_backend ftp_be21
+
+backend ftp_be21
+    balance leastconn
+    stick on src
+    stick-table type ip size 100k expire 1h
+    server ftp-server1 47.98.251.134 check port 21
+
+listen nvr
+    bind *:200
+    mode http
+    server s1 192.168.3.200:80 check
+
+
+listen car_plate
+    bind *:98
+    mode http
+    server s98 192.168.3.98:80 check