MinIO 单机及集群部署
一、Linux单机部署
二、Linux集群部署
简介:分布式MinIO可以将多块硬盘(分布在多台机器上)组成一个对象存储服务,从而避免了单点故障,还确保完整的数据保护,MinIO在分布式和单机模式下,所有的读写操作都遵守read-after-write模型。
1. 基础知识点
A. 数据保护是采用纠删码来防范多个节点宕机和位衰减,MinIO将对象拆分为N/2数据和N/2奇偶检验块;
B. 单机MinIO服务存在单点故障,集群至少需要4个节点,如果搭建N个节点的MinIO集群,只要用N/2节点在线服务,数据就是安全的,但至少需要N/2+1个节点来创建新的对象;
C. 存放数据目录需要是新目录,分布式MinIO节点服务器之间的间隔应小于15分钟,可以使用NYP服务来确保时间相同;
三、Linux Docker单机部署
1. 拉取镜像:docker pull minio/minio;
2. 部署文件docker-compose.yml
version: "3.8" services: # minio文件系统 minio: image: minio/minio:latest ports: - "9000:9000" volumes: - "/var/minio/data:/data" - "/var/minio/config:/root/.minio" environment: MINIO_ACCESS_KEY: "root" MINIO_SECRET_KEY: "root@123456" command: server /data
四、Linux Docker集群部署
简介:至少4台机器,扩容需要偶数台机器递增
# MinIO文件服务集群 minio-1: image: minio/minio:latest hostname: minio-1 command: server http://minio-{1...4}/export deploy: mode: global placement: constraints: - node.labels.minio-1 == true restart_policy: delay: 10s max_attempts: 10 window: 60s healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 networks: - rws-mp volumes: - minio-1-data:/export minio-2: image: minio/minio:latest hostname: minio-2 command: server http://minio-{1...4}/export deploy: mode: global placement: constraints: - node.labels.minio-2 == true networks: - rws-mp volumes: - minio-2-data:/export minio-3: image: minio/minio:latest hostname: minio-3 command: server http://minio-{1...4}/export deploy: mode: global placement: constraints: - node.labels.minio-3 == true networks: - rws-mp volumes: - minio-3-data:/export minio-4: image: minio/minio:latest hostname: minio-4 command: server http://minio-{1...4}/export deploy: mode: global placement: constraints: - node.labels.minio-4 == true networks: - rws-mp volumes: - minio-4-data:/export
五、FAQ
1. 修改密码:找到安装的minio文件路径.minio.sys/config
A. 打开config.json文件,更改access_key 和 secret_key的值即可;
B. 删除config.json和iam文件,重新设置;
可参考:MinIO分布式集群搭建