前言
Minio是GlusterFS創(chuàng)始人之一Anand Babu Periasamy發(fā)布新的開源項(xiàng)目?;贏pache License v2.0開源協(xié)議的對(duì)象存儲(chǔ)項(xiàng)目,采用Golang實(shí)現(xiàn),客戶端支Java,Python,Javacript, Golang語言。
其設(shè)計(jì)的主要目標(biāo)是作為私有云對(duì)象存儲(chǔ)的標(biāo)準(zhǔn)方案。主要用于存儲(chǔ)海量的圖片,視頻,文檔等。非常適合于存儲(chǔ)大容量非結(jié)構(gòu)化的數(shù)據(jù),例如圖片、視頻、日志文件、備份數(shù)據(jù)和容器/虛擬機(jī)鏡像等,而一個(gè)對(duì)象文件可以是任意大小,從幾kb到最大5T不等。
一、準(zhǔn)備工作
操作系統(tǒng):CentOS 7
機(jī)器資源:
分布式Minio至少需要4個(gè)硬盤,使用分布式Minio自動(dòng)引入了糾刪碼功能,如果是一個(gè)有N塊硬盤的分布式Minio,只要有N/2硬盤在線,你的數(shù)據(jù)就是安全的。不過你需要至少有N/2+1個(gè)硬盤來創(chuàng)建新的對(duì)象。
建議最少4個(gè)硬盤,這樣的話就可以做到1個(gè)磁盤損壞集群依然可以讀寫,2個(gè)磁盤損壞集群依然可讀
本文因是測(cè)試環(huán)境僅以2臺(tái)機(jī)器2塊磁盤為例,每臺(tái)機(jī)器兩個(gè)數(shù)據(jù)目錄
節(jié)點(diǎn) | 目錄 |
---|---|
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安裝包:
官網(wǎng)下載,官網(wǎng)網(wǎng)絡(luò)較慢,也可以采用CSDN下載
二、集群搭建(每臺(tái)服務(wù)器操作都一樣)
1.創(chuàng)建目錄
mkdir /app/minio/data1
mkdir /app/minio/data2
2.編寫啟動(dòng)腳本
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”,允許對(duì)prometheus度量標(biāo)準(zhǔn)不進(jìn)行身份驗(yàn)證(MinIO支持Prometheus jwt或兩種身份驗(yàn)證模式public,默認(rèn)情況下,MinIO以jwtmode 運(yùn)行。)
- –address “:9000”,可配置minio的API訪問端口
- –console-address “:9001”,可配置minio的WEB管理界面的訪問端口
- –config-dir /app/minio/config是指定配置文件路徑的,如果沒有指定這個(gè)參數(shù),那么默認(rèn)就會(huì)在~/.minio下生成相關(guān)的文件
3.賦權(quán)、啟動(dòng)
chmod +x /app/minio/minio
chmod +x /app/minio/run.sh
./run.sh
4.瀏覽器訪問
輸入集群任意節(jié)點(diǎn)地址,如需負(fù)載可配置nginx,如果地址訪問不通,請(qǐng)關(guān)閉防火墻或者開放9000端口
5.Nginx負(fù)載均衡配置
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;
}
}
}
三.注意事項(xiàng)
1.data數(shù)據(jù)目錄,一旦初始化后,增加或減少數(shù)據(jù)目錄,會(huì)報(bào)錯(cuò):已被使用。需要?jiǎng)h除數(shù)據(jù)目錄重建文章來源:http://www.zghlxwxcb.cn/news/detail-651832.html
例如:25服務(wù)器進(jìn)行單機(jī)部署調(diào)試,調(diào)試成功后,進(jìn)行25和28集群部署時(shí),data1和data2目錄必須刪除重建。文章來源地址http://www.zghlxwxcb.cn/news/detail-651832.html
結(jié)尾
- 感謝大家的耐心閱讀,如有建議請(qǐng)私信或評(píng)論留言。
- 如有收獲,勞煩支持,關(guān)注、點(diǎn)贊、評(píng)論、收藏均可,博主會(huì)經(jīng)常更新,與大家共同進(jìn)步
到了這里,關(guān)于minio分布式集群安裝部署實(shí)戰(zhàn)詳細(xì)手冊(cè)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!