minio集群安装

2022/7/7 23:20:10

本文主要是介绍minio集群安装,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

minio集群安装

1 准备工作

192.168.1.9
mkdir -p /data/minio/data1
mkdir -p /data/minio/data2
/data/minio/data1 /data/minio/data2
192.168.1.10
mkdir -p /data/minio/data1
mkdir -p /data/minio/data2
/data/minio/data1 /data/minio/data2
192.168.1.11
mkdir -p /data/minio/data1
mkdir -p /data/minio/data2
/data/minio/data1 /data/minio/data2
192.168.1.12
mkdir -p /data/minio/data1
mkdir -p /data/minio/data2
/data/minio/data1 /data/minio/data2

本集群由2台服务器构成(官方推荐集群最小4台服务器),每个服务器上挂载两个磁盘目录,最小数据挂载点为4个

上传文件minio minio.service minio.cnf到/etc/default/目录

minio.cnf

# Volume to be used for MinIO server.
MINIO_VOLUMES="http://192.168.1.9/data/minio/data1 http://192.168.1.9/data/minio/data2 http://192.168.1.10/data/minio/data1 http://192.168.1.10/data/minio/data2  http://192.168.1.11/data/minio/data1 http://192.168.1.11/data/minio/data2 http://192.168.1.12/data/minio/data1 http://192.168.1.12/data/minio/data2"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9000 --console-address :36901 --config-dir /data/minio"
# Root user for the server.
MINIO_ROOT_USER=root
# Root secret for the server.
MINIO_ROOT_PASSWORD=Q1Cy9YRnsfBlyv94f

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

[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio

[Service]
WorkingDirectory=/usr/local/

User=minio
Group=minio
ProtectProc=invisible

EnvironmentFile=/etc/default/minio.cnf
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio.cnf\"; exit 1; fi"

ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES

# Let systemd restart this service always
Restart=always

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536

# Specifies the maximum number of threads this process can create
TasksMax=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=infinity
SendSIGKILL=no

[Install]
WantedBy=multi-user.target

# Built for ${project.name}-${project.version} (${project.name})

2.2 创建相关目录所有节点都需执行

数据存储目录

mkdir -p /data/minio
mkdir -p /data/minio/{data1,data2}
chmod -R +x /data/minio

#创建minio用户
groupadd minio 
useradd -g minio minio

mv /data/minio/minio.cnf /etc/default/
mv /data/minio/mc /usr/local/bin/
mv /data/minio/minio /usr/local/bin/
mv /data/minio/minio.service /usr/lib/systemd/system/

chown -R minio:minio /data/minio

systemctl daemon-reload
systemctl start minio
systemctl enable minio

配置nginx

upstream minio-server {
    server 192.168.1.9:9000 weight=25 max_fails=2 fail_timeout=30s;
    server 192.168.1.10:9000 weight=25 max_fails=2 fail_timeout=30s;
    server 192.168.1.11:9000 weight=25 max_fails=2 fail_timeout=30s;
    server 192.168.1.12:9000 weight=25 max_fails=2 fail_timeout=30s;
}
server {
    listen 80;
    server_name localhost;
    charset utf-8;
    default_type text/html;
    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $remote_addr;
        client_body_buffer_size 10M;
        client_max_body_size 10G;
        proxy_buffers 1024 4k;
        proxy_read_timeout 300;
        proxy_next_upstream error timeout http_404;
        proxy_pass http://minio-server;
    }
}


这篇关于minio集群安装的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程