前言
Minio是GlusterFS创始人之一Anand Babu Periasamy发布新的开源项目。基于Apache License v2.0开源协议的对象存储项目,采用Golang实现,客户端支Java,Python,Javacript, Golang语言。
其设计的主要目标是作为私有云对象存储的标准方案。主要用于存储海量的图片,视频,文档等。非常适合于存储大容量非结构化的数据,例如图片、视频、日志文件、备份数据和容器/虚拟机镜像等,而一个对象文件可以是任意大小,从几kb到最大5T不等。
一、准备工作
操作系统:CentOS 7
机器资源:
分布式Minio至少需要4个硬盘,使用分布式Minio自动引入了纠删码功能,如果是一个有N块硬盘的分布式Minio,只要有N/2硬盘在线,你的数据就是安全的。不过你需要至少有N/2+1个硬盘来创建新的对象。
建议最少4个硬盘,这样的话就可以做到1个磁盘损坏集群依然可以读写,2个磁盘损坏集群依然可读
本文因是测试环境仅以2台机器2块磁盘为例,每台机器两个数据目录
节点 | 目录 |
---|---|
10.101.37.25 | /app/minio/data1 |
10.101.37.25 | /app/minio/data2 |
10.101.37.28 | /app/minio/data1 |
10.101.37.28 | /app/minio/data2 |
minio安装包:
官网下载,官网网络较慢,也可以采用CSDN下载
二、集群搭建(每台服务器操作都一样)
1.创建目录
mkdir /app/minio/data1
mkdir /app/minio/data2
2.编写启动脚本
vi /app/minio/run.sh
#!/bin/bash
export MINIO_ROOT_USER=testminio
export MINIO_ROOT_PASSWORD=testminio
#export MINIO_PROMETHEUS_AUTH_TYPE="public"
/app/minio/minio server --address ":9000" --console-address ":9001" http://10.101.37.28/app/minio/data1 http://10.101.37.28/app/minio/data2 http://10.101.37.25/app/minio/data1 http://10.101.37.25/app/minio/data2 > /app/minio/minio.log 2>&1 &
- MINIO_PROMETHEUS_AUTH_TYPE=“public”,允许对prometheus度量标准不进行身份验证(MinIO支持Prometheus jwt或两种身份验证模式public,默认情况下,MinIO以jwtmode 运行。)
- –address “:9000”,可配置minio的API访问端口
- –console-address “:9001”,可配置minio的WEB管理界面的访问端口
- –config-dir /app/minio/config是指定配置文件路径的,如果没有指定这个参数,那么默认就会在~/.minio下生成相关的文件
3.赋权、启动
chmod +x /app/minio/minio
chmod +x /app/minio/run.sh
./run.sh
4.浏览器访问
输入集群任意节点地址,如需负载可配置nginx,如果地址访问不通,请关闭防火墙或者开放9000端口
5.Nginx负载均衡配置
nginx.conf配置如下:
worker_processes 4;
events {
worker_connections 65535;
}
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
client_max_body_size 10M;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$upstream_addr"'
'$request_time $upstream_response_time';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
# include /etc/nginx/conf.d/*.conf;
upstream minio {
server 10.101.37.25:9000;
server 10.101.37.28:9000;
}
upstream console {
ip_hash;
server 10.101.37.25:9001;
server 10.101.37.28:9001;
}
server {
listen 9000;
listen [::]:9000;
server_name localhost;
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 0;
# To disable buffering
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;
# 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 9001;
listen [::]:9001;
server_name localhost;
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 0;
# To disable buffering
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;
# 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://console;
}
}
}
三.注意事项
1.data数据目录,一旦初始化后,增加或减少数据目录,会报错:已被使用。需要删除数据目录重建文章来源:https://www.toymoban.com/news/detail-651832.html
例如:25服务器进行单机部署调试,调试成功后,进行25和28集群部署时,data1和data2目录必须删除重建。文章来源地址https://www.toymoban.com/news/detail-651832.html
结尾
- 感谢大家的耐心阅读,如有建议请私信或评论留言。
- 如有收获,劳烦支持,关注、点赞、评论、收藏均可,博主会经常更新,与大家共同进步
到了这里,关于minio分布式集群安装部署实战详细手册的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!