// 未分类
Docker部署Minio主从实例
发布 2021-06-15 · 永久链接
本博客相册运行在其之上
由于博客改造,新增相册模块,需要一个相对安全的文件存储。
选择minio的原因
1. 因为比`fastDFS`用起来方便点
2. 和Golang相性很好
### 结构
- 单机多硬盘
- 一主一从,不同硬盘
直接docker-compose
``` yaml
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:
- /硬盘1/data1:/data1
- /硬盘1/data2:/data2
ports:
- "29001:9000"
restart: always
environment:
MINIO_ROOT_USER: 账号
MINIO_ROOT_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:
- /硬盘2/data1:/data1
- /硬盘2/data2:/data2
ports:
- "29002:9000"
restart: always
environment:
MINIO_ROOT_USER: 账号
MINIO_ROOT_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
```
然后启动
``` bash
sudo docker-compose up --no-start
sudo docker-compose start
```
## nginx
nginx 直接proxy_pass两个upstream即可