MinIO集群中的节点的网络需要互相双向互通。
MinIO API默认端口9000
MinIO console默认端口9001
MinIO强烈建议使用负载均衡器来管理与集群的连接。负载均衡器策略使用“最小连接数”逻辑,因为在部署中任何 MinIO 节点都可以接收、路由或处理客户端请求。
MinIO创建节点池时,需要使用扩展符号{x ... y}表示一连串的MinIO host序列。
MinIO支持使用一连串的hostname或者IP地址来表示部署中的每个minio server进程。
如果没有连续的hostname或者IP地址,也可以使用替代办法:在/etc/hosts中配置连续的简单DNS解析。
# /etc/hosts
198.0.2.10 minio-01.example.net
198.51.100.3 minio-02.example.net
198.0.2.43 minio-03.example.net
198.51.100.12 minio-04.example.net
可以使用扩展表示法指定整个主机名范围
minio-0{1...4}.example.com
MinIO强烈建议使用XFS格式的磁盘直接挂载JBOD,以提供最佳性能。
确保在部署中的所有节点有相同的磁盘类型和磁盘容量。MinIO不区分驱动器类型,也不会从混合存储类型中获得好处。此外,MinIO将每个驱动器使用的大小限制为部署中最小的驱动器大小。例如,如果部署中有15个10TB磁盘和1个1TB磁盘,MinIO限制每个磁盘容量为1TB。
MinIO创建新部署时,需要使用扩展符号{x ... y}表示一连串的磁盘序列,其中部署中的所有节点都具有一组相同的已挂载的磁盘。
MinIO强烈建议使用/etc/fstab配置磁盘挂载,保证服务器重启后磁盘挂载保持不变。例如:
$ mkfs.xfs /dev/sdb -L DISK1
$ mkfs.xfs /dev/sdc -L DISK2
$ mkfs.xfs /dev/sdd -L DISK3
$ mkfs.xfs /dev/sde -L DISK4
$ nano /etc/fstab
#
LABEL=DISK1 /mnt/disk1 xfs defaults,noatime 0 2
LABEL=DISK2 /mnt/disk2 xfs defaults,noatime 0 2
LABEL=DISK3 /mnt/disk3 xfs defaults,noatime 0 2
LABEL=DISK4 /mnt/disk4 xfs defaults,noatime 0 2
可以使用扩展表示法指定整个磁盘的挂载序列,或者挂载子目录序列
/mnt/disk{1...4}
/mnt/disk{1...4}/minio
多节点系统必须维护时间和日期同步,以维持稳定的节点间的操作和交互。
强烈建议使用RPM或DEB进行安装
wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20231111081441.0.0.x86_64.rpm
yum install -y minio-20231111081441.0.0.x86_64.rpm
rpm安装,service文件在这个路径:/usr/lib/systemd/system/minio.service
二进制安装需要在所有节点上手动新建文件。
[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[Service]
WorkingDirectory=/usr/local
User=minio-user
Group=minio-user
ProtectProc=invisible
EnvironmentFile=-/etc/default/minio
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi"
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
# MinIO RELEASE.2023-05-04T21-44-30Z adds support for Type=notify (https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=)
# This may improve systemctl setups where other services use `After=minio.server`
# Uncomment the line to enable the functionality
# Type=notify
# 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})
minio.service文件默认使用minio-user用户&组运行,需要新建minio-user用户和组
groupadd -r minio-user
useradd -M -r -g minio-user minio-user
chown minio-user:minio-user /mnt/disk1 /mnt/disk2 /mnt/disk3 /mnt/disk4
新建环境变量文件:/etc/default/minio
MinIO使用此文件作为环境变量的源文件。所有节点都需要包含一样的环境变量文件。
默认配置文件如下,假设:
minio1.example.com minio3.example.com
minio2.example.com minio4.example.com
/mnt/disk1/minio /mnt/disk3/minio
/mnt/disk2/minio /mnt/disk4/minio
# Set the hosts and volumes MinIO uses at startup
# The command uses MinIO expansion notation {x...y} to denote a
# sequential series.
#
# The following example covers four MinIO hosts
# with 4 drives each at the specified hostname and drive locations.
# The command includes the port that each MinIO server listens on
# (default 9000)
MINIO_VOLUMES="https://minio{1...4}.example.net:9000/mnt/disk{1...4}/minio"
# Set all MinIO server options
#
# The following explicitly sets the MinIO Console listen address to
# port 9001 on all network interfaces. The default behavior is dynamic
# port selection.
MINIO_OPTS="--console-address :9001"
# Set the root username. This user has unrestricted permissions to
# perform S3 and administrative API operations on any resource in the
# deployment.
#
# Defer to your organizations requirements for superadmin user name.
MINIO_ROOT_USER=minioadmin
# Set the root password
#
# Use a long, random, unique string that meets your organizations
# requirements for passwords.
MINIO_ROOT_PASSWORD=minio-secret-key-CHANGE-ME
# Set to the URL of the load balancer for the MinIO deployment
# This value *must* match across all MinIO servers. If you do
# not have a load balancer, set this value to to any *one* of the
# MinIO hosts in the deployment as a temporary measure.
MINIO_SERVER_URL="https://minio.example.net:9000"
x.509证书文件(.crt)和私钥文件(.key)默认存放目录:${HOME}/.minio/certs
如果非默认的minio-user用户,需要指定证书文件位置,可以修改环境变量MINIO_OPTS的值,--certs-dir指定证书文件目录。
#启动
systemctl start minio
#开机自启
systemctl enable minio
#查看状态
systemctl status minio
浏览器访问,IP+默认端口9001,也可以通过负载均衡器对应的IP或域名访问。
账号密码为配置文件中的minio_root_user和minio_root_password
Deploy MinIO: Multi-Node Multi-Drive — MinIO Object Storage for Linux