minio单节点部署

下载minio二进制包

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

赋权并拷贝到bin目录下

chmod +x minio
mv minio /usr/local/bin/

编辑系统启动管理文件

vi /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存储目录

mkdir /mnt/data
chmod -R 755 /mnt/data

创建minio用户并对存储目录赋权

groupadd -r minio-user
useradd -M -r -g minio-user minio-user
chown minio-user:minio-user /mnt/data

根据minio的提醒挂载磁盘的话最好是使用XFS模式,然后硬盘也是最好直接挂载,不使用lvm模式,使用lvm模式对性能会产生一定影响

初始化磁盘
fdisk /dev/sdb

初始化完成后,设置分区模式为xfs
mkfs.xfs /dev/sdb1

挂载磁盘到minio存储目录
mount /dev/sdb1 /mnt/data/

配置开机自动挂载

vi /etc/fstab

#在末尾添加
/dev/sdb1 /mnt/data                             xfs     defaults        0 0

编辑minio配置文件

vi /etc/default/minio

# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server.
# This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment.
# Omit to use the default values 'minioadmin:minioadmin'.
# MinIO recommends setting non-default values as a best practice, regardless of environment

MINIO_ROOT_USER=xxxx     #web登录用户名
MINIO_ROOT_PASSWORD=xxx   #web登录密码

# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.

MINIO_VOLUMES="/mnt/data"     #数据存放目录

# MINIO_OPTS sets any additional commandline options to pass to the MinIO server.
# For example, `--console-address :9001` sets the MinIO Console listen port
MINIO_OPTS="--console-address :9001 -address :9000"      #console是web的接口   address是api接口

启动minio服务

systemctl start minio.service && systemctl enable minio.service

你可能感兴趣的:(minio单节点部署)