hostname | Minio1 | Minio2 | Minio3 | Minio4 |
ip | 10.6.100.96/25 | 100.100 | 100.101 | 100.102 |
T-questionnaire 10.6.100.78/25 | ||||
Minio:
MinIO is an object storage solution that provides an Amazon Web Services S3-compatible API and supports all core S3 features. MinIO is built to deploy anywhere - public or private cloud, baremetal infrastructure, orchestrated environments, and edge infrastructure.
来自 <MinIO Object Storage for Linux — MinIO Object Storage for Linux>
C:\Users\38742>nslookup minioserver.ihlt.com
服务器: HLT-PDC.ihlt.com
Address: 10.6.100.10
名称: minioserver.ihlt.com
Address: 10.6.100.13
#很早之前配置的文件,最新的参见官网的三类部署方式:
Deploy MinIO: Single-Node Single-Drive
Deploy MinIO: Single-Node Multi-Drive
Deploy MinIO: Multi-Node Multi-Drive (以下属于)
以下是history和一些关键配置:
16 fdisk -l
17 fdisk /dev/sdb
18 pvcreate /dev/sdb1
19 vgcreate hlt /dev/sdb1
20 lvcreate -L 199G -n data hlt
21 lvdisplay
22 mkfs.xfs /dev/hlt/data
23 blkid
24 mkdir /data
25 mount /dev/mapper/hlt-data /data
26 df -Th
27 vim /etc/fstab
28 exit
29 df -Th
38 mkdir -p /data/minio/{run,data1,data2}
39 ll
40 cd /data/minio/run/
41 ll
42 vim /data/minio/run/run.sh
43 vim /usr/lib/systemd/system/minio.service
#cat /usr/lib/systemd/system/minio.service
[Unit]
Description=Minio service
Documentation=https://docs.minio.io/
[Service]
WorkingDirectory=/data/minio/run
ExecStart=/data/minio/run/run.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
#cat /data/minio/run/run.sh
#!/bin/bash
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=2200.h@Lietch
/data/minio/run/minio server --config-dir /etc/minio \
--console-address :9029 \
http://10.6.100.96/data/minio/data1 http://10.6.100.96/data/minio/data2 \
http://10.6.100.100/data/minio/data1 http://10.6.100.100/data/minio/data2 \
http://10.6.100.101/data/minio/data1 http://10.6.100.101/data/minio/data2 \
http://10.6.100.102/data/minio/data1 http://10.6.100.102/data/minio/data2
45 chmod +x /usr/lib/systemd/system/minio.service && chmod +x /data/minio/run/minio && chmod +x /data/minio/run/run.sh
46 systemctl daemon-reload
47 systemctl start minio
48 systemctl enable minio
49 systemctl status minio.service
66 ps -ef|grep minio
现在使用的界面如下:
屏幕剪辑的捕获时间: 9/14/2023 11:47 AM
#官方建议:使用Multi-Node Multi-Drive保障生产的高可用
#建议各个Node配置一致,要求各个Drive的类型一致,容量尽量一致(不一致时按取小原则使用)
#建议xfs文件格式性能比较优越和稳定
#建议MNMD使用LB软件(nginx或者HAproxy)来负载使用,负载算法优选“LeastConnections”
#建议配置多节点之间的时间同步、网络互访权限、访问端口号一致
#当在分布式环境中启动新的MinIO服务器时,存储设备不能有现有的数据。
#一旦您启动了MinIO服务器,与数据的所有交互都必须通过S3 API来完成。使用MinIO客户端、MinIO控制台或一个MinIO软件开发工具包之一来处理桶和对象。
更多的minio可以登录https://min.io/docs/minio/linux/administration/minio-console.html官网在线测试使用。
#生产环境问卷系统在nginx中使用minio的示例
#以下是10.6.100.78上的nginx.conf配置信息
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
ssl_certificate "/usr/local/nginx/ssl/server.pem";
ssl_certificate_key "/usr/local/nginx/ssl/server.key";
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
error_page 500 502 503 504 /50x.html;
#问卷评分系统IP
upstream questionnaire {
server 10.6.100.78:8999;
server 10.6.100.125:8999;
}
server {
#使用tcp 8887来访问,并没有使用ssl
listen 8887;
server_name localhost;
client_max_body_size 100m;
location / {
root questionnaire;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
proxy_pass http://questionnaire/; //代理后端地址,使用前端10.6.100.78:8887可访问
}
}
server {
#使用ssl链接,tcp 8078来安全访问
listen 8078 ssl;
server_name questionnaire.ihlt.com ;
client_max_body_size 100m;
ssl_certificate "/usr/local/nginx/ssl/questionnaire.ihlt.com.pem";
ssl_certificate_key "/usr/local/nginx/ssl/questionnaire.ihlt.com.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root questionnaire;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
proxy_pass http://questionnaire/;
}
}
upstream minio{
ip_hash; //官方建议使用least connection算法。这里使用了ip hash
server 10.6.100.96:9000;
server 10.6.100.100:9000;
server 10.6.100.101:9000;
server 10.6.100.102:9000;
}
server {
listen 9000 ssl;
server_name minioserver.ihlt.com;
ssl_certificate "/usr/local/nginx/ssl/minioserver.ihlt.com.pem";
ssl_certificate_key "/usr/local/nginx/ssl/minioserver.ihlt.com.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location /{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_body_buffer_size 100M;
proxy_read_timeout 300s;
proxy_pass http://minio;
}
}
}