Minio集群搭建

2024-11-25  本文已影响0人  CoderInsight
# 部分参考连接
## 1,关于ntp服务器的同步
https://www.modb.pro/db/380456

## 2,核心参考文档
### (1),服务端
https://www.cnblogs.com/lvzhenjiang/p/14943939.html
### (2),服务端与客户端
https://learnku.com/articles/57689

## 3,其他参考文档-01
https://www.simaek.com/archives/196/

1,服务部署

(1),run.sh

#!/bin/bash
export MINIO_ACCESS_KEY=Minio
export MINIO_SECRET_KEY=Test1234!

/home/install/minioNew/minio server --config-dir /home/install/minioNew/config \
http://192.168.73.159/data/minio/data \
http://192.168.73.160/data/minio/data > /home/install/minioNew/dev.log

(2),添加到系统管理的服务

  1. 修改配置文件
# 添加到系统管理的服务
vim /usr/lib/systemd/system/minio.service

# 添加如下内容
[Unit]
Description=Minio service
Documentation=https://docs.minio.io/

[Service]
WorkingDirectory=/home/install/minioNew/
ExecStart=/home/install/minioNew/run.sh

Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
  1. 通过系统管理的命令进行操作
# 启动
systemctl start minio

# 关闭
systemctl stop minio

(3),添加Nginx代理

安装Nginx或者Openresty,在Nginx的配置文件夹下添加Nginx配置文件。

vi nginx_minio_cluster.conf

upstream minio_api {
    ip_hash;
    server 192.168.73.159:9090 max_fails=3 fail_timeout=5s;
    server 192.168.73.160:9090 max_fails=3 fail_timeout=5s;
}

upstream minio_console {
    ip_hash;
    server 192.168.73.159:9091 max_fails=3 fail_timeout=5s;
    server 192.168.73.160:9091 max_fails=3 fail_timeout=5s;
}

server {
    listen       9000;
    ignore_invalid_headers off;
    client_max_body_size 0;
    #proxy_buffering off;
    proxy_request_buffering off;


    location / {
        proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
        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;
        # 以下支持websocket的配置
        proxy_http_version  1.1;
        proxy_set_header    Upgrade $http_upgrade;
        proxy_set_header    Connection "upgrade";
        # 以上为支持websocket的配置
        chunked_transfer_encoding off;
        proxy_pass              http://minio_api;
        expires                 0;
    }

    location ~^/files {
        proxy_buffering     off;
        proxy_set_header    Host $http_host;
        rewrite         ^/files/(.*)$ /$1 break;
        proxy_pass      http://minio_api;
    }
    error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

server {
    listen       9001;
    ignore_invalid_headers off;
    client_max_body_size 0;
    proxy_request_buffering off;    

    #charset koi8-r;

#   access_log  /home/log/minio/access.log  main;
#   error_log   /home/log/minio/error.log warn;

    location / {
        proxy_next_upstream     http_500 http_502 http_503 http_504 error timeout invalid_header;
        proxy_set_header        Host  $http_host;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass              http://minio_console;
        expires                 0;

        proxy_http_version  1.1;
        proxy_set_header    Upgrade $http_upgrade;
        proxy_set_header    Connection  "upgrade";
    }

    location ~^/files {
        proxy_buffering     off;
        proxy_set_header    Host $http_host;
        rewrite         ^/files/(.*)$ /$1 break;
        proxy_pass      http://minio_console; 
    }


    error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

上一篇 下一篇

猜你喜欢

热点阅读