MinIO 的搭建与使用

Minio是GlusterFS创始人之一Anand Babu Periasamy发布新的开源项目。Minio兼容Amason的S3分布式对象存储项目,采用Golang实现,客户端支持Java,Python,Javacript, Golang语言。

Minio可以做为云存储的解决方案用来保存海量的图片,视频,文档。由于采用Golang实现,服务端可以工作在Windows,Linux, OS X和FreeBSD上。配置简单,基本是复制可执行程序,单行命令可以运行起来。

minio的部署非常的简单

wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
./minio server /var/minio_data/

由于minio是golang写的,部署起来比较简单,直接下载可执行二进制文件就可以执行了,看到如下输出就说明运行成功了

在centos8中最方便的还是要做成systemd服务,下面就讲解如何把minio添加到服务中

需要先创建用户 假设minio是以用户minio运行的,执行下面的命令添加minio的用户

adduser minio
chown -R minio:minio /var/minio_data/

创建配置文件
vim /etc/default/minio

MINIO_ACCESS_KEY="admin"
MINIO_SECRET_KEY="tykyadmin"
MINIO_VOLUMES="/data/minio/"
MINIO_OPTS="--address :9000"

添加服务配置文件
vim /etc/systemd/system/minio.service

[Unit]  
Description=Minio
Documentation=https://docs.minio.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
 
[Service]
WorkingDirectory=/usr/local/
 
User=minio-user
Group=minio-user
 
PermissionsStartOnly=true
 
EnvironmentFile=-/etc/default/minio
ExecStartPre=/bin/bash -c "[ -n \"${MINIO_VOLUMES}\" ] || echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\""
 
ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES
 
StandardOutput=journal
StandardError=inherit
 
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
 
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
 
# SIGTERM signal is used to stop Minio
KillSignal=SIGTERM
 
SendSIGKILL=no
 
SuccessExitStatus=0
 
[Install]
WantedBy=multi-user.target

systemctl enable minio.service #设置开机启动
systemctl daemon-reload
systemctl start minio
systemctl status minio.service
systemctl stop minio

You May Also Like