shell
sudo apt install -y chrony
sudo timedatectl set-timezone Asia/Shanghai
sudo mkdir -p /app/minio/data1
sudo mkdir -p /app/minio/data2
sudo chown -R minio1:minio1 /app/minio
sudo chown -R minio2:minio2 /app/minio
wget https://dl.min.io/server/minio/release/linux-amd64/minio
sudo vi /app/minio/run.sh
shell
#!/bin/bash
export MINIO_ROOT_USER=minioadmin
export MINIO_ROOT_PASSWORD=minioadmin
/app/minio/minio server --address ":9000" --console-address ":9001" http://Server1IP:9000/app/minio/data1 http://Server1IP:9000/app/minio/data2 http://Server2IP:9000/app/minio/data1 http://Server2IP:9000/app/minio/data2 > /app/minio/minio.log 2>&1 &
替换Server1IP和Server2IP为你的两台服务器的实际IP地址。
shell
#!/bin/bash
export MINIO_ROOT_USER=minioadmin
export MINIO_ROOT_PASSWORD=minioadmin
/app/minio/minio server --address ":9000" --console-address ":9001" http://192.168.2.46:9000/app/minio/data1 http://192.168.2.46:9000/app/minio/data2 http://192.168.2.47:9000/app/minio/data1 http://192.168.2.47:9000/app/minio/data2 > /app/minio/minio.log 2>&1 &
给MinIO二进制文件和启动脚本赋予执行权限,并启动MinIO服务。
shell
sudo mv minio /app/minio/minio
sudo chmod +x /app/minio/minio
sudo chmod +x /app/minio/run.sh
sudo /app/minio/run.sh
配置防火墙:
sh
sudo ufw allow 9000/tcp
sudo ufw allow 9001/tcp
sudo ufw reload
检查minio运行状态:
shell
sudo systemctl status minio
查看错误日志:
shell
cat /app/minio/minio.log
tail -f /app/minio/minio.log
在浏览器中输入集群任意节点的IP地址和端口(例如http://Server1IP:9000),使用步骤4中设置的MINIO_ROOT_USER和MINIO_ROOT_PASSWORD登录MinIO Web界面。
账号:minioadmin
密码:minioadmin
解决错误1
minio2@minio2:~$ sudo systemctl status minio
Unit minio.service could not be found.
创建:
shell
sudo vim /etc/systemd/system/minio.service
内容:
sh
[Unit]
Description=MinIO Service
After=network.target
[Service]
WorkingDirectory=/app/minio
ExecStart=/app/minio/minio server --address ":9000" --console-address ":9001" http://192.168.2.46:9000/app/minio/data1 http://192.168.2.46:9000/app/minio/data2 http://192.168.2.47:9000/app/minio/data1 http://192.168.2.47:9000/app/minio/data2
Restart=on-failure
User=minio2
Group=minio2
[Install]
WantedBy=multi-user.target
解决错误
minio2@minio2:~$ sudo systemctl status minio
○ minio.service - MinIO Service
Loaded: loaded (/etc/systemd/system/minio.service; disabled; vendor preset: enabled)
Active: inactive (dead)
shell
sudo systemctl enable minio
sudo systemctl start minio