ansible+docker+docker-compose快速部署4节点高可用minio集群

目录

github项目地址

示例服务器列表

安装前

修改变量文件group_vars/all.yml

修改ansible主机清单

修改setup.sh安装脚本

用法演示

安装后验证

github项目地址

https://github.com/sulibao/ansible_minio_cluster.git

示例服务器列表

安装前

修改变量文件group_vars/all.yml

bash 复制代码
docker_data_dir: /app/docker_data   #docker数据存储目录
minio_data: /app/minio_data    #minio数据存储目录
minio_port: 9000              #minio页面端口
minio_console_port: 9001      #minio-console端口
image_minio: "registry.cn-chengdu.aliyuncs.com/su03/minio:RELEASE.2024-05-28T17-19-04Z"
# minio镜像
minio_ak: "admin"    #minio-ak
minio_sk: "admin@2025"   #minio-sk

修改ansible主机清单

bash 复制代码
[minio01]  #以下分别填写用于部署minio的4个节点IP地址
192.168.2.190
[minio_others01]
192.168.2.191
[minio_others02]
192.168.2.192
[minio_others03]
192.168.2.193

修改setup.sh安装脚本

bash 复制代码
vim setup.sh
export ssh_pass="sulibao"     #此项应为服务器root用户密码

用法演示

bash 复制代码
bash setup.sh

安装后验证

  • 命令行验证
bash 复制代码
docker exec -it minio_data-minio-1 bash   #进入任意一个节点任意一个minio容器
bash-5.1# mc alias set mycluster http://test1:9000 admin admin@2025   #为任意一个节点设置别名
mc: Configuration written to `/tmp/.mc/config.json`. Please update your access credentials.
mc: Successfully created `/tmp/.mc/share`.
mc: Initialized share uploads `/tmp/.mc/share/uploads.json` file.
mc: Initialized share downloads `/tmp/.mc/share/downloads.json` file.
Added `mycluster` successfully. 
bash-5.1# mc admin info mycluster    #查看集群状态,以下为正常4副本online状态
●  test1:9000
   Uptime: 16 minutes 
   Version: 2024-05-28T17:19:04Z
   Network: 4/4 OK 
   Drives: 1/1 OK 
   Pool: 1

●  test2:9000
   Uptime: 20 minutes 
   Version: 2024-05-28T17:19:04Z
   Network: 4/4 OK 
   Drives: 1/1 OK 
   Pool: 1

●  test3:9000
   Uptime: 54 seconds 
   Version: 2024-05-28T17:19:04Z
   Network: 4/4 OK 
   Drives: 1/1 OK 
   Pool: 1

●  test4:9000
   Uptime: 20 minutes 
   Version: 2024-05-28T17:19:04Z
   Network: 4/4 OK 
   Drives: 1/1 OK 
   Pool: 1

┌──────┬───────────────────────┬─────────────────────┬──────────────┐
│ Pool │ Drives Usage          │ Erasure stripe size │ Erasure sets │
│ 1st  │ 0.5% (total: 200 GiB) │ 4                   │ 1            │
└──────┴───────────────────────┴─────────────────────┴──────────────┘

4 drives online, 0 drives offline, EC:2
  • 页面上传文件验证数据目录是否同步
bash 复制代码
[root@test1 app]# ll minio_data/test/
total 0
drwxr-xr-x 2 root root 21 Apr  7 22:41 制作tomcat镜像.md
[root@test2 app]# ll minio_data/test/
total 0
drwxr-xr-x 2 root root 21 Apr  7 22:41 制作tomcat镜像.md
[root@test3 app]# ll minio_data/test/
total 0
drwxr-xr-x 2 root root 21 Apr  7 22:41 制作tomcat镜像.md
[root@test4 app]# ll minio_data/test/
total 0
drwxr-xr-x 2 root root 21 Apr  7 22:41 制作tomcat镜像.md
相关推荐
csdn_aspnet1 小时前
使用 Docker 配置 PostgreSQL 和 pgAdmin 4
数据库·docker·postgresql·pgadmin4
Maiko Star2 小时前
Docker保姆级部署AI应用程序(FastAPI)
docker·容器·fastapi
A-刘晨阳17 小时前
Kubernetes 查询证书有效期及续签证书(适用于二进制部署)
云原生·容器·kubernetes·证书·cfssl
`Levie1 天前
Docker-安装部署、容器管理(一)
docker·容器·eureka
Diligently_1 天前
第 08 篇|单机部署:本地安装与 Docker 最佳实践
运维·spring boot·docker
FungLeo2 天前
FengCMS·PHP+MySQL 升级实录 ·本地容器环境设计:只读挂载、LOCAL_UID、数据卷权限
开发语言·mysql·docker·php·fengcms
飞奔的瓜牛2 天前
Ansible 实战:典型使用场景、Playbook 编写与 Python 调用接口详解
python·servlet·ansible
Diligently_2 天前
第 05 篇|慢查询优化实战 —— 一条 SQL 的重构全过程
容器
cpolar技术支持3 天前
用一份 YAML 画出家里的网络拓扑:哪个口通公网、哪几个容器藏在内网,一张图摊开,再用 cpolar 在外网随时翻这份图
docker·网络拓扑·内网穿透·cpolar·yaml
赤生云电竞3 天前
算力调度系统架构实践:计费、配额与抢占策略设计——面向Kubernetes GPU集群的多租户治理
容器·系统架构·kubernetes