一导俘、下載安裝文件
wget http://dl.minio.org.cn/server/minio/release/linux-amd64/minio
二、創(chuàng)建數(shù)據(jù)文件夾
mkdir /opt/minio/data
三、啟動(dòng)
# 賦予權(quán)限
chmod 777 minio
# 啟動(dòng)命令
./minio server /opt/minio/data
# 后臺(tái)啟動(dòng)
nohup ./minio server /opt/minio/data >/dev/null &
如發(fā)下以下問題是發(fā)生端口占用:
請更換端口或殺死占用端口的進(jìn)程宰衙。
啟動(dòng)成功如下所示:
訪問console直接ip:9000就可以了,會(huì)直接跳轉(zhuǎn)到控制臺(tái)睹欲。
四供炼、設(shè)置永久訪問鏈接
很多情況下一屋,我們的圖片是需要瀏覽器直接訪問的,這里通過minio的客戶端進(jìn)行設(shè)置。
下載客戶端:
wget https://dl.minio.io/client/mc/release/linux-amd64/mc
賦予權(quán)限
chmod 777 mc
添加server
./mc config host add minio http://172.16.3.28:9000/ minioadmin minioadmin
設(shè)置需要開放下載的bucket, 注意需要帶minio
./mc policy set download minio/graph-editor
訪問圖片:
http://172.16.3.28:9000/graph-editor/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20210820174907.jpg
五、修改用戶名密碼:
export MINIO_ROOT_USER=admin
export MINIO_ROOT_PASSWORD=12345678
注意彼哼,minio的密碼要求達(dá)到8個(gè)字符蜀变,否則會(huì)啟動(dòng)失敗,如下所示:
[root@public-server9 minio]# ./minio server /opt/minio/data1
ERROR Unable to validate credentials inherited from the shell environment: Invalid credentials
> Please provide correct credentials
HINT:
Access key length should be at least 3, and secret key length at least 8 characters
六、集群部署
需要在每臺(tái)節(jié)點(diǎn)執(zhí)行以下的命令,如下所示,共三個(gè)節(jié)點(diǎn)虫腋,每個(gè)節(jié)點(diǎn)三個(gè)目錄
nohup ./minio server --console-address ":10001" http://172.16.3.28/opt/minio/data1 http://172.16.3.28/opt/minio/data2 http://172.16.3.28/opt/minio/data3 \
http://172.16.3.29/opt/minio/data1 http://172.16.3.29/opt/minio/data2 http://172.16.3.29/opt/minio/data3 \
http://172.16.3.30/opt/minio/data1 http://172.16.3.30/opt/minio/data2 http://172.16.3.30/opt/minio/data3 \
>/dev/null &
設(shè)置永久訪問權(quán)限和前面一樣,不同是在一臺(tái)節(jié)點(diǎn)設(shè)置衅胀,訪問其他節(jié)點(diǎn)岔乔,會(huì)自動(dòng)跳到被設(shè)置的訪問節(jié)點(diǎn)。
添加nginx負(fù)載:
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
upstream minio {
server 172.16.3.28:9000 fail_timeout=10s max_fails=2 weight=1;
server 172.16.3.29:9000 fail_timeout=10s max_fails=2 weight=1;
server 172.16.3.30:9000 fail_timeout=10s max_fails=2 weight=1;
}
upstream minio-console {
server 172.16.3.28:10001 fail_timeout=10s max_fails=2 weight=1;
server 172.16.3.29:10001 fail_timeout=10s max_fails=2 weight=1;
server 172.16.3.30:10001 fail_timeout=10s max_fails=2 weight=1;
}
server {
listen 10000;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://minio;
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 $remote_addr;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 11000;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://minio-console;
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 $remote_addr;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}