Windows电脑为例,设置minio文件服务分布式部署

发布时间 2023-06-24 15:38:17作者: xiondun

下面以Windows电脑为例,设置minio文件服务分布式部署。

1.安装Minio

比较简单,自行百度查询。

2.运行分布式Minio

启动分布式Minio实例,需要把硬盘位置做为参数传给minio server命令,注意:

分布式Minio使用的磁盘里必须是干净的,里面没有数据。

示例: 启动分布式Minio实例,4个节点,需要在4个节点上都运行下面的命令。

多机集群部署

​minio server http://192.168.10.11/D:/minio http://192.168.10.12/D:/minio http://192.168.10.13/D:/minio http://192.168.10.14/D:/minio

如果需要在单机上进行集群部署,改下端口号和路径即可

minio server --address :9001 http://127.0.0.1/D:/minio1 http://127.0.0.1/D:/minio2 http://127.0.0.1/D:/minio3 http://127.0.0.1/D:/minio4 minio server --address :9002 http://127.0.0.1/D:/minio1 http://127.0.0.1/D:/minio2 http://127.0.0.1/D:/minio3 http://127.0.0.1/D:/minio4 minio server --address :9003 http://127.0.0.1/D:/minio1 http://127.0.0.1/D:/minio2 http://127.0.0.1/D:/minio3 http://127.0.0.1/D:/minio4 minio server --address :9004 http://127.0.0.1/D:/minio1 http://127.0.0.1/D:/minio2 http://127.0.0.1/D:/minio3 http://127.0.0.1/D:/minio4 

3.配置负载均衡

Nginx.conf增加配置

多机集群配置

upstream minio {    server 192.168.10.11:9000;    server 192.168.10.12:9000;    server 192.168.10.13:9000;    server 192.168.10.14:9000;    } ​server {    listen    9000;    server_name  localhost;    ignore_invalid_headers off;    client_max_body_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;    proxy_http_version 1.1;    proxy_set_header Connection "";    chunked_transfer_encoding off;    proxy_pass http://minio;        }        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }    }

访问http://192.168.10.10:9000/自动负载到其他四台电脑的minio服务上

单机集群配置

upstream minio {    server 127.0.0.1:9001;    server 127.0.0.1:9002;    server 127.0.0.1:9003;    server 127.0.0.1:9004;    } ​server {    listen    9000;    server_name  localhost;    ignore_invalid_headers off;    client_max_body_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;    proxy_http_version 1.1;    proxy_set_header Connection "";    chunked_transfer_encoding off;    proxy_pass http://minio;        }        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }    }

访问http://127.0.0.1:9000/自动负载到9001~9004的任意一个端口

常见问题:

ERROR Unable to initialize backend: found backend fs, expected xl

解决方案:

原因是当前这台服务器部署过单机版,导致集群部署一直不成功。需要将原来相关⽂件存储⽬录⾥的 .minio.sys⽂件清理掉。

如需转载,请注明作者和原文连接。