Minio分布式部署及遇到的報錯


 

1.機器分布

192.168.10.66

192.168.10.22

192.168.10.33

 

2.機器配置

Minio-server服務器

品牌:lenovo

cpu4

內存:3G

硬盤容量:40G硬盤 

IP192.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

chmod +x minio

chmod +x mc 

cp mc /bin/

cp minio /bin/

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;

        }

}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM