/redis2nats

Redis to NATS bridge

Primary LanguageGoMIT LicenseMIT

REDIS2NATS

Description

This project is a Redis to NATS bridge. It listens for Redis connections and uses NATS Key-Value store to store the data.

Supported Redis Commands

DECR DEL EXISTS EXPIRE GET HDEL HEXISTS HGET HGETALL
HKEYS HLEN HSET INCR KEYS LPOP LPUSH LRANGE MGET MSET
PING SELECT SET SETNX TTL

Table of Contents

Installation

Using Make

To build the project, run the following command:

make build

To run the project, run the following command:

./bin/redis2nats

Using Docker

To build the Docker image, run the following command:

docker build -t redis2nats .

To run the Docker container, run the following command:

docker run -d --name redis2nats redis2nats

Using Docker Compose

To run the Docker container using Docker Compose, run the following command:

docker-compose up redis2nats -d

If you want to run NATS server as well, run the following command:

docker-compose up -d

Using Go

To run the project using Go, run the following command:

make run

Usage

Redis2NATS has a configuration file that can be used to set the Redis and NATS connection details. The example configuration file is located at conf/redis2nats.yaml.

redis:
  address: ":6379"
  numDB: 16
nats:
  url: "nats://localhost:4222"
  bucketPrefix: "redisnats"
  timeout: "10s"
  persist: false

description of the configuration options:

  • redis.address: The address of the Redis2NATS server.
  • redis.numDB: The number of Redis databases.
  • nats.url: The URL of the NATS server.
  • nats.bucketPrefix: The prefix for the NATS bucket.
  • nats.timeout: The timeout for the NATS connection/operations.
  • nats.persist: The flag to enable/disable persistence.

Connect with the author

Twitter GitHub Linkedin

License

© Simone Vellei, 2024~time.Now() Released under the MIT License