cronicle minio s3 存储配置集成

ぃ、小莉子 提交于 2020-02-23 08:55:21

cronicle 后端存储是可配置的 ,通过使用不同的存储配置,我们可以解决多实例部署以及数据共享的问题
cronicle 的后端存储模型,设计的特别方便,包含了基于文件的,基于s3 的,同时我们也可以开发自己的
存储引擎

以下是一个集成minio s3 部署单master,多slave 实际上我们可以扩展为多master

环境准备

  • docker-compose 文件
 
version: "3"
services:  
  s3:
      image: minio/minio
      command: server /data
      ports: 
      - "9000:9000"
      environment:
      - "MINIO_ACCESS_KEY=dalongapp"
      - "MINIO_SECRET_KEY=dalongapp"
      volumes: 
      - "./data:/data" 
  cronicle:
      build: ./
      hostname: master
      image: dalongrong/cronicle
      volumes:
      - "./config.json:/opt/cronicle/conf/config.json"
      ports:
      - "3012:3012"
  cronicle2:
      build: ./
      hostname: cronicle2
      image: dalongrong/cronicle
      volumes:
      - "./config.json:/opt/cronicle/conf/config.json"
      ports:
      - "3013:3012"
  cronicle3:
      build: ./
      hostname: cronicle3
      image: dalongrong/cronicle
      volumes:
      - "./config.json:/opt/cronicle/conf/config.json"
      ports:
      - "3014:3012"
  • cronicle dockerfile
    添加了aws sdk
 
FROM node:12.10.0-stretch-slim
LABEL AUTHOR="rongfengliang"
LABEL EMAIL="1141591465@qq.com"
RUN npm config set registry https://registry.npm.taobao.org
RUN curl -s https://raw.githubusercontent.com/jhuckaby/Cronicle/master/bin/install.js | node
RUN cd /opt/cronicle && npm install aws-sdk
EXPOSE 3012
ENTRYPOINT ["tail", "-f", "/dev/null"]
 
  • 存储配置
    config.json ,以下截取部分关于存储的配置
 
"Storage": {
    "engine": "S3",
    "AWS": {
      "accessKeyId": "dalongapp", 
      "secretAccessKey": "dalongapp", 
      "region": "us-east-1",
      "correctClockSkew": true,
      "endpoint": "s3:9000",
      "sslEnabled": false,
      "s3ForcePathStyle": true,
      "maxRetries": 5,
      "httpOptions": {
        "connectTimeout": 5000,
        "timeout": 5000
      }
    },
    "S3": {
      "keyPrefix": "cronicle",
      "fileExtensions": true,
      "params": {
        "Bucket": "cronicle"
      }
    }
  }

启动&&运行

  • 启动
docker-compose up -d
  • 创建s3桶
    通过UI
  • 启动master
docker-compose exec cronicle /opt/cronicle/bin/control.sh setup
docker-compose exec cronicle /opt/cronicle/bin/control.sh start
  • s3 内容

 

 

  • 启动slave
docker-compose exec cronicle2 /opt/cronicle/bin/control.sh start
docker-compose exec cronicle3 /opt/cronicle/bin/control.sh start
  • 添加slave 节点

 

 

  • 配置一个简单的调度任务

 

 

  • 执行调度效果

 

 

说明

以上是一个简单的基于minio s3 实现的配置共享,实际上基于s3 我们可以配置cronicle 的多master

参考资料

https://github.com/jhuckaby/Cronicle
https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javascript/example_code/s3/s3_setcors.js
https://github.com/rongfengliang/cronicle-docker

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