minio集群搭建

  1. 安装程序
    wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20241029160148.0.0-1.x86_64.rpm -O minio.rpm
    sudo dnf install minio.rpm

     

  2. 单点运行, /data/minio是我本地minio文件存放目录
    minio server  --address :10000 --console-address /data/minio

     

  3. 2024年12月部署集群,按照管网的配置总是失败,摸索着发现用单点启动命令可以,单点启动成功后确认本机可用
  4. 删除启动过minio单点的文件目录,否则会报错类似已经被minio初始化
    #如果是正式环境或者以前单点用的想升级集群这样是坚决不行的
    rm -rf  /data/minio

     

  5. 每个节点都要执行命令,日志我放在了指定位置,端口9000留给其他服务了,这里用10000和10001
    nohup minio server  --address :10000 --console-address :10001 http://node1:10000/data/minio/data http://node2:10000/data/minio/data http://node3:10000/data/minio/data >> /data/minio/activelog.log 2>&1 &

     

  6. 启动时可以查看状态,节点全部启动之前或者有节点掉线会一直打印连接日志
    journalctl -xeu minio.service

     

  7. nginx反向代理,api端口和UI端口各自代理
    upstream minio_s3 {
            least_conn;
            server node1:10000;
            server node2:10000;
            server node3:10000;
    }
    upstream minio_console {
            least_conn;
            server node1:10001;
            server node2:10001;
            server node3:10001;
    }
    
    
    
    
    
    server {
            listen 10000;
            #        server_name minio.ghlw.net;
            ignore_invalid_headers off;
            client_max_body_size 20m;
            proxy_buffering off;
            proxy_request_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;
    
                    proxy_connect_timeout 300;
                    proxy_http_version 1.1;
                    proxy_set_header Connection "";
                    chunked_transfer_encoding off;
    
                    proxy_pass http://minio_s3;
            }
    
    }
    
    
    
    server {
            listen 10001;
            ignore_invalid_headers off;
            client_max_body_size 20m;
            proxy_buffering off;
            proxy_request_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;
                    proxy_set_header X-NginX-Proxy true;
    
                    real_ip_header X-Real-IP;
    
                    proxy_connect_timeout 300;
    
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
    
                    chunked_transfer_encoding off;
                    proxy_pass http://minio_console;
            }
    }

     

  8. 结果:nginx在50,60、61、62分别为 node1、node2、node3

     

     

posted @ 2024-12-07 16:40  天涯已可  阅读(7)  评论(0编辑  收藏  举报