Automatically publish MongoDB changes to Redis for Meteor.

Overview

changestream-to-redis

CI Publish

Warning
The project is currently in its alpha phase. There are no production loads using it yet nor any large-scale tests were conducted. I do not recommend going live with it yet.

This program listens to a MongoDB Change Stream, and publishes changes to Redis. It is designed to work with the cultofcoders:redis-oplog Meteor package and meant as an alternative to to oplogtoredis with support for protectAgainstRaceConditions: false.

Setup

  1. Install redis-oplog with the following configuration:
    • externalRedisPublisher: true.
    • globalRedisPrefix: "${database}.", e.g., globalRedisPrefix: "meteor.".
  2. Deploy changestream-to-redis with the following environmental variables:
    • (required) MONGO_URL, e.g., mongodb://localhost:27017/meteor.
    • (required) REDIS_URL, e.g., redis://localhost:6379/1.
    • (optional) DEBUG.
      • If set, all events are logged before being sent to Redis.
    • (optional) DEDUPLICATION, e.g., 120.
      • If set, all events are deduplicated on Redis. That allows you to deploy multiple instances of oplogtoredis listening to the same MongoDB database and pushing to the same Redis database.
    • (optional) FULL_DOCUMENT.
    • (optional) FULL_DOCUMENT_COLLECTIONS, e.g., notifications,users.
      • If not set, there will be one change stream, fetching full documents from all collections, according to the FULL_DOCUMENT flag.
      • If set, there will be two change streams. First, listening to the configured collections, fetching full documents when available (i.e., inserts) and according to the FULL_DOCUMENT flag. Second will listen to other collections, fetching only their IDs.

Limitations

  • No change stream resumption. It is planned, but at the moment the program is entirely stateless.
  • No error handling. As soon as the change stream or Redis communication fails, the program exits. It is planned, though changestream-to-redis is meant to restart as soon as it exits.
  • No monitoring. There is no monitoring of any kind, but both a healt-checking endpoint and Prometheus metrics are planned.

Development

This is a standard Rust application: cargo fmt will format the code, cargo clippy will check it, and cargo test will run tests.

You might also like...
RedisJSON - a JSON data type for Redis

RedisJSON RedisJSON is a Redis module that implements ECMA-404 The JSON Data Interchange Standard as a native data type. It allows storing, updating a

A rust Key-Value store based on Redis.

Key-Value Store A Key-Value store that uses Redis to store data. Built using an async web framework in Rust with a full Command-Line interface and log

[POC] Redis Module for TiKV

RedisTikvPoc [POC] Redis Module for TiKV This is a POC repository. This Redis Module will add branch new Redis commands to operate TiKV data. After bu

Incomplete Redis client and server implementation using Tokio - for learning purposes only

mini-redis mini-redis is an incomplete, idiomatic implementation of a Redis client and server built with Tokio. The intent of this project is to provi

Basic Redis Protocol specification in Rust

Basic Redis Protocol specification in Rust

Rewrite Redis in Rust for evaluation and learning.

Drill-Redis This library has been created for the purpose of evaluating Rust functionality and performance. As such, it has not been fully tested. The

Redis compatible server framework for Rust
Redis compatible server framework for Rust

Redis compatible server framework for Rust Features Create a fast custom Redis compatible server in Rust Simple API. Support for pipelining and telnet

A port of `java.util.*SummaryStatistics` as a Redis Module

RedisNumbersStats RedisNumbersStats is a Redis module that implements a Redis version of the Java Util *SummaryStatistics classes, such as DoubleSumma

A simplified version of a Redis server supporting SET/GET commands

This is a starting point for Rust solutions to the "Build Your Own Redis" Challenge. In this challenge, you'll build a toy Redis clone that's capable

Releases(v0.4.0)
  • v0.4.0(Jul 29, 2023)

    Full Changelog: https://github.com/radekmie/changestream-to-redis/compare/v0.3.0...v0.4.0

    • Implemented selective full documents mode (FULL_DOCUMENT_COLLECTIONS).
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jul 29, 2023)

    Full Changelog: https://github.com/radekmie/changestream-to-redis/compare/v0.2.0...v0.3.0

    • Configured Clippy rules.
    • Optimized dependencies.
    • Centralized config.
    • Introduced high availability mode (DEDUPLICATION).
    • Introduced DEBUG mode.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Jul 28, 2023)

  • v0.1.0(Jul 27, 2023)

Owner
Radosław Miernik
Open source? Embrace, understand, develop.
Radosław Miernik
Macros for redis-rs to serialize and deserialize structs automatically

redis-macros Simple macros and wrappers to redis-rs to automatically serialize and deserialize structs with serde. Installation To install it, simply

Daniel Grant 4 Feb 18, 2023
The official MongoDB Rust Driver

MongoDB Rust Driver This repository contains the officially supported MongoDB Rust driver, a client side library that can be used to interact with Mon

mongodb 1.1k Dec 30, 2022
Blazingly fast data generation & seeding for MongoDB

Planter Blazingly fast and simple data generation & seeding for MongoDB Installation Use the package manager cargo to install planter. Add the followi

Valencian Digital 4 Jan 12, 2022
This is superseded by the official MongoDB Rust Driver

This Repository is NOT a supported MongoDB product MongoDB Rust Driver Prototype NOTE: This driver is superseded by the official MongoDB Rust driver,

MongoDB, Inc. Labs 382 Nov 15, 2022
The most efficient, scalable, and fast production-ready serverless REST API backend which provides CRUD operations for a MongoDB collection

Optimal CRUD Mongo Goals of This Project This is meant to be the most efficient, scalable, and fast production-ready serverless REST API backend which

Evaluates2 1 Feb 22, 2022
Teach your PostgreSQL database how to speak MongoDB Wire Protocol

“If it looks like MongoDB, swims like MongoDB, and quacks like MongoDB, then it probably is PostgreSQL.” ?? Discord | Online Demo | Intro Video | Quic

Felipe Coury 261 Jun 18, 2023
Mycelite is a SQLite extension that allows you to synchronize changes from one instance of SQLite to another.

Mycelite What is Mycelite? Mycelite is a SQLite extension that allows you to synchronize changes from one instance of SQLite to another. Currently, it

Mycelial 16 Jan 2, 2023
Redis re-implemented in Rust.

rsedis Redis re-implemented in Rust. Why? To learn Rust. Use Cases rsedis does not rely on UNIX-specific features. Windows users can run it as a repla

Sebastian Waisbrot 1.6k Jan 6, 2023
Redis library for rust

redis-rs Redis-rs is a high level redis library for Rust. It provides convenient access to all Redis functionality through a very flexible but low-lev

Armin Ronacher 2.8k Jan 8, 2023
RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

RedisLess is a fast, lightweight, embedded and scalable in-memory Key/Value store library compatible with the Redis API.

Qovery 145 Nov 23, 2022