使用sidekick 负载均衡minio 集群

て烟熏妆下的殇ゞ 提交于 2020-04-07 02:06:40

实际上对于minio集群的lb+proxy 官方的cookbook 有解决(nginx,caddy)但是最近官方提供了一个新的基于
sidecar模式的选择-sidekick 以下是minio 集群集成sidekick 的试用

环境准备

整个环境都是基于docker运行
*docker-compose 文件

 
version: '3.7'
services:
  sidekick:
    image: dalongrong/sidekick:v0.1.8
    tty: true
    ports:
    - "80:80"
    command: --health-path=/minio/health/ready --address :80 http://minio{1...4}:9000
  gateway:
    image: minio/minio:RELEASE.2020-04-04T05-39-31Z
    command: gateway s3 http://sidekick
    environment:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
    ports:
    - "9000:9000"
  minio1:
    image: minio/minio:RELEASE.2020-04-04T05-39-31Z
    volumes:
      - data1-1:/data1
      - data1-2:/data2
    ports:
      - "9001:9000"
    environment:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
      MINIO_BROWSER: "off"
    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
  minio2:
    image: minio/minio:RELEASE.2020-04-04T05-39-31Z
    volumes:
      - data2-1:/data1
      - data2-2:/data2
    ports:
      - "9002:9000"
    environment:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
      MINIO_BROWSER: "off"
    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
  minio3:
    image: minio/minio:RELEASE.2020-04-04T05-39-31Z
    volumes:
      - data3-1:/data1
      - data3-2:/data2
    ports:
      - "9003:9000"
    environment:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
      MINIO_BROWSER: "off"
    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
  minio4:
    image: minio/minio:RELEASE.2020-04-04T05-39-31Z
    volumes:
      - data4-1:/data1
      - data4-2:/data2
    ports:
      - "9004:9000"
    environment:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
      MINIO_BROWSER: "off"
    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
volumes:
  data1-1:
  data1-2:
  data2-1:
  data2-2:
  data3-1:
  data3-2:
  data4-1:
  data4-2:
 
  • 说明
    minio 集群的部署,参考官方文档,使用了4个节点8块盘的模式,同时使用sidecar sidecar 模式代理4个minio 节点
    默认minio集群没有开启browwer ui 通过gateway 模式提供,对于数据的访问通过sidekick暴露的80 端口

  • 启动
docker-compose up -d

使用

  • 创建bucket 以及上传文件

如下

 

 

  • 访问页面

访问地址:http://localhost/apps/index.html

 

 

说明

使用sidekick给予我们使用minio以及稳定可靠的访问minio提供了新的方式,目前看到官方也在计划支持s3 兼容的cache,还是比较期待的,如果查看
了sidekick源码的话,sidekick 没有多少比较复杂的东西,可以学习下

参考资料

https://github.com/minio/sidekick
https://github.com/rongfengliang/minio-cluster-sidekick-learning

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!