更新时间:2023-09-07 GMT+08:00
分享

Minio集群部署

  1. 服务信息如下:
    表1 服务信息4

    服务名

    服务器

    安装目录

    端口

    账号/密码

    Minio

    10.190.x.x

    10.190.x.x

    10.190.x.x

    /app/minio

    9029

    admin/******

  2. 安装minio
    1. 准备安装包

      从官网获取Minio,选arm64版本:https://dl.min.io/server/minio/release/linux-amd64/minio

    2. 创建目录并上传Minio到/app/minio/run
      mkdir -p /app/minio/{run,data,data1,data2}
    3. 配置集群启动文件
      # vim /app/minio/run/run.sh
      #!/bin/bash
      export MINIO_ACCESS_KEY=admin
      export MINIO_SECRET_KEY=Admin123@minio
      /app/minio/run/minio server --config-dir /etc/minio \
      --address :9029 \
      http://192.168.1.1/app/minio/data1 http://192.168.1.1/app/minio/data2 \
      http://192.168.1.2/app/minio/data1 http://192.168.1.2/app/minio/data2 \
      http://192.168.1.3/app/minio/data1 http://192.168.1.3/app/minio/data2 

      Minio默认9000端口,在配置文件中加入–address “127.0.0.1:9029” 可更改端口

      MINIO_ACCESS_KEY:用户名,长度最小是5个字符

      MINIO_SECRET_KEY:密码,密码不能设置过于简单,不然minio会启动失败,长度最小是8个字符

      –config-dir:指定集群配置文件目录

    4. 创建Minio.server
      # vim /usr/lib/systemd/system/minio.service
      [Unit]
      Description=Minio service
      Documentation=https://docs.minio.io/
      [Service]
      WorkingDirectory=/app/minio/run
      ExecStart=/app/minio/run/run.sh
      Restart=on-failure
      RestartSec=5
      [Install]
      WantedBy=multi-user.target
    5. 修改权限
      # chmod +x /usr/lib/systemd/system/minio.service && chmod +x /app/minio/run/minio && chmod +x /app/minio/run/run.sh
    6. 启动集群并查看集群状态
      # systemctl daemon-reload
      # systemctl start minio
      # systemctl enable minio
      # systemctl status minio.service
    7. 使用 nginx 负载均衡

      单独对每个节点进行访问无法保障可靠性,通过使用 nginx 代理,进行负载均衡很有必要。配置如下:

      upstream http_minio {
          server 192.168.222.10:9001 max_fails=3 fail_timeout=5s;
          server 192.168.222.10:9002 max_fails=3 fail_timeout=5s;
          server 192.168.222.10:9003 max_fails=3 fail_timeout=5s;
          }
      server{
          listen       8888;
          server_name  192.168.222.10;
          ignore_invalid_headers off;
          client_max_body_size 0;
          proxy_buffering off;
          location / {
              proxy_set_header   X-Real-IP $remote_addr;
              proxy_set_header   X-Forwarded-Host  $host:$server_port;
              proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header   X-Forwarded-Proto  $http_x_forwarded_proto;
              proxy_set_header   Host $http_host;
              proxy_connect_timeout 300;
              proxy_http_version 1.1;
              chunked_transfer_encoding off;
              proxy_ignore_client_abort on;
              proxy_pass http://http_minio;
          }
      }

相关文档