天天看点

使用haproxy 代理minio

主要是测试下基于haproxy 代理minio ,比较简单

环境准备

  • docker-compose 文件
version: '3'
services:
  minio:
    image: minio/minio
    ports:
      - "9000:9000"
      - "19001:19001"
    environment:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
    command: server --console-address :19001 --quiet /data
  haproxy:
    image: haproxytech/haproxy-debian:2.6.6
    ports:
      - 5000:5000
      - 9001:9001
    volumes:
      - "./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg"
haproxy.cfg
global
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
 
resolvers mydns
    nameserver dns1 127.0.0.11:53
    resolve_retries       3
    timeout retry         1s
    hold other           30s
    hold refused         30s
    hold nx              30s
    hold timeout         30s
    hold valid           10s
 
listen stats
  bind *:9001
  mode http
  stats enable
  stats uri /m
 
frontend  main
    bind *:5000
    option forwardfor
    http-request add-header X-Forwarded-Host %[req.hdr(host)]
    http-request add-header X-Forwarded-Server %[req.hdr(host)]
    http-request add-header X-Forwarded-Port %[dst_port]
    default_backend   app
 
backend app
    server  s31 minio:9000       
  • 效果

使用mc 工具

  • 配置mc
mc  config host add locals3appv2  http://127.0.0.1:5000 minio minio123      
  • 上传文件&生成下载地址
mc  share download  locals3appv2/demoapp/soapui-settings.xml      
使用haproxy 代理minio

说明

参考资料