先决条件
firewalld 配置
firewall-cmd --permanent --zone=public --add-port=9000/tcp
firewall-cmd --reload
节点说明
cat >> /etc/hosts << EOF
192.168.174.100 minio-01
192.168.174.101 minio-02
EOF
挂载点
mkdir -pv /data/disk1/minio
mkdir -pv /data/disk2/minio
mkdir -pv /data/disk3/minio
格式化磁盘
mkfs.xfs /dev/sdb
mkfs.xfs /dev/sdc
mkfs.xfs /dev/sdd
挂载磁盘
echo `blkid |grep /dev/sdb | awk '{print $2}'` /data/disk1/minio xfs defaults 0 0 >> /etc/fstab
echo `blkid |grep /dev/sdc | awk '{print $2}'` /data/disk2/minio xfs defaults 0 0 >> /etc/fstab
echo `blkid |grep /dev/sdd | awk '{print $2}'` /data/disk3/minio xfs defaults 0 0 >> /etc/fstab
mount -a
时间同步
# yum -y install chrony
创建 minio 用户
groupadd minio && useradd -M -N -g minio -d /home/minio -s /bin/false -c "minio Server" minio
chown -R minio:minio /data/disk1 /data/disk2 /data/disk3
下载 MinIO
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
sudo mv minio /usr/local/bin/
minio.service
cat > /lib/systemd/system/minio.service << EOF
[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio
[Service]
WorkingDirectory=/usr/local
User=minio-user
Group=minio-user
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=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES --certs-dir /home/minio/.minio/certs
Restart=always
LimitNOFILE=65536
TasksMax=infinity
TimeoutStopSec=infinity
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
EOF
生成配置文件
cat > /etc/default/minio << EOF
MINIO_VOLUMES="https://minio{1...2}.wgs.com:19000/data/disk{1...3}/minio"
MINIO_OPTS="--address :19000 --console-address :19001"
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minio-secret-key-CHANGE-ME # 按需修改
EOF
# chmod +x /etc/default/minio
生成 TLS 证书
openssl.conf
cat > openssl.conf << EOF
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
C = CN
ST = beijing
L = beijing
O = wgs
OU = wgs
CN = minio
[v3_req]
subjectAltName = @alt_names
[alt_names]
IP.1 = 192.168.174.100
IP.2 = 192.168.174.101
DNS.1 = minio1.wgs.com
DNS.2 = minio2.wgs.com
EOF
创建证书路径
mkdir -pv /home/minio/.minio/certs/CAs
生成 private pkcs8 key
openssl genrsa -out /home/minio/.minio/certs/private-pkcs8-key.key 2048
Generating RSA private key, 2048 bit long modulus
..............+++
..........................+++
e is 65537 (0x10001)
转成 private pkcs1 key
openssl rsa -in /home/minio/.minio/certs/private-pkcs8-key.key -out /home/minio/.minio/certs/private.key
writing RSA key
自签证书
openssl req -new -x509 -nodes -days 3650 -keyout /home/minio/.minio/certs/private.key -out /home/minio/.minio/certs/public.crt -config openssl.conf
Generating a 2048 bit RSA private key
.......+++
......................................................................................+++
writing new private key to 'private.key'
-----
验证证书
openssl x509 -in public.crt -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
b1:4b:66:a1:5a:25:74:33
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=CN, ST=beijing, L=beijing, O=wgs, OU=wgs, CN=minio
Validity
Not Before: Oct 25 12:37:37 2024 GMT
Not After : Oct 23 12:37:37 2034 GMT
Subject: C=CN, ST=beijing, L=beijing, O=wgs, OU=wgs, CN=minio
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:e9:07:27:c4:7b:bf:c5:84:03:23:c3:67:d0:ee:
0b:37:4d:a8:5f:73:97:b0:51:da:2e:20:3d:10:17:
48:19:82:79:93:ef:35:51:64:13:84:d6:48:5f:65:
51:6b:ed:28:ea:a4:4f:65:7e:68:66:61:44:e3:20:
25:f9:14:4e:ab:26:0a:66:ab:aa:8b:64:cd:2f:8a:
b1:d1:1f:ed:46:c2:04:73:b9:21:48:3e:9e:8b:93:
2a:95:06:2c:ef:13:e9:33:ba:6b:f5:94:99:01:fe:
5d:62:aa:26:e2:65:81:56:19:26:71:01:25:0f:f3:
60:78:ce:37:4b:4f:4a:14:e6:ed:89:d5:b4:4b:74:
4f:44:f4:84:f3:40:50:dd:4e:f0:71:c8:d9:4a:f9:
4a:b5:8d:30:ea:8d:86:29:52:45:7c:cf:d4:68:c0:
73:dc:04:68:dd:58:86:ce:71:24:b7:cd:c6:d1:b5:
8a:e9:13:77:81:c1:36:35:6c:3a:6b:ea:66:16:77:
cc:91:b8:0f:8a:ad:87:61:c0:e7:31:34:fc:de:0e:
af:af:fd:d0:b1:84:b3:84:dc:7e:71:2e:94:80:4e:
17:d1:c7:6b:25:40:8e:53:84:2c:4b:9b:ab:53:cd:
a3:5a:c1:26:e9:a1:8c:dd:6b:df:63:9b:0a:55:a4:
99:af
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Alternative Name:
IP Address:192.168.174.100, IP Address:192.168.174.101, DNS:minio1.wgs.com, DNS:minio2.wgs.com
Signature Algorithm: sha256WithRSAEncryption
37:67:b0:7f:69:3b:ae:51:dc:c3:df:b0:ac:8e:39:13:3b:bc:
e4:ec:0f:8e:5e:d8:fa:99:d4:3f:fc:45:bd:59:7c:1d:50:84:
39:47:61:af:b2:fa:ae:8a:36:6f:df:99:27:7b:8f:9d:a4:57:
e5:0f:c5:f6:8e:1b:a0:1b:c5:8d:d9:03:2b:c1:d1:d1:b1:14:
36:63:fa:2d:74:b8:a5:31:4a:be:db:69:1e:b7:10:b9:92:a0:
bd:72:dd:8f:cc:ca:dd:bc:ce:12:7f:9f:a6:29:8c:cd:bb:6c:
2a:1e:76:8a:6a:be:fe:3e:c1:c4:99:d2:83:2d:4d:92:1e:28:
e6:68:64:df:29:c3:9d:e5:89:b5:01:62:61:ef:f8:25:c9:65:
cb:5a:46:9e:eb:22:55:b9:a7:39:70:d7:c2:cf:fc:c2:0e:d8:
8d:65:44:2f:5a:9d:1c:ae:8d:53:79:49:ee:51:46:a1:ab:c6:
61:26:d9:ca:2e:4e:6c:86:d0:16:4c:0b:f5:6d:df:f0:3a:8a:
43:7b:65:1e:7f:db:e3:a4:13:5b:ae:96:c8:7a:89:1e:02:49:
b5:b5:5a:50:af:f9:4e:5b:d5:73:f3:e3:54:bc:80:5e:02:88:
78:38:39:43:85:7f:02:9e:5a:b8:c3:4e:dd:c6:4d:5c:6f:c6:
a9:4b:dc:d7
更改证书属主
# chown -R minio.minio /home/minio
运行 MinIO
systemctl enable minio --now
查看日志
Oct 25 20:32:51 minio2 minio[145328]: INFO: Waiting for all MinIO sub-systems to be initialize...
Oct 25 20:32:51 minio2 minio[145328]: INFO: Configured max API requests per node based on available memory: 41819
Oct 25 20:32:51 minio2 minio[145328]: INFO: All MinIO sub-systems initialized successfully in 21.250084ms
Oct 25 20:32:51 minio2 minio[145328]: INFO: IAM load(startup) finished. (duration: 3.451392ms)
Oct 25 20:32:51 minio2 minio[145328]: ---------------------------
Oct 25 20:32:51 minio2 minio[145328]: MinIO Object Storage Server
Oct 25 20:32:51 minio2 minio[145328]: Copyright: 2015-2024 MinIO, Inc.
Oct 25 20:32:51 minio2 minio[145328]: License: GNU AGPLv3 - https://www.gnu.org/licenses/agpl-3.0.html
Oct 25 20:32:51 minio2 minio[145328]: Version: RELEASE.2024-10-13T13-34-11Z (go1.22.8 linux/amd64)
Oct 25 20:32:51 minio2 minio[145328]: API: https://192.168.174.100:19000 https://127.0.0.1:19000
Oct 25 20:32:51 minio2 minio[145328]: WebUI: https://192.168.174.100:19001 https://127.0.0.1:19001
Oct 25 20:32:51 minio2 minio[145328]: Docs: https://docs.min.io
Oct 25 20:32:51 minio2 minio[145328]: ---------------------------
登录 minio dashboard
https://192.168.174.100:19001
查看节点信息
minio 客户端部署
curl https://dl.min.io/client/mc/release/linux-amd64/mc \
--create-dirs \
-o $HOME/minio-binaries/mc
chmod +x $HOME/minio-binaries/mc
export PATH=$PATH:$HOME/minio-binaries/
mc --help
参考文档
https://min.io/docs/minio/linux/operations/install-deploy-manage/deploy-minio-multi-node-multi-drive.html#
标签:25,20,minio,部署,51,节点,minio2,Oct From: https://www.cnblogs.com/wangguishe/p/18502666