Minio - 多节点多驱动器安装部署

先决条件

网络互通

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

顺序挂载本地JBOD存储

MinIO强烈建议使用XFS格式的磁盘直接挂载JBOD,以提供最佳性能。

  • 直连存储(DAS,Direct-Attached Storage)相比于网络存储(NAS、SAN、NFS),具有更显著的性能和一致性优势。
  • 使用非XFS文件系统(ext4、btrfs、zfs),往往具有较低的性能,表现出意外或不希望的行为。
  • 使用分布式MinIO部署时,RAID或相似的架构不会提供额外的弹性或可用性,反而通常会降低系统性能。

确保在部署中的所有节点有相同的磁盘类型和磁盘容量。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

  # <file system>  <mount point>  <type>  <options>         <dump>  <pass>
  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

使用相同的时间同步服务器

多节点系统必须维护时间和日期同步,以维持稳定的节点间的操作和交互。

部署分布式MinIO

1.在每个节点安装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

2.创建systemd Service文件

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

3.创建服务环境变量文件

新建环境变量文件:/etc/default/minio

MinIO使用此文件作为环境变量的源文件。所有节点都需要包含一样的环境变量文件。

默认配置文件如下,假设:

  • 此部署有一个server pool,包含了4个MinIO Server节点,节点有连续的hostname

minio1.example.com   minio3.example.com
minio2.example.com   minio4.example.com

  • 所有节点有4个本地挂载的磁盘,有连续的挂载点

/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"

4.添加TLS/SSL证书(可跳过)

x.509证书文件(.crt)和私钥文件(.key)默认存放目录:${HOME}/.minio/certs

如果非默认的minio-user用户,需要指定证书文件位置,可以修改环境变量MINIO_OPTS的值,--certs-dir指定证书文件目录。

5.启动MinIO Server进程

#启动
systemctl start minio

#开机自启
systemctl enable minio

#查看状态
systemctl status minio

6.登陆控制台

浏览器访问,IP+默认端口9001,也可以通过负载均衡器对应的IP或域名访问。

 账号密码为配置文件中的minio_root_user和minio_root_password

参考

Deploy MinIO: Multi-Node Multi-Drive — MinIO Object Storage for Linux

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值