Due to blog transformation, a new album module is added, requiring a relatively secure file storage.
Reasons for choosing minio:
- It is more convenient to use than
fastDFS
. - It is compatible with Golang.
Structure#
- Single machine with multiple hard drives
- One master and one slave, with different hard drives
Direct docker-compose
version: '3.7'
# starts 2 docker containers running minio server instances.
# using nginx reverse proxy, load balancing, you can access
# it through port 9000.
services:
minio1:
container_name: minio1
image: minio/minio:RELEASE.2021-06-07T21-40-51Z
hostname: minio1
volumes:
- /disk1/data1:/data1
- /disk1/data2:/data2
ports:
- "29001:9000"
restart: always
environment:
MINIO_ROOT_USER: username
MINIO_ROOT_PASSWORD: password
MINIO_PROMETHEUS_AUTH_TYPE: public
command: server http://minio{1...2}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
minio2:
container_name: minio2
image: minio/minio:RELEASE.2021-06-07T21-40-51Z
hostname: minio2
volumes:
- /disk2/data1:/data1
- /disk2/data2:/data2
ports:
- "29002:9000"
restart: always
environment:
MINIO_ROOT_USER: username
MINIO_ROOT_PASSWORD: password
MINIO_PROMETHEUS_AUTH_TYPE: public
command: server http://minio{1...2}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
Then start
sudo docker-compose up --no-start
sudo docker-compose start
nginx#
nginx directly proxy_pass to two upstreams.