RCProxy - a lightweight, fast but powerful Redis Cluster Proxy written in Rust

Overview

RCProxy

RCProxy LOC

Forked from https://github.com/wayslog/aster. Thanks!

======================

RCProxy is a lightweight, fast but powerful Redis Cluster Proxy written in Rust.

It supports memcache/redis singleton/redis cluster protocol all in one. RCProxy can proxy with two models:

  1. proxy mode: the same as twemproxy.
  2. cluster mode: proxy for redis cluster. You can use non-cluster redis client access the redis cluster.(Inspired with Corvus)

Usage

Build

RUSTFLAGS="--cfg unsound_local_offset" cargo build --all --release

Run

./target/release/rcproxy default.toml

Install

sudo cp ./target/release/rcproxy /usr/local/bin/
sudo mkdir /etc/rcproxy
sudo cp default.toml /etc/rcproxy/
sudo mkdir /var/log/rcproxy
sudo cp service/systemd/rcproxy.service /lib/systemd/system/
sudo systemctl enable rcproxy
sudo systemctl start rcproxy

Configuration

[log]
level = "libaster=info" # "trace" "debug" "info" "warn" "error"
ansi = true  # support ANSI colors
stdout = false # print logs to stdout, not to log files
directory = "/var/log/rcproxy" # log file directory
file_name = "rcproxy.log" # log file name

[metrics]
port = 2110

[[clusters]]
# name of the cluster. Each cluster means one front-end port.
name="test-redis-cluster"

# listen_addr means the cluster font end serve address.
listen_addr="0.0.0.0:9001"

# cache_type only support memcache|redis|redis_cluster
cache_type="redis_cluster"

# servers means cache backend. support two format:
# for cache_type is memcache or redis, you can set it as:
#
#   servers = [
#       "127.0.0.1:7001:10 redis-1",
#       "127.0.0.1:7002:10 redis-2",
#       "127.0.0.1:7003:10 redis-3"]
#
# as you can see, the format is consisted with:
#
#       "${addr}:hash_weight ${node_alias}"
#
# And, for redis_cluster you can set the item as:
#
# servers = ["127.0.0.1:7000", "127.0.0.1:7001"]
#
# which means the seed nodes to connect to redis cluster.
servers = ["127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003", "127.0.0.1:7004", "127.0.0.1:7005"]

# Work thread number, it's suggested as the number of your cpu(hyper-thread) number.
thread = 1

# ReadTimeout is the socket read timeout which effects all in the socket in millisecond
read_timeout = 2000

# WriteTimeout is the socket write timeout which effects all in the socket in millisecond
write_timeout = 2000

############################# Cluster Mode Special #######################################################
# fetch means fetch interval for backend cluster to keep cluster info become newer.
# default 10 * 60 seconds
fetch = 600


# read_from_slave is the feature make slave balanced readed by client and ignore side effects.
read_from_slave = true

############################# Proxy Mode Special #######################################################
# ping_fail_limit means when ping fail reach the limit number, the node will be ejected from the cluster
# until the ping is ok in future.
# if ping_fali_limit == 0, means that close the ping eject feature.
ping_fail_limit=3

# ping_interval means the interval of each ping was send into backend node in millisecond.
ping_interval=10000

auth = "" # mypassw

changelog

see CHANGELOG.md

You might also like...
Hudsucker is a MITM HTTP/S proxy written in Rust.

hudsucker Hudsucker is a MITM HTTP/S proxy written in Rust. Features Modify HTTP/S requests Modify HTTP/S responses Modify websocket messages Usage Fo

A proxy implement with http / socks5 in-bound and vmess out-bound, written in Rust and tokio.rs

tokio-vmess an Asynchronous proxy implement with http / socks5 in-bound and vmess out-bound, written in Rust and tokio Run example first, Fill out the

♻ A simple and efficient Gemini-to-HTTP proxy written in Rust.

September A simple and efficient Gemini-to-HTTP proxy written in Rust. Usage Docker $ docker run -d [ -e ROOT="gemini://fuwn.me" ] [ -e PORT="8080"] [

Reverse proxy for HTTP microservices and STDIO. Openfass watchdog which can run webassembly with wasmer-gpu written in rust.

The of-watchdog implements an HTTP server listening on port 8080, and acts as a reverse proxy for running functions and microservices. It can be used independently, or as the entrypoint for a container with OpenFaaS.

simple and powerful IP architecture in Rust.

ipzone Ipzone provides a simple and powerful IP architecture to Rust. | Examples | Docs | Latest Note | ipzone = "0.4.0" Examples use ipzone::prelude:

server security proxy write by Rust

server-security-proxy server security proxy write by Rust how to use config toml file

A high performence Socks5 proxy server with bind/reverse support implementation by Rust.

rsocx A high performence Socks5 proxy server with bind/reverse support implementation by Rust Features Async-std No unsafe code Single executable Linu

A minimal ngrok liked reverse proxy implemented in Rust.

rok A minimal ngrok implementation in Rust, for educational purpose. This work is largely based on rathole, especially the very first commit. Other ho

Implementation of the Docker Registry HTTP API V2 in Rust, that can act as a proxy to other registries

Docker registry server and proxy (I'm bad at creating catchy names, but this one is good enough.) This project aims to implement a Docker Registry HTT

Comments
  • BRPop Support

    BRPop Support

    Is there a way to add support for the BRPop

    I see the RPOP and LPOP and other commands work, but BRPop and BLPop and other Blocking requests are not supported.

    Suggestions?

    opened by madskunker 0
  • More configuration documentation, please

    More configuration documentation, please

    I am trying to get it running, but it is not recognizing the response from CLUSTER SLOTS command, according to log But it does not tell me if the command was successful. How do I enable more meaningful logs, and configuration documentation would be nice. I can help with it given a bit of orientation.

    2022-04-02 00:00:29.475  INFO libaster: starting aster cluster test-cluster in addr 0.0.0.0:7788
        at src/lib.rs:117 on main ThreadId(1)
    
      2022-04-02 00:00:29.475  INFO libaster: setup meta info with Meta { cluster: "test-cluster", port: "7788", ip: "10.1.40.175" }
        at src/lib.rs:206 on main ThreadId(1)
    
      2022-04-02 00:00:30.506 DEBUG libaster::proxy::cluster::init: CLUSTER SLOTS get response as Cmd { cmd: RefCell { value: Command { flags: DONE | ERROR, ctype: Ctrl, cycle: 0, req: Message { rtype: Array(Range { begin: 0, end: 4 }, [Bulk(Range { begin: 4, end: 8 }, Range { begin: 8, end: 17 }), Bulk(Range { begin: 17, end: 21 }, Range { begin: 21, end: 28 })]), data: b"*2\r\n$7\r\nCLUSTER\r\n$5\r\nSLOTS\r\n" }, reply: Some(Message { rtype: Error(Range { begin: 0, end: 18 }), data: b"-command timeout\r\n" }), subs: None, total_tracker: None, remote_tracker: None } }, notify: Notify { shared: NotifyShared { task: RefCell { value: Some(Task) }, count: Cell { value: 1 }, expect: 1 } } }
        at src/proxy/cluster/init.rs:143 on test-cluster ThreadId(3)
    
      2022-04-02 00:00:30.506  WARN libaster::proxy::cluster::init: fail to parse cmd reply due CLUSTER SLOTS must be replied with array
        at src/proxy/cluster/init.rs:165 on test-cluster ThreadId(3)
    
    documentation enhancement good first issue 
    opened by potbunker 2
Releases(v2.2.1)
Owner
Cris Liao
Program Builder/Trainer
Cris Liao
Web3-proxy: a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers.

web3-proxy Web3-proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. Signed transactions (eth_sendRawTrans

null 55 Jan 8, 2023
A fast, stable, efficient, and lightweight intranet penetration, port forwarding tool supports multiple connections, cascading proxy, and transmission encryption

A fast, stable, efficient, and lightweight intranet penetration, port forwarding tool supports multiple connections, cascading proxy, and transmission encryption

editso 1.3k Dec 30, 2022
Hopper - Fast, configurable, lightweight Reverse Proxy for Minecraft

Hopper Hopper is a lightweight reverse proxy for minecraft. It allows you to connect multiple servers under the same IP and port, with additional func

Pietro 174 Jun 29, 2023
Proxy sentry request to a sentry server using a tunnel/proxy endpoint

Sentry Tunnel This is a proxy that forwards tunneled sentry requests to the real sentry server. The implementation is based on the explanation provide

Paul FLORENCE 14 Dec 20, 2022
UDP proxy with Proxy Protocol and mmproxy support

udppp UDP proxy with Proxy Protocol and mmproxy support. Features Async Support Proxy Protocol V2 SOCKET preserve client IP addresses in L7 proxies(mm

b23r0 10 Dec 18, 2022
A TCP proxy using HTTP - Reach SSH behind a Nginx reverse proxy

?? TCP over HTTP ?? The Questions ?? What does it do? You can proxy TCP traffic over HTTP. A basic setup would be: [Your TCP target] <--TCP-- [Exit No

Julian 185 Dec 15, 2022
A lightweight Rust reverse proxy.

Brachyura A reverse proxy, which I am primarily using as a Rust / Hyper learning project. I utilize Nginx as part of my home lab providing reverse pro

William Howard 8 Jan 8, 2023
A fast and stable reverse proxy for NAT traversal, written in Rust

rathole A fast and stable reverse proxy for NAT traversal, written in Rust rathole, like frp, can help to expose the service on the device behind the

Yujia Qiao 4.6k Dec 30, 2022
Simple and fast layer 4 proxy in Rust

Fourth 这一波在第四层。 English Fourth是一个Rust实现的Layer 4代理,用于监听指定端口TCP流量,并根据规则转发到指定目标。 功能 监听指定端口代理到本地或远端指定端口 监听指定端口,通过TLS ClientHello消息中的SNI进行分流 安装方法 为了确保获得您架构

Rui Li 17 Nov 8, 2022
Redis backed session store for async-session using fred.rs.

async-fred-session Redis backed session store for async-session using fred.rs. This work is mostly based on async-redis-session. use async_fred_sessio

void* 4 Feb 28, 2023