参考地址
https://min.io/docs/minio/linux/operations/install-deploy-manage/deploy-minio-single-node-single-drive.html
下载Minio
[root@localhost ~]# wget https://dl.minio.io/server/minio/release/linux-amd64/minio
设置权限
[root@localhost ~]# chmod +x
复制目录
[root@localhost ~]# sudo mv minio /home/minio/bin/
创建服务
[root@localhost ~]# cd /etc/systemd/system/
[root@localhost system]# touch minio.service
[root@localhost system]# vim minio.service
配置内容:
[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/home/minio/bin/minio
[Service]
WorkingDirectory=/home/minio
User=minio-user
Group=minio-user
ProtectProc=invisible
EnvironmentFile=-/home/minio/conf/minio
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /home/minio/conf/minio\"; exit 1; fi"
ExecStart=/home/minio/bin/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})
创建用户
[root@localhost system]# groupadd -r minio-user
[root@localhost system]# useradd -M -r -g minio-user minio-user
[root@localhost system]# chown minio-user:minio-user /home/minio
创建配置文件
[root@localhost system]# cd /home/minio/conf/
[root@localhost system]# touch minio
[root@localhost system]# vim 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=ucdMinio
MINIO_ROOT_PASSWORD=ucd@Minio
# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.
MINIO_VOLUMES="/home/minio/data"
MINIO_OPTS="--address 192.168.18.100:11000 --console-address 192.168.18.100:10081"
# MINIO_SERVER_URL sets the hostname of the local machine for use with the MinIO Server
# MinIO assumes your network control plane can correctly resolve this hostname to the local machine
# Uncomment the following line and replace the value with the correct hostname for the local machine.
#MINIO_SERVER_URL="http://minio.example.net"
启动服务
[root@localhost system]# sudo systemctl start minio.service
[root@localhost system]# sudo systemctl status minio.service
[root@localhost system]# journalctl -f -u minio.service
启动成功后journalctl输出应类似于以下内容:
Status: 1 Online, 0 Offline.
API: http://192.168.2.100:9000 http://127.0.0.1:9000
RootUser: myminioadmin
RootPass: minio-secret-key-change-me
Console: http://192.168.2.100:9090 http://127.0.0.1:9090
RootUser: myminioadmin
RootPass: minio-secret-key-change-me
Command-line: https://min.io/docs/minio/linux/reference/minio-mc.html
$ mc alias set myminio http://10.0.2.100:9000 myminioadmin minio-secret-key-change-me
Documentation: https://min.io/docs/minio/linux/index.html
Minio双机实时备份
新建备份服务
步骤参考上面的安装流程
主服务操作
添加备份服务
[root@localhost system]# ./mc config host add minio2 http://192.168.0.2:9000 AccessKeyId SecretAccessKey --api s3v4
启动监控进程复制文件
# /usr/local/minio/data/ 是你当前minio服务器文件存储的路径 minio2/是远程minio服务器
[root@localhost ~]# nohup ./mc mirror --exclude ".*" --exclude "*.temp" --force --remove --watch /home/minio/data/ minio2/ &
说明:
- 添加监控复制 --force 强制覆盖已经存在的目标,--fake 模拟一个假的操作,--watch, -w 监听改变并执行镜像操作,--remove 删除目标上的外部的文件
- 采用后台启动监听,把当前服务器minio下文件备份到2服务器 除了.minio.sys这个文件夹,不然会卡在报错无法复制
评论区