MinIO基于Linux部署

1 前言

目前使用Minio作为对象存储非常普遍,本文根据MinIO官方文档说明,进行了MinIO在Linux上的部署。

共有三种方式:

  • 单节点单磁盘:Single-Node Single-Drive
  • 单节点多磁盘:Single-Node Multi-Drive
  • 多节点多磁盘:Multi-Node Multi-Drive

同时给出了Nginx代理说明

2 单节点单磁盘(Single-Node Single-Drive)

  1. 下载minio server软件包
1
2
3
4
5
6
7
8
9
10
11
12
13
#部署方式:rpm/deb包方式部署(本文以centos为例)
#centos
[root@kuma7 ~]# wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20230131022419.0.0.x86_64.rpm -O minio.rpm
[root@kuma7 ~]# yum -y install minio.rpm
[root@kuma7 ~]# rpm -ql minio
/etc/systemd/system/minio.service
/usr/local/bin/minio

#由上面的信息可以看出,该rpm包就包含两部分:serivce unit文件和二进制程序。

#ubuntu
$ wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20230131022419.0.0_amd64.deb -O minio.deb
$ sudo dpkg -i minio.deb
  1. 创建用户与准备磁盘

    正常来说,会将整块磁盘格式化挂载以后,被minio使用;由于部署测试环境,本文将一个空目录作为minio的存储卷,并未为其准备一个单独的磁盘。

1
2
3
4
5
6
7
#创建用户: minio-user,由于service unit文件中使用该用户启用服务,因此需要创建该用户与组,并将服务所用目录的属主属组也作相应修改。
[root@kuma7 ~]# groupadd -r minio-user
[root@kuma7 ~]# useradd -M -r -g minio-user minio-user

#创建目录,并修改属主属组
[root@kuma7 ~]# mkdir /data/test1 -pv
[root@kuma7 ~]# chown minio-user:minio-user /data/test1
  1. 创建环境变量文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@kuma7 ~]# cat > /etc/default/minio <<EOF
# 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=admin
MINIO_ROOT_PASSWORD=abcd@1234

# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.

MINIO_VOLUMES="/data/test1"
MINIO_OPTS="--address 0.0.0.0:9000 --console-address 0.0.0.0:9001"

# 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"
EOF
  1. 启动服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@kuma7 ~]# systemctl enable --now minio

#端口情况
# api端口:9000,console端口:9001
[root@kuma7 ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 16749/minio
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6565/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 6957/master
tcp6 0 0 :::9000 :::* LISTEN 16749/minio
tcp6 0 0 ::1:9000 :::* LISTEN 16749/minio
tcp6 0 0 :::9001 :::* LISTEN 16749/minio
tcp6 0 0 :::22 :::* LISTEN 6565/sshd
tcp6 0 0 ::1:25 :::* LISTEN 6957/master
  1. 服务健康性检测
1
2
3
4
5
6
7
8
9
10
11
12
13
[root@kuma7 ~]# curl -I http://10.0.0.7:9000/minio/health/live
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 0
Content-Security-Policy: block-all-mixed-content
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 173F90FF09C096E8
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Date: Wed, 01 Feb 2023 02:03:31 GMT
  1. console访问测试

post-bg-minio1.png

注意:由于创建了一个bucket(kuma),因此可以看到相关信息。

3 单节点多磁盘(Single-Node Multi-Drive)

单节点多磁盘的部署方式,可提供磁盘级别的可靠性和故障域,建议将单独分区挂载到一个目录上,被minio所使用,充分利用磁盘的IO能力。

节点与磁盘数量建议

https://github.com/minio/minio/blob/master/docs/distributed/SIZING.md

由建议得知,单节点的磁盘数最少为4,因此本文中使用4块磁盘。

Erasure code sizing guide

Toy Setups

Capacity constrained environments, MinIO will work but not recommended for production.

servers drives (per node) stripe_size parity chosen (default) tolerance for reads (servers) tolerance for writes (servers)
1 1 1 0 0 0
1 4 4 2 0 0
4 1 4 2 2 1
5 1 5 2 2 2
6 1 6 3 3 2
7 1 7 3 3 3

Minimum System Configuration for Production

servers drives (per node) stripe_size parity chosen (default) tolerance for reads (servers) tolerance for writes (servers)
4 2 8 4 2 1
5 2 10 4 2 2
6 2 12 4 2 2
7 2 14 4 2 2
8 1 8 4 4 3
8 2 16 4 2 2
9 2 9 4 4 4
10 2 10 4 4 4
11 2 11 4 4 4
12 2 12 4 4 4
13 2 13 4 4 4
14 2 14 4 4 4
15 2 15 4 4 4
16 2 16 4 4 4

If one or more disks are offline at the start of a PutObject or NewMultipartUpload operation the object will have additional data
protection bits added automatically to provide the regular safety for these objects up to 50% of the number of disks.
This will allow normal write operations to take place on systems that exceed the write tolerance.

This means that in the examples above the system will always write 4 parity shards at the expense of slightly higher disk usage.

部署说明

  • minio推荐采用直连式JBOD(spanning,磁盘簇)的磁盘(raid可能会降低性能);xfs格式;

MinIO strongly recommends direct-attached JBOD arrays with XFS-formatted disks for best performance.

  • 确保磁盘类型一致(NVMe, SSD, HDD),容量相同;(minio不能区分磁盘类型,若多块磁盘的容量不同,minio以容量最小的磁盘确定其存储能力)
  • 建议将磁盘挂载写入/etc/fstab中,以保证启动顺序不变;
  • 如果磁盘类型是NFS及其他网络存储类型,minio不能保证其一致性。
  • minio强烈不建议使用rootfs的磁盘(会报错),因此需要挂载磁盘(而不能使用目录)。
  1. 下载minio server软件包
1
2
3
4
5
6
7
8
9
10
11
12
13
#部署方式:rpm/deb包方式部署(本文以centos为例)
#centos
[root@kuma7 ~]# wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20230131022419.0.0.x86_64.rpm -O minio.rpm
[root@kuma7 ~]# yum -y install minio.rpm
[root@kuma7 ~]# rpm -ql minio
/etc/systemd/system/minio.service
/usr/local/bin/minio

#由上面的信息可以看出,该rpm包就包含两部分:serivce unit文件和二进制程序。

#ubuntu
$ wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20230131022419.0.0_amd64.deb -O minio.deb
$ sudo dpkg -i minio.deb
  1. 创建用户与准备磁盘

    创建用户:minio-user,由于service unit文件中使用该用户启用服务,因此需要创建该用户与组,并将服务所用目录的属主属组也作相应修改。

1
2
[root@kuma7 ~]# groupadd -r minio-user
[root@kuma7 ~]# useradd -M -r -g minio-user minio-user

​ 挂载磁盘:准备4块磁盘,分别将其挂载到/minio/disk{1,2,3,4}下,文件系统格式为xfs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
[root@kuma7 ~]# mkdir /minio/disk{1,2,3,4} -pv
[root@kuma7 ~]# chown -R minio-user:minio-user /minio

#磁盘分区、格式化文件系统、挂载
# 共有/dev/sdb、/dev/sdc、/dev/sdd、/dev/sde共四块磁盘
[root@kuma7 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 256M 0 part /boot
└─sda2 8:2 0 49.8G 0 part
├─centos-root 253:0 0 47.8G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
sdc 8:32 0 50G 0 disk
sdd 8:48 0 50G 0 disk
sde 8:64 0 50G 0 disk
sr0 11:0 1 1024M 0 rom

#分区
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sdb
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sdc
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sdd
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sde

#格式化文件系统
[root@kuma7 ~]# mkfs.xfs /dev/sdb1
[root@kuma7 ~]# mkfs.xfs /dev/sdc1
[root@kuma7 ~]# mkfs.xfs /dev/sdd1
[root@kuma7 ~]# mkfs.xfs /dev/sde1

#磁盘挂载持久化到/etc/fstab
[root@kuma7 ~]# echo "/dev/sdb1 /minio/disk1 xfs defaults,noatime 0 0" >> /etc/fstab
[root@kuma7 ~]# echo "/dev/sdc1 /minio/disk2 xfs defaults,noatime 0 0" >> /etc/fstab
[root@kuma7 ~]# echo "/dev/sdd1 /minio/disk3 xfs defaults,noatime 0 0" >> /etc/fstab
[root@kuma7 ~]# echo "/dev/sde1 /minio/disk4 xfs defaults,noatime 0 0" >> /etc/fstab

#磁盘挂载
[root@kuma7 ~]# mount -a

#查看
[root@kuma7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 48G 2.0G 46G 5% /
devtmpfs 898M 0 898M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 9.6M 901M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda1 253M 127M 127M 50% /boot
tmpfs 182M 0 182M 0% /run/user/0
/dev/sdb1 50G 33M 50G 1% /minio/disk1
/dev/sdc1 50G 33M 50G 1% /minio/disk2
/dev/sdd1 50G 33M 50G 1% /minio/disk3
/dev/sde1 50G 33M 50G 1% /minio/disk4
  1. 创建环境变量文件
1
2
3
4
5
6
[root@kuma7 ~]# cat > /etc/default/minio <<EOF
MINIO_ROOT_USER=admin
MINIO_ROOT_PASSWORD=abcd@1234
MINIO_VOLUMES="/minio/disk1 /minio/disk2 /minio/disk3 /minio/disk4"
MINIO_OPTS="--address 0.0.0.0:9000 --console-address 0.0.0.0:9001"
EOF
  1. 启动服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@kuma7 ~]# systemctl enable --now minio

#端口情况
# api端口:9000,console端口:9001
[root@kuma7 ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 16749/minio
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6565/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 6957/master
tcp6 0 0 :::9000 :::* LISTEN 16749/minio
tcp6 0 0 ::1:9000 :::* LISTEN 16749/minio
tcp6 0 0 :::9001 :::* LISTEN 16749/minio
tcp6 0 0 :::22 :::* LISTEN 6565/sshd
tcp6 0 0 ::1:25 :::* LISTEN 6957/master
  1. 服务健康性检测
1
2
3
4
5
6
7
8
9
10
11
12
13
[root@kuma7 ~]# curl -I http://10.0.0.7:9000/minio/health/live
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 0
Content-Security-Policy: block-all-mixed-content
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 173F90FF09C096E8
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Date: Wed, 01 Feb 2023 02:03:31 GMT
  1. console访问测试

post-bg-minio2.png

4 多节点多磁盘(Multi-Node Multi-Drive)

可提供企业级性能、可靠性、可扩展性,生产环境推荐

采用纠删码机制保证高可靠性,可容忍一半的节点或磁盘的丢失。

所有minio server必须使用相同的监听端口(9000)。(防火墙放开相关权限)

推荐使用负载均衡(nginx、haproxy)代理minio的访问,推荐算法:Least Connections(最少连接)。

磁盘相关:

  • minio推荐采用直连式JBOD(spanning,磁盘簇)的磁盘(raid可能会降低性能);xfs格式;

MinIO strongly recommends direct-attached JBOD arrays with XFS-formatted disks for best performance.

  • 确保磁盘类型一致(NVMe, SSD, HDD),容量相同;(minio不能区分磁盘类型,若多块磁盘的容量不同,minio以容量最小的磁盘确定其存储能力)
  • 建议将磁盘挂载写入/etc/fstab中,以保证启动顺序不变;
  • 如果磁盘类型是NFS及其他网络存储类型,minio不能保证其一致性。
  • minio强烈不建议使用rootfs的磁盘(会报错),因此需要挂载磁盘(而不能使用目录)。

节点与磁盘数:

4节点,每个节点4块磁盘

1
2
3
4
10.0.0.7		/dev/sdb、/dev/sdc、/dev/sdd、/dev/sde
10.0.0.17 /dev/sdb、/dev/sdc、/dev/sdd、/dev/sde
10.0.0.27 /dev/sdb、/dev/sdc、/dev/sdd、/dev/sde
10.0.0.37 /dev/sdb、/dev/sdc、/dev/sdd、/dev/sde
  1. 下载minio server软件包(所有节点
1
2
3
4
5
6
7
8
9
10
11
12
13
#部署方式:rpm/deb包方式部署(本文以centos为例)
#centos
[root@kuma7 ~]# wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio-20230131022419.0.0.x86_64.rpm -O minio.rpm
[root@kuma7 ~]# yum -y install minio.rpm
[root@kuma7 ~]# rpm -ql minio
/etc/systemd/system/minio.service
/usr/local/bin/minio

#由上面的信息可以看出,该rpm包就包含两部分:serivce unit文件和二进制程序。

#ubuntu
$ wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20230131022419.0.0_amd64.deb -O minio.deb
$ sudo dpkg -i minio.deb
  1. 创建用户与准备磁盘(所有节点

    创建用户:minio-user,由于service unit文件中使用该用户启用服务,因此需要创建该用户与组,并将服务所用目录的属主属组也作相应修改。

1
2
[root@kuma7 ~]# groupadd -r minio-user
[root@kuma7 ~]# useradd -M -r -g minio-user minio-user

​ 挂载磁盘:准备4块磁盘,分别将其挂载到/minio/disk{1,2,3,4}下,文件系统格式为xfs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[root@kuma7 ~]# mkdir /minio/disk{1,2,3,4} -pv
[root@kuma7 ~]# chown -R minio-user:minio-user /minio

#磁盘分区、格式化文件系统、挂载
# 共有/dev/sdb、/dev/sdc、/dev/sdd、/dev/sde共四块磁盘
[root@kuma7 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 256M 0 part /boot
└─sda2 8:2 0 49.8G 0 part
├─centos-root 253:0 0 47.8G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 50G 0 disk
sdc 8:32 0 50G 0 disk
sdd 8:48 0 50G 0 disk
sde 8:64 0 50G 0 disk
sr0 11:0 1 1024M 0 rom

#分区
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sdb
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sdc
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sdd
[root@kuma7 ~]# echo -e 'n\n\n\n\n\nw\n' | fdisk /dev/sde

#格式化文件系统
[root@kuma7 ~]# mkfs.xfs /dev/sdb1
[root@kuma7 ~]# mkfs.xfs /dev/sdc1
[root@kuma7 ~]# mkfs.xfs /dev/sdd1
[root@kuma7 ~]# mkfs.xfs /dev/sde1

#磁盘挂载持久化到/etc/fstab
[root@kuma7 ~]# echo "/dev/sdb1 /minio/disk1 xfs defaults,noatime 0 0" >> /etc/fstab
[root@kuma7 ~]# echo "/dev/sdc1 /minio/disk2 xfs defaults,noatime 0 0" >> /etc/fstab
[root@kuma7 ~]# echo "/dev/sdd1 /minio/disk3 xfs defaults,noatime 0 0" >> /etc/fstab
[root@kuma7 ~]# echo "/dev/sde1 /minio/disk4 xfs defaults,noatime 0 0" >> /etc/fstab

#磁盘挂载
[root@kuma7 ~]# mount -a

#查看
[root@kuma7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 48G 2.0G 46G 5% /
devtmpfs 898M 0 898M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 9.6M 901M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda1 253M 127M 127M 50% /boot
tmpfs 182M 0 182M 0% /run/user/0
/dev/sdb1 50G 33M 50G 1% /minio/disk1
/dev/sdc1 50G 33M 50G 1% /minio/disk2
/dev/sdd1 50G 33M 50G 1% /minio/disk3
/dev/sde1 50G 33M 50G 1% /minio/disk4

#修改权限(磁盘挂载后,属主属组变为了root:root)
[root@kuma7 ~]# chown -R minio-user:minio-user /minio
  1. 创建环境变量文件(所有节点
1
2
3
4
5
6
[root@kuma7 ~]# cat > /etc/default/minio <<EOF
MINIO_ROOT_USER=admin
MINIO_ROOT_PASSWORD=abcd@1234
MINIO_VOLUMES="http://10.0.0.7:9000/minio/disk1 http://10.0.0.7:9000/minio/disk2 http://10.0.0.7:9000/minio/disk3 http://10.0.0.7:9000/minio/disk4 http://10.0.0.17:9000/minio/disk1 http://10.0.0.17:9000/minio/disk2 http://10.0.0.17:9000/minio/disk3 http://10.0.0.17:9000/minio/disk4 http://10.0.0.27:9000/minio/disk1 http://10.0.0.27:9000/minio/disk2 http://10.0.0.27:9000/minio/disk3 http://10.0.0.27:9000/minio/disk4 http://10.0.0.37:9000/minio/disk1 http://10.0.0.37:9000/minio/disk2 http://10.0.0.37:9000/minio/disk3 http://10.0.0.37:9000/minio/disk4"
MINIO_OPTS="--address 0.0.0.0:9000 --console-address 0.0.0.0:9001"
EOF
  1. 启动服务(所有节点
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@kuma7 ~]# systemctl enable --now minio

#端口情况
# api端口:9000,console端口:9001
[root@kuma7 ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 16749/minio
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6565/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 6957/master
tcp6 0 0 :::9000 :::* LISTEN 16749/minio
tcp6 0 0 ::1:9000 :::* LISTEN 16749/minio
tcp6 0 0 :::9001 :::* LISTEN 16749/minio
tcp6 0 0 :::22 :::* LISTEN 6565/sshd
tcp6 0 0 ::1:25 :::* LISTEN 6957/master
  1. 服务健康性检测(所有节点
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
[root@kuma37 ~]# curl -I http://10.0.0.7:9000/minio/health/live
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 0
Content-Security-Policy: block-all-mixed-content
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 17412DA5BDCAD063
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Date: Mon, 06 Feb 2023 08:05:26 GMT

[root@kuma37 ~]# curl -I http://10.0.0.17:9000/minio/health/live
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 0
Content-Security-Policy: block-all-mixed-content
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 17412DA6A322DED5
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Date: Mon, 06 Feb 2023 08:05:30 GMT

[root@kuma37 ~]# curl -I http://10.0.0.27:9000/minio/health/live
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 0
Content-Security-Policy: block-all-mixed-content
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 17412DA7A5AC6923
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Date: Mon, 06 Feb 2023 08:05:34 GMT

[root@kuma37 ~]# curl -I http://10.0.0.37:9000/minio/health/live
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 0
Content-Security-Policy: block-all-mixed-content
Server: MinIO
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Amz-Id-2: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Request-Id: 17412DA86997C01C
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block
Date: Mon, 06 Feb 2023 08:05:37 GMT
  1. console访问测试

post-bg-minio3.png

5 nginx代理minio server

对于Api来说,主要有两种方式:

1)根代理:代理层(nginx)为minio提供单独的端口或域名,将/代理到minio;

2)桶代理:如果nginx不能为minio提供单独的域名或者端口时,可以将bucket单独代理出去;

对于console来说,直接将9001通过uri代理即可(略)。

根代理

官方提供的示例配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
server {
listen 80;
server_name example.com;

# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 0;
# To disable buffering
proxy_buffering off;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;

proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;

proxy_pass http://localhost:9000; # If you are using docker-compose this would be the hostname i.e. minio
# Health Check endpoint might go here. See https://www.nginx.com/resources/wiki/modules/healthcheck/
# /minio/health/live;
}
}

桶(bucket)代理

示例配置文件:bucket名为:myBucket

1
2
3
4
5
6
7
8
9
10
11
12
13
location /myBucket {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;

proxy_connect_timeout 300;
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;

proxy_pass http://10.0.0.20:9000;
}

6 参考文档

1.https://min.io/docs/minio/linux/operations/installation.html


MinIO基于Linux部署
https://ikuma.top/2024/08/02/MinIO基于Linux部署/
作者
Kuma
发布于
2024年8月2日
许可协议