1.机器分布
192.168.10.66
192.168.10.22
192.168.10.33
2.机器配置
Minio-server服务器
品牌:lenovo
cpu:4核
内存:3G
硬盘容量:40G硬盘
IP:192.168.10.xx
网关 192.168.10.2
DNS1=8.8.8.8
3.下载相关工具
#下载minio服务端
wget
http://dl.minio.org.cn/server/minio/release/linux-amd64/minio
#下载客户端
wget
http://dl.minio.org.cn/client/mc/release/linux-amd64/mc
4.搭建minio(三个节点为一个集群)
#创建目录(两个数据磁盘)
mkdir -p /data/minio{1,2}
mkdir /etc/minio
#编辑启动脚本
[root@localhost ~]# cat /opt/run.sh
#!/bin/bash
export MINIO_ACCESS_KEY=admin
export MINIO_SECRET_KEY=admin123
/usr/bin/minio server --config-dir /etc/minio \
http://192.168.10.66/data/minio1 http://192.168.10.66/data/minio2 \
http://192.168.10.22/data/minio1 http://192.168.10.22/data/minio2 \
http://192.168.10.33/data/minio1 http://192.168.10.33/data/minio2
#启动脚本加权限
chmod +x /opt/run.sh
# 配置systemd启动
[root@localhost ~]# cat /usr/lib/systemd/system/mi
microcode.service minio.service
[root@localhost ~]# cat /usr/lib/systemd/system/mi
microcode.service minio.service
[root@localhost ~]# cat /usr/lib/systemd/system/minio.service
[Unit]
Description=Minio service
Documentation=https://docs.minio.io/
[Service]
WorkingDirectory=/opt/
ExecStart=/opt/run.sh
# Let systemd restart this service on-failure
Restart=on-failure
RestartSec=5
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
#系统启动脚本添加权限
chmod +x /usr/lib/systemd/system/minio.service
#启动minio服务
systemctl daemon-reload
systemctl is-enabled minio.service
systemctl start minio.service
systemctl status minio.service
#查看日志
tailf /var/log/message
Apr 24 14:45:23 localhost run.sh: Endpoint: http://192.168.10.22:9000 http://172.17.0.1:9000 http://127.0.0.1:9000
Apr 24 14:45:23 localhost run.sh: Browser Access:
Apr 24 14:45:23 localhost run.sh: http://192.168.10.22:9000 http://172.17.0.1:9000 http://127.0.0.1:9000
Apr 24 14:45:23 localhost run.sh: Object API (Amazon S3 compatible):
Apr 24 14:45:23 localhost run.sh: Go: https://docs.min.io/docs/golang-client-quickstart-guide
Apr 24 14:45:23 localhost run.sh: Java: https://docs.min.io/docs/java-client-quickstart-guide
Apr 24 14:45:23 localhost run.sh: Python: https://docs.min.io/docs/python-client-quickstart-guide
Apr 24 14:45:23 localhost run.sh: JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide
Apr 24 14:45:23 localhost run.sh: .NET: https://docs.min.io/docs/dotnet-client-quickstart-guide
Apr 24 14:45:23 localhost run.sh: IAM initialization complete
Apr 24 14:47:29 localhost chronyd[771]: Forward time jump detected!
Apr 24 14:49:39 localhost chronyd[771]: Source 119.28.206.193 replaced with 188.165.11.86
#三台一样操作,每台都要看一下日志是否输出结果一样。
5.minio访问效果
6.minio命令行上传文件及查看
#连接minio
mc config host add minio http://192.168.10.66:9000 admin admin123
#新增目录
mc mb minio1/cert
#上传文件
mc cp ~/文件名字 minio/上传到minio指定命令
7.安装minio遇到的问题
#访问页面显示这个报错Server not initialized, please try again
#查看日志看到
[root@localhost data]# tailf /var/log/messages
Apr 24 14:40:53 localhost run.sh: Waiting for all other servers to be online to format the disks.
Apr 24 14:40:54 localhost run.sh: Unable to read 'format.json' from http://192.168.10.22:9000/data/minio1: client time 2021-04-24 06:40:54 +0000 UTC is too apart with server time 2020-11-18 15:23:57.145857292 +0000 UTC
Apr 24 14:40:54 localhost run.sh: Unable to read 'format.json' from http://192.168.10.22:9000/data/minio2: client time 2021-04-24 06:40:54 +0000 UTC is too apart with server time 2020-11-18 15:23:57.145865387 +0000 UTC
Apr 24 14:40:54 localhost run.sh: Waiting for all other servers to be online to format the disks.
Apr 24 14:40:54 localhost run.sh: Unable to read 'format.json' from http://192.168.10.22:9000/data/minio1: client time 2021-04-24 06:40:54 +0000 UTC is too apart with server time 2020-11-18 15:23:57.692449821 +0000 UTC
Apr 24 14:40:54 localhost run.sh: Unable to read 'format.json' from http://192.168.10.22:9000/data/minio2: client time 2021-04-24 06:40:54 +0000 UTC is too apart with server time 2020-11-18 15:23:57.692977041 +0000 UTC
Apr 24 14:40:54 localhost run.sh: Waiting for all other servers to be online to format the disks.
#以上是错误信息
#解决方法
看你的机器是不是时间不对
再来查看你的磁盘空间是不是满了
然后将进程kill掉
在重新启动一下。
8.nginx代理
安装nginx
yum -y install nginx
#配置修改
[root@web-01 default.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
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 2048;
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/default.d/*.conf;
}
#代理配置
[root@web-01 default.d]# egrep -v "^#|^$" minio.conf
upstream mino{
server 192.168.10.66:9000;
server 192.168.10.22:9000;
server 192.168.10.33:9000;
server
listen 80;
server_name 192.168.10.88;
location / {
#include naxsi.rules;
#limit_conn one 150;
#limit_conn perserver 1000;
#limit_req zone=concurrent burst=6 nodelay;
#proxy_pass http://127.0.0.1:8082;
proxy_pass http://minio;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
location ~ /\.
deny all;