cubestore 运行试用

官方提供了docker-compose 的运行模式

环境准备

  • docker-compose 文件
version: "3"
services:
  cubestore_router:
    restart: always
    image: cubejs/cubestore:latest
    environment:
      - CUBESTORE_LOG_LEVEL=trace
      - CUBESTORE_SERVER_NAME=cubestore_router:9999
      - CUBESTORE_META_PORT=9999
      - CUBESTORE_WORKERS=cubestore_worker_1:9001,cubestore_worker_2:9001
      - CUBESTORE_REMOTE_DIR=/cube/data
    ports: 
    - "9999:9999"
    - "3030:3030"
    - "3306:3306"
    expose:
      - 9999 # This exposes the Metastore endpoint
      - 3030 # This exposes the HTTP endpoint for CubeJS
      - 3306
    volumes:
      - .cubestore:/cube/data
  cubestore_worker_1:
    restart: always
    image: cubejs/cubestore:latest
    environment:
      - CUBESTORE_SERVER_NAME=cubestore_worker_1:9001
      - CUBESTORE_WORKER_PORT=9001
      - CUBESTORE_META_ADDR=cubestore_router:9999
      - CUBESTORE_REMOTE_DIR=/cube/data
    depends_on:
      - cubestore_router
    expose:
      - 9001
    volumes:
      - .cubestore:/cube/data
  cubestore_worker_2:
    restart: always
    image: cubejs/cubestore:latest
    environment:
      - CUBESTORE_SERVER_NAME=cubestore_worker_2:9001
      - CUBESTORE_WORKER_PORT=9001
      - CUBESTORE_META_ADDR=cubestore_router:9999
      - CUBESTORE_REMOTE_DIR=/cube/data
    depends_on:
      - cubestore_router
    expose:
      - 9001
    volumes:
      - .cubestore:/cube/data

cube app 集成

主要是环境变量的配置

  • env
CUBEJS_DB_HOST=<host>
CUBEJS_DB_PORT=<port>
CUBEJS_DB_NAME=<db>
CUBEJS_DB_USER=<user>
CUBEJS_DB_PASS=<pass>
CUBEJS_WEB_SOCKETS=true
CUBEJS_DEV_MODE=true
CUBEJS_EXT_DB_HOST=localhost
CUBEJS_EXT_DB_PORT=3030
CUBEJS_EXT_DB_NAME=demoapp
CUBEJS_EXT_DB_TYPE=cubestore
CUBEJS_DB_TYPE=postgres
CUBEJS_API_SECRET=f2e81fe4b53200faac37bfe66d0be5b8a859e69c77c8f55134c5dd3afad5bab72fef5e346766ba485619ea0a5d8e577df5b4964a4b6b716162a72f590dd8c181
  • 效果

 

 

代码集成

使用mysql 连接cubestore

var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : 'localhost',
  database : 'demoapp'
});
 
connection.connect();
 //  此处table 需要调整
connection.query('select * from dev_pre_aggregations.oc_order_main_tyccmc1j_dfnarpsv_1g8ppb2', function (error, results, fields) {
  if (error) throw error;
  console.log('The solution is: ', results);
});
 
connection.end();

说明

经过测试效果还是很明显的

参考资料

https://cube.dev/docs/pre-aggregations
https://cube.dev/docs/caching/using-pre-aggregations#running-in-production
https://cube.dev/blog/introducing-cubestore/
https://github.com/rongfengliang/cubestore-learning

posted on   荣锋亮  阅读(165)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-05-01 lightproxy 阿里巴巴开源的基于proxy 的web debug 工具
2020-05-01 chartjs-plugin-datasource-prometheus 展示prometheus 数据
2020-05-01 Autopilot Pattern Applications 开发模式
2020-05-01 containerpilot 容器应用的自动服务发现
2019-05-01 cube.js 学习(二)cube.js与 graphql2chartjs的比较
2019-05-01 cube.js 学习(一)简单项目创建
2019-05-01 cube.js 开源模块化分析框架

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示