一、安装minio单机

version: "3"

services:
  minio:
#    image: minio/minio:RELEASE.2021-06-17T00-10-46Z
#    image: minio/minio:RELEASE.:RELEASE.2024-09-22T00-33-43Z
    image: minio/minio:RELEASE.:RELEASE.2024-09-22T00-33-43Z
    volumes:
      - "/home/paas/minio/data:/data"
      - "/home/paas/minio/config:/root/.minio"
    environment:
      - MINIO_ACCESS_KEY=admin
      - MINIO_SECRET_KEY=admin123456
    ports:
      - "9000:9000"
      - "9001:9001"
    command: server /data --console-address ":9001"
    restart: always

二、安装minio集群

ip用途
192.168.180.45minio、nginx
192.168.180.46minio
192.168.180.47minio
192.168.180.48minio

1、192.168.180.45配置

[root@app01 minio_docker-compose]# vim docker-compose.yaml

version: '3'
services:
  minio1:
    image: minio/minio:RELEASE.:RELEASE.2024-09-22T00-33-43Z
    container_name: minio1
    network_mode: host
    ports:
      - "9000:9000"
      - "9001:9001"
    environment:
      MINIO_ROOT_USER: admin
      MINIO_ROOT_PASSWORD: admin123456
    volumes:
      - "./data:/data"
    command: server --address ":9000" --console-address ":9001" http://192.168.180.45/data http://192.168.180.46/data http://192.168.180.47/data http://192.168.180.48/data
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 20s
      retries: 3
    restart: always

  minio-gateway:
    image: nginx:1.19-alpine
    volumes:
      - ./config/nginx.conf:/etc/nginx/nginx.conf
    ports:
      - "29000:29000"
      - "29001:29001"
[root@app01 minio_docker-compose]# vim config/nginx.conf 

user  nginx;
worker_processes  auto;
 
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
 
events {
    worker_connections  1024;
}
 
 
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
 
    sendfile        on;
    keepalive_timeout  65;
 
    upstream minio {
        server 192.168.180.45:9000;
        server 192.168.180.46:9000;
        server 192.168.180.47:9000;
        server 192.168.180.48:9000;
    }
 
    upstream minio-console {
        ip_hash;
        server 192.168.180.45:9001;
        server 192.168.180.46:9001;
        server 192.168.180.47:9001;
        server 192.168.180.48:9001;
    }
 
    server {
        listen       29000;
        listen  [::]:29000;
        server_name  localhost;
 
        ignore_invalid_headers off;
        client_max_body_size 0;
        client_body_buffer_size 0;
        proxy_buffering off;
 
        location / {
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
 
            proxy_connect_timeout 300;
            # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            chunked_transfer_encoding off;
 
            proxy_pass http://minio;
        }
    }
 
    server {
        listen       29001;
        listen  [::]:29001;
        server_name  localhost;
        ignore_invalid_headers off;
        client_max_body_size 0;
        proxy_buffering off;
        proxy_request_buffering off;
 
        location / {
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-NginX-Proxy true;
            real_ip_header X-Real-IP;
            proxy_connect_timeout 300;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            chunked_transfer_encoding off;
            proxy_pass http://minio-console;
        }
    }
}

2、其他服务器配置

[root@test1 minio_docker-compose]# vim docker-compose.yaml 
version: '3'
services:
  minio1:
    image: minio/minio:RELEASE.:RELEASE.2024-09-22T00-33-43Z
    container_name: minio1
    network_mode: host
    ports:
      - "9000:9000"
      - "9001:9001"
    environment:
      MINIO_ROOT_USER: admin
      MINIO_ROOT_PASSWORD: admin123456
    volumes:
      - "./data:/data"
    command: server --address ":9000" --console-address ":9001" http://192.168.180.45/data http://192.168.180.46/data http://192.168.180.47/data http://192.168.180.48/data
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 20s
      retries: 3
    restart: always

3、访问地址

http://192.168.180.45:29001/

4、启用压缩

mc alias set nginxminio http://192.168.180.45:29000 admin admin123456
mc admin config get nginxminio compression
mc admin config set nginxminio compression enable="on"
mc admin config set nginxminio compression enable=off
mc admin service restart nginxminio

5、压缩结果

940M的csv文件,未压缩前,磁盘占用 471*4=1884M,启用压缩 62 *4=248M

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐