单机docker-compose部署minio过程
更新时间:2024年10月31日 08:50:04 作者:摇曳的精灵
简述通过Docker-Compose在单机上挂载多硬盘实现MinIO多副本部署的方法,包括配置docker-compose.yaml和nginx.conf等关键步骤,适合服务器资源有限的场景
单机多副本docker-compose部署minio
简单介绍
如果服务器有限可以单机挂载多硬盘实现多副本容错(生产不推荐)
- 部署好的文件状态
有两个重要文件 docker-compose.yaml和nginx.conf
docker-compose.yaml是docker部署容器的配置信息包括4个minio和1个nginx容器
- 部署好的状态
操作步骤
安装docker
yum install docker
安装docker-compose
curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
放置配置docker-compose.yaml文件和nginx.conf
mkdir /home/minios/ #创建文件夹
运行docker-compose.yaml
systemctl enable docker systemctl start docker systemctl status docker docker-compose -f docker-compose.yaml up -d docker images #查看docker服务镜像 docker ps #正在运行的docker容器 docker ps -a #全部的docker容器 docker logs --tail 100 容器ID #查看容器日志信息 telnet 127.0.0.1 9000检查是否成功
创建文件桶
docker-compose.yaml
version: '3.3' # starts 4 docker containers running minio server instances. # using nginx reverse proxy, load balancing, you can access # it through port 9000. services: minio1: image: minio/minio:RELEASE.2021-04-22T15-44-28Z volumes: - ./data1-1:/data1 - ./data1-2:/data2 expose: - "9000" environment: MINIO_ROOT_USER: minio MINIO_ROOT_PASSWORD: minio123 command: server http://minio{1...4}/data{1...2} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 networks: - fjjminio restart: always minio2: image: minio/minio:RELEASE.2021-04-22T15-44-28Z volumes: - ./data2-1:/data1 - ./data2-2:/data2 expose: - "9000" environment: MINIO_ROOT_USER: minio MINIO_ROOT_PASSWORD: minio123 command: server http://minio{1...4}/data{1...2} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 networks: - fjjminio restart: always minio3: image: minio/minio:RELEASE.2021-04-22T15-44-28Z volumes: - ./data3-1:/data1 - ./data3-2:/data2 expose: - "9000" environment: MINIO_ROOT_USER: minio MINIO_ROOT_PASSWORD: minio123 command: server http://minio{1...4}/data{1...2} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 networks: - fjjminio restart: always minio4: image: minio/minio:RELEASE.2021-04-22T15-44-28Z volumes: - ./data4-1:/data1 - ./data4-2:/data2 expose: - "9000" environment: MINIO_ROOT_USER: minio MINIO_ROOT_PASSWORD: minio123 command: server http://minio{1...4}/data{1...2} healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 networks: - fjjminio restart: always nginx: image: nginx:1.19.2-alpine volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro ports: - "9000:9000" depends_on: - minio1 - minio2 - minio3 - minio4 networks: - fjjminio restart: always networks: fjjminio:
nginx.conf
user nginx; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; # include /etc/nginx/conf.d/*.conf; upstream minio { ip_hash; server minio1:9000; server minio2:9000; server minio3:9000; server minio4:9000; } server { listen 9000; listen [::]:9000; server_name localhost; # 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 50m; # To disable buffering proxy_buffering off; location / { proxy_set_header Host $http_host; 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_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://minio; } } }
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
相关文章
docker 部署 Elasticsearch kibana及ik分词器详解
这篇文章主要介绍了docker 部署 Elasticsearch kibana及ik分词器详解,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2021-05-05docker如何安装带postgis插件的postgresql数据库
这篇文章主要介绍了docker如何安装带postgis插件的postgresql数据库问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教2023-12-12Docker容器的调试技巧之docker logs与docker service logs
这篇文章主要介绍了Docker容器的调试技巧之docker logs与docker service logs,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教2024-01-01
最新评论