十年匠心定制 · 商业建站与技术教学双线并行 咨询热线:400-886-1026 service@lmnt.cn
ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

麒麟系统搭建MinIO集群(多节点单硬盘)

麒麟系统搭建MinIO集群(多节点单硬盘) 搭建 MinIO 集群搭建规格多节点多硬盘 (MNMD or “Distributed”)企业级高性能对象存储多节点/驱动器级可靠性可配置容忍性可承受多达1/2的节点/驱动器损失用于AI/ML、分布式查询、分析和其他数据湖组件的主要存储可扩展到PB 级工作负载-包括存储容量和性能集群架构示例四节点以下是一个典型的四节点 MinIO 集群部署架构示例节点IP 地址存储路径节点 1192.168.1.17/moinio-data节点 2192.168.1.18/moinio-data节点 3192.168.1.19/moinio-data节点 4192.168.1.20/moinio-data一准备数据磁盘四台同时执行查看磁盘信息确定磁盘是否正确/dev/sda清理旧分区表如果没有可跳过查询出disk为/dev/sdaddif/dev/zeroof/dev/sdabs1Mcount100已经成功清除了 /dev/sda 前100MB的数据确保了磁盘头部没有任何残留分区表或文件系统签名。而且输出显示你的磁盘写入速度达到了 1.7 GB/s。清理前100MB的数据原因1. 擦除残留的分区表或文件系统签名2. 消除 GPT 备份头的干扰3. 屏蔽 LVM 或 MDADM软RAID残留新建分区使用 parted 创建 GPT 分区parted/dev/sda mklabel gpt这个提示是 parted 的一个通用提醒不是错误你可以完全忽略它。它只是在告诉你如果你改变了分区表记得检查 /etc/fstab 确保挂载配置正确以免重启后出问题。创建主分区占用整个磁盘parted/dev/sda mkpart primary0%100%让内核重新读取分区表partprobe /dev/sda格式化为 XFS带 RAID 条带对齐参数MinIO 官方强烈要求由于磁盘 I/O 大小为 1048576 字节即 1MB我们使用 -d su1024k 来对齐条带。sw 为 8 个硬盘如果不确定多少可以去修改但这个不会影响功能。mkfs.xfs-f-dsu1024k,sw8/dev/sda16. 创建挂载点并挂载mkdir/minio-datamount-onoatime /dev/sda1 /minio-data挂载noatime 是必须的优化选项noatime 是 Linux 系统挂载文件系统时的一个参数它直接关系到磁盘的性能表现。简单来说它的作用是禁止更新文件的访问时间戳。读操作变成了纯读消除了额外的 inode 写入开销从而显著提升随机读性能尤其是在高并发场景下。验证是否成功挂载df-h获取UUID并写入 fstab确保开机自动挂载blkid /dev/sda1获取UUID并写入 fstab确保开机自动挂载echoUUID你的UUID /minio-data xfs defaults,noatime,nodev 0 2/etc/fstab测试是否配置正确如果没有任何错误输出说明配置语法正确系统能识别该 UUID。如果有错误会立即报错并提示你修改。mount-a二开始部署MinIO所有操作四台都一致报错配置和账号密码开通防火墙每台端口一样重载防火墙配置#对外提供服务的防火墙firewall-cmd--permanent--zonepublic --add-port9000/tcp#管理界面防火墙firewall-cmd--permanent--zonepublic --add-port9001/tcp firewall-cmd--reload创建必要的DNS主机名映射# /etc/hosts192.168.1.20 minio-01.example.net192.168.1.19 minio-02.example.net192.168.1.18 minio-03.example.net192.168.1.17 minio-04.example.net下载对应的包地址我这里是麒麟系统是 ARM64 架构的dnf 的方式安装就下载 aarch64.rpm 的包安装因本地没网络使用 --disablerepo 跳过所有仓库最快让 dnf 只安装本地 RPM 包不检查任何远程仓库[rootlocalhost ~]# dnf install --disablerepo* minio-20250907161309.0.0-1.aarch64.rpmDependencies resolved.Package Arch Version Repository SizeInstalling: minio aarch6420250907161309.0.0-1 commandline36M Transaction SummaryInstall1Package Total size:36M Installed size:100M Is this ok[y/N]: y Downloading Packages: Running transaction check Transaction check succeeded. Running transactiontestTransactiontestsucceeded. Running transaction Preparing:1/1 Installing:minio-20250907161309.0.0-1.aarch641/1 Running scriptlet: minio-20250907161309.0.0-1.aarch641/1 Verifying:minio-20250907161309.0.0-1.aarch641/1 Installed: minio-20250907161309.0.0-1.aarch64 Complete![rootlocalhost ~]#创建 systemd 系统启动服务文件此版本自带已有可忽略vim/usr/lib/systemd/system/minio.service插入以下内容不需要修改[Unit]DescriptionMinIODocumentationhttps://minio.org.cn/docs/minio/linux/index.htmlWantsnetwork-online.targetAfternetwork-online.targetAssertFileIsExecutable/usr/local/bin/minio[Service]WorkingDirectory/usr/localUserminio-userGroupminio-userProtectProcinvisibleEnvironmentFile-/etc/default/minioExecStartPre/bin/bash-cif [ -z\${MINIO_VOLUMES}\]; then echo\Variable MINIO_VOLUMES not set in /etc/default/minio\; exit 1; fiExecStart/usr/local/bin/minio server$MINIO_OPTS$MINIO_VOLUMES# MinIO RELEASE.2023-05-04T21-44-30Z adds support for Typenotify (https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type)# This may improve systemctl setups where other services use Afterminio.server# Uncomment the line to enable the functionality# Typenotify# Let systemd restart this service alwaysRestartalways# Specifies the maximum file descriptor number that can be opened by this processLimitNOFILE65536# Specifies the maximum number of threads this process can createTasksMaxinfinity# Disable timeout logic and wait until process is stoppedTimeoutStopSecinfinitySendSIGKILLno[Install]WantedBymulti-user.target# Built for ${project.name}-${project.version} (${project.name})minio.service 文件默认以 minio-user 用户和组身份运行。 您可以使用 groupadd 和 useradd 命令创建用户和组. 以下示例创建用户、组并设置权限以访问MinIO预定用于存储的文件夹路径。 这些命令通常需要管理员 ( sudo ) 权限。groupadd-rminio-useruseradd-M-r-gminio-user minio-userchown-Rminio-user:minio-user /minio-data#实际挂载点创建配置文件也可以用ip# 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_VOLUMEShttp://minio-{1...4}.example.net:9000/minio-data# Set all MinIO server options## The following explicitly sets the MinIO控制台 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_USERminioadmin# Set the root password## Use a long, random, unique string that meets your organizations# requirements for passwords.#管理界面密码MINIO_ROOT_PASSWORDminio-secret-key-CHANGE-ME启动并开机自启打开MinIO控制台 随便一台节点从19节点登陆后随便创建一个桶然后登陆18节点出现桶和文件完成部署
返回列表