【MinIO】【CentOS】设置成服务开机启动

【MinIO】【CentOS】设置成服务开机启动

 

MinIO安装大家搜索其它博主、网站的内容即可。此文章只记录把MinIO设置成服务。并开机自启。

服务器环境为:CentOS Linux release 7.6.1810 (Core)

操作方式来源:https://github.com/minio/minio-service/tree/master/linux-systemd

 创建配置文件

新版Console页面需要指定一个端口 --console-address '0.0.0.0:9001' 哦。如果不指定。每次重启端口是随机的哦~

创建一个文件 /etc/default/minio  如果不想放此目录,请记得修改minio.service中EnvironmentFile的值哦

vim /etc/default/minio

 minio文件内容

MINIO_VOLUMES="/home/minio"
MINIO_ROOT_USER="自己设定的用户名"
MINIO_ROOT_PASSWORD="自己设定的密码,最少8位"
MINIO_OPTS="--console-address '0.0.0.0:9001'"

 创建minio.service

放在 /etc/systemd/system/ 下

 minio.service文件内容

AssertFileIsExecutable 为自己的MinIO文件所在路径

ExecStart

[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/home/minio/minio

[Service]
WorkingDirectory=/home/minio

User=root
Group=root
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=/home/minio/minio server $MINIO_OPTS $MINIO_VOLUMES

# 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})

配置为开机启动

systemctl daemon-reload 重新加载服务的配置文件
systemctl start minio  启动MinIO
systemctl status minio.service 查看MinIO状态
systemctl stop minio 关闭MinIO

systemctl disable minio.service 关闭MinIO每次开机启动

# 开启MinIO每次开机启动
systemctl enable minio.service   

重启服务器验证

inti 6
上一篇:MINIO_ACCESS_KEY and MINIO_SECRET_KEY are deprecated,Please use MINIO_ROOT_USER and MINIO_ROOT_PASSW


下一篇:从MINIO获取文件然后返回前台文件流