Centos7安装Minio

CentOS7安装Minio

下载

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

授权

chmod +x minio

移动

mv minio /usr/local/

创建存放数据的目录

mkdir -p /home/minio/data

启动

# 进入文件
cd /usr/local/

# 启动 默认端口9000
./minio server /home/minio/data

# 指定端口后台启动
nohup ./minio server --console-address :33806 --address 0.0.0.0:9666 /home/minio/data &

注:--console-address ":33806"是用来指定minio端口的

API: http://192.168.232.10:9000  http://127.0.0.1:9000   
RootUser: minioadmin 
RootPass: minioadmin 

Console: http://192.168.232.10:46483 http://127.0.0.1:46483  
RootUser: minioadmin 
RootPass: minioadmin 

Command-line: https://docs.min.io/docs/minio-client-quickstart-guide
   $ mc alias set myminio http://192.168.232.10:9000 minioadmin minioadmin

Documentation: https://docs.min.io

WARNING: Console endpoint is listening on a dynamic port (46483), please use --console-address ":PORT" to choose a static port.
WARNING: Detected default credentials 'minioadmin:minioadmin', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables

将Minio设置成服务

1.创建Minio用户

adduser minio-user

chown minio-user:minio-user /home/minio/data

2.建立EnvironmentFile文件

vim /etc/default/minio
#MINIO_ACCESS_KEY=minioadmin
#MINIO_SECRET_KEY=minioadmin
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=**********
MINIO_VOLUMES="/home/minio/data"
MINIO_OPTS="--console-address :33806 --address 0.0.0.0:9666"

3.在/etc/systemd/system中新建文件minio.service

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

[Service]
WorkingDirectory=/home/minio/data

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

问题处理

1.旧数据隐藏文件夹拒绝访问导致服务启动失败

[root@VM-12-14-centos default]# systemctl status minio.service
● minio.service - Minio
   Loaded: loaded (/etc/systemd/system/minio.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2021-12-13 10:34:33 CST; 3s ago
     Docs: https://docs.minio.io
  Process: 17041 ExecStart=/usr/local/minio server $MINIO_OPTS $MINIO_VOLUMES (code=exited, status=1/FAILURE)
  Process: 17039 ExecStartPre=/bin/bash -c [ -n "${MINIO_VOLUMES}" ] || echo "Variable MINIO_VOLUMES not set in /etc/default/minio" (code=exited, status=0/SUCCESS)
 Main PID: 17041 (code=exited, status=1/FAILURE)

Dec 13 10:34:32 VM-12-14-centos systemd[1]: Starting Minio...
Dec 13 10:34:32 VM-12-14-centos systemd[1]: Started Minio.
Dec 13 10:34:33 VM-12-14-centos minio[17041]: ERROR Unable to initialize backend: mkdir /home/minio/data/.minio.sys/tmp/c45f3fbb-fca5-4997-9e...n denied
Dec 13 10:34:33 VM-12-14-centos systemd[1]: minio.service: main process exited, code=exited, status=1/FAILURE
Dec 13 10:34:33 VM-12-14-centos systemd[1]: Unit minio.service entered failed state.
Dec 13 10:34:33 VM-12-14-centos systemd[1]: minio.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

ERROR Unable to initialize backend: mkdir /home/minio/data/.minio.sys/tmp/c45f3fbb-fca5-4997-9e…n denied

删除以下文件目录即可

rm -rf /home/minio/data/.minio.sys
上一篇:基于minio s3 gateway 改造业务系统支持基于webhook的文件处理


下一篇:minio扩展现有的分布式集群:扩大集群规模,增加磁盘数量