码迷,mamicode.com
首页 > 其他好文 > 详细

cubestore 运行试用

时间:2021-05-03 12:43:52      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:资料   line   rop   ocs   http   str   ret   ddr   test   

官方提供了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

cubestore 运行试用

标签:资料   line   rop   ocs   http   str   ret   ddr   test   

原文地址:https://www.cnblogs.com/rongfengliang/p/14724133.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!