Minio部署

1、获取Minio

https://dl.min.io/server/minio/release/linux-amd64/minio

2、系统最大文件数修改

echo "*   soft    nofile  65535" >> /etc/security/limits.conf
echo "*   hard    nofile  65535" >> /etc/security/limits.conf

3、目录创建

  • 二进制文件目录 bin
  • 数据存储目录 data(多节点4个节点以上时,每个节点建一个data目录)
  • 配置文件目录/etc/minio
mkdir -p /data/minio/{bin,data} && mkdir -p /etc/minio

4、配置文件

minio.cnf
#MINIO_ACCESS_KEY=Minio
#MINIO_SECRET_KEY=meiyou#mima!
#新版MINIO已不推荐使用MINIO_ACCESS_KEY和MINIO_SECRET_KEY,推荐使用MINIO_ROOT_USER和MINIO_ROOT_PASSWORD
MINIO_ROOT_USER=Minio
MINIO_ROOT_PASSWORD=meiyou#mima!
MINIO_VOLUMES="/data/minio/data" 
MINIO_OPTS="--address :9000 --console-address :9001"
MINIO_SERVER_URL="http://10.211.55.5:9000"

(集群时,配置不同的ip既可)

5、设置systemctl 启动文件

vim /usr/lib/systemd/system/minio.service 

 

[Unit]
Description=Minio service
Documentation=https://docs.minio.io/
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/data/minio/bin/minio

[Service]
WorkingDirectory=/data/minio/


User=root
Group=root
    
EnvironmentFile=/etc/minio/minio.cnf
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]";then echo \"Variable MINIO_VOLUEMS not set in /etc/minio\";exit 1;fi"
ExecStart=/data/minio/bin/minio server $MINIO_VOLUMES $MINIO_OPTS

Restart=always

StandardOutput=journal
StandardError=inherit

# 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=0

# SIGTERM signal is used to stop Minio
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=0

[Install]
WantedBy=multi-user.target


Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

 

6、二进制文件

将minio二进制文件上传到/data/minio/bin目录

7、权限修改

给所有涉及到的文件或目录添加权限

  • service文件
  • 二进制文件
chmod +x /usr/lib/systemd/system/minio.service && chmod +x /data/minio/bin/minio && chmod +x /etc/minio/minio.cnf

8、启动服务

systemctl daemon-reload 
systemctl enable minio systemctl start minio
systemctl stop minio

9、浏览器访问控制台

http://10.211.55.5:9001

 

 10、部署Nginx代理(代理集群时使用)

user  nginx;
worker_processes  auto;
 
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
 
events {
    worker_connections  4096;
}
 
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
 
    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;
    keepalive_timeout  65;
 
    # include /etc/nginx/conf.d/*.conf;
 
    upstream minio {
        server 10.211.55.5:9000;
        server 10.211.55.6:9000;
        server 10.211.55.7:9000;
        server 10.211.55.8:9000;
    }
 
    upstream console {
        ip_hash;
        server 10.211.55.5:9001;
        server 10.211.55.6:9001;
        server 10.211.55.7:9001;
        server 10.211.55.8:9001;
    }
 
    server {
        listen       9000;
        listen  [::]:9000;
        server_name  localhost;
 
        # To allow special characters in headers
        ignore_invalid_headers off;
        # Allow any size file to be uploaded.
        # Set to a value such as 1000m; to restrict file size to a specific value
        client_max_body_size 0;
        # To disable buffering
        proxy_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;
            # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            chunked_transfer_encoding off;
 
            proxy_pass http://minio;
        }
    }
 
    server {
        listen       9001;
        listen  [::]:9001;
        server_name  localhost;
 
        # To allow special characters in headers
        ignore_invalid_headers off;
        # Allow any size file to be uploaded.
        # Set to a value such as 1000m; to restrict file size to a specific value
        client_max_body_size 0;
        # To disable buffering
        proxy_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;
 
            # This is necessary to pass the correct IP to be hashed
            real_ip_header X-Real-IP;
 
            proxy_connect_timeout 300;
            # Default is HTTP/1, keepalive is only enabled in HTTP/1.1
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            chunked_transfer_encoding off;
 
            proxy_pass http://console;
        }
    }
}

 

posted @ 2022-01-14 14:32  水木神舟10  阅读(419)  评论(0编辑  收藏  举报