Configs2026年4月16日·1 分钟阅读

RethinkDB — The Real-Time Document Database

RethinkDB is an open-source document database that pushes query results to your application in real time. Build live dashboards and collaborative apps without polling.

Introduction

RethinkDB is a document database designed for the real-time web. Its killer feature is changefeeds — persistent queries that push updates to your app the instant data changes. Instead of polling, your application subscribes to a query and receives a continuous stream of results.

What RethinkDB Does

  • Stores JSON documents with a flexible schema like MongoDB
  • Pushes live query results via changefeeds without polling
  • Scales horizontally with automatic sharding and replication
  • Provides a rich query language (ReQL) with joins, subqueries, and map-reduce
  • Includes a built-in web admin UI for cluster management

Architecture Overview

RethinkDB uses a shared-nothing distributed architecture. Data is split into shards distributed across a cluster, with configurable replicas for fault tolerance. The storage engine is based on a log-structured merge tree. Changefeeds are implemented at the query level — any ReQL query can be turned into a live feed, and the server efficiently pushes diffs when underlying data changes.

Self-Hosting & Configuration

  • Deploy via Docker, official packages for Ubuntu/Debian/CentOS, or compile from source
  • Configure cluster joins with --join host:port for multi-node setups
  • Set --cache-size to control memory usage for the buffer pool
  • Enable TLS with --tls-cert and --tls-key for encrypted client connections
  • Use the web UI at port 8080 to manage tables, shards, and replicas visually

Key Features

  • Changefeeds turn any query into a real-time push stream
  • ReQL query language chainable in Python, JavaScript, Ruby, and Java
  • Automatic failover with configurable replication per table
  • Geospatial indexes for location-based queries
  • Atomic document updates with conflict resolution

Comparison with Similar Tools

  • MongoDB — requires change streams (oplog-based); RethinkDB changefeeds work on arbitrary queries
  • Firebase Realtime DB — proprietary, limited query power; RethinkDB is open source with full joins
  • CouchDB — focuses on sync and replication; RethinkDB optimizes for low-latency push queries
  • PostgreSQL LISTEN/NOTIFY — row-level signals only; RethinkDB streams full query results
  • Redis Pub/Sub — ephemeral messaging; RethinkDB persists data and pushes computed query diffs

FAQ

Q: Is RethinkDB still maintained after the company shut down? A: Yes. The Linux Foundation and the CNCF community took over the project. Active development continues under the rethinkdb GitHub organization.

Q: Can RethinkDB replace MongoDB? A: For apps that benefit from real-time push, yes. For pure write-heavy CRUD without live needs, MongoDB may have broader ecosystem tooling.

Q: How does RethinkDB handle consistency? A: It uses immediate consistency by default for single-document writes and supports configurable read modes (single, majority, outdated).

Q: What clients are available? A: Official drivers exist for Python, JavaScript/Node.js, Ruby, and Java. Community drivers cover Go, C#, Rust, and more.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产