@cubejs-backend/cubestore

中文文档
1.8.21发布于 2026/11/10Apache-2.0TypeScriptCommonJS构建来源已验证近 30 天下载 28.7万

Cube pre-aggregation storage layer.

原始使用文档
文档目录11 节
  1. Motivation
  2. Approach
  3. Plans
  4. Supported architectures and platforms
  5. Usage
  6. With Cube
  7. With Docker
  8. With Docker Compose
  9. Build
  10. Development
  11. License

Cube

Website • Docs • Examples • Blog • Slack • Twitter

npm version GitHub Actions FOSSA Status

Cube Store

Cube pre-aggregation storage layer.

Motivation

Over the past year, we've accumulated feedback around various use-cases with pre-aggregations and how to store them. We've learned that there are a set of problems where relational databases as a storage layer has significant performance and functionality issues.

These problems include:

  • Performance issues with high cardinality rollups (1B and more)
  • Lack of HyperLogLog support
  • Degraded performance for big UNION ALL queries
  • Poor JOIN performance across rolled up tables
  • Table/schema name length issues across different database types
  • SQL type differences between source and external database

Over time, we realized that if we try to fix these issues with existing database engines, we'd end up modifying these databases' codebases in one way or another.

We decided to take another approach and write our own materialized OLAP cache store, designed solely to store and serve rollup tables at scale.

Approach

To optimize performance as much as possible, we went with a native approach and are using Rust to develop Cube Store, utilizing a set of technologies like RocksDB, Apache Parquet, and Arrow that have proven effectiveness in solving data access problems.

Cube Store is fully open-sourced and released under the Apache 2.0 license.

Plans

We intend to start distributing Cube Store with Cube, and eventually make Cube Store the default pre-aggregation storage layer for Cube. Support for MySQL and Postgres as external databases will continue, but at a lower priority.

We'll also update all documentation regarding pre-aggregations and include usage and deployment instructions for Cube Store.

Supported architectures and platforms

If your platform/architecture is not supported, you can launch Cube Store using Docker.

linux-gnulinux-musldarwinwin32
x86N/AN/AN/AN/A
x86_64✅✅✅✅
arm64✅✅[1]

[1] It can be launched using Rosetta 2 via the x86_64-apple binary.

Usage

With Cube

Starting with v0.26.48, Cube ships with Cube Store enabled when CUBEJS_DEV_MODE=true. You don't need to set up any CUBEJS_EXT_DB_* environment variables or externalDriverFactory inside your cube.js configuration file.

For versions prior to v0.26.48, you should upgrade your project to the latest version and install the Cube Store driver:

yarn add @cubejs-backend/cubestore-driver

After starting up, Cube will print a message:

🔥 Cube Store (0.26.64) is assigned to 3030 port.

With Docker

Start Cube Store in a Docker container and bind port 3030 to 127.0.0.1:

docker run -d -p 3030:3030 cubejs/cubestore:edge

Configure Cube to use the above connection for an external database via the .env file:

CUBEJS_EXT_DB_TYPE=cubestore
CUBEJS_EXT_DB_HOST=127.0.0.1

With Docker Compose

Create a docker-compose.yml file with the following content:

version: '2.2'
services:
  cubestore:
    image: cubejs/cubestore:edge

  cube:
    image: cubejs/cube:latest
    ports:
      - 4000:4000  # Cube API and Developer Playground
      - 3000:3000  # Dashboard app, if created
    env_file: .env
    depends_on:
      - cubestore
    links:
      - cubestore
    volumes:
      - ./schema:/cube/conf/schema

Configure Cube to use the above connection for an external database via the .env file:

CUBEJS_EXT_DB_TYPE=cubestore
CUBEJS_EXT_DB_HOST=cubestore

Build

docker build -t cubejs/cubestore:latest .
docker run --rm cubejs/cubestore:latest

Development

Debian prerequisites (incomplete): apt-get install lld libssl-dev pkg-config cmake

When changing Datafusion or Arrow:

Check out https://github.com/cube-js/arrow-rs/tree/cube and https://github.com/cube-js/arrow-datafusion/tree/cube and add the following to the current directory's Cargo.toml. (But remember to exclude this from your PR!)


[patch.'https://github.com/cube-js/arrow-rs']
parquet = { path = "../../../arrow-rs/parquet" }
arrow = { path = "../../../arrow-rs/arrow" }

[patch.'https://github.com/cube-js/arrow-datafusion']
datafusion = { path = "../../../arrow-datafusion/datafusion" }

Of course, you can use absolute paths or adjust the paths to your chosen checkout location.

It is possible that uncommenting the arrow-datafusion .cargo/config.toml path line works for you too, but it might not, if you are making changes in arrow-rs.

License

Cube Store is Apache 2.0 licensed.

版本与发布记录

@cubejs-backend/cubestore 共发布 705 个版本,首次发布于 2021/02/20;过去 12 个月发布了 173 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.8.21latest2026/11/101 天前
1.4.62026/11/101 天前
1.6.772026/11/074 天前
1.8.202026/11/064 天前
1.8.192026/11/065 天前
1.8.182026/11/037 天前

关于 @cubejs-backend/cubestore 的常见问题

@cubejs-backend/cubestore 是什么?

Cube pre-aggregation storage layer.

如何安装 @cubejs-backend/cubestore?

在项目目录运行 npm install @cubejs-backend/cubestore,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cubestore-dev,可以用 npx cubestore-dev 直接运行。

@cubejs-backend/cubestore 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cubejs-backend/cubestore 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@cubejs-backend/cubestore 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^12.0.0 || ^14.0.0 || >=16.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cubejs-backend/cubestore 可以商用吗?

@cubejs-backend/cubestore 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@cubejs-backend/cubestore 的下载量有多少?

根据 npm 官方下载统计,@cubejs-backend/cubestore 在 2026/10/11 – 2026/11/09 这 30 天内被下载 287,358 次,日均约 9,579 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cubejs-backend/cubestore 还在维护吗?

最新版本 1.8.21 发布于 2026/11/10(1 天前);至今共发布 705 个版本,其中过去 12 个月发布了 173 个;首次发布于 2021/02/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。