Skip to content

drycc-archive/redis-cluster-proxy

 
 

Repository files navigation

Redis Proxy

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

Usage

Build

cargo build --all --release

Run

./target/release/redis_proxy default.toml

Install

sudo cp ./target/release/redis_proxy /usr/local/bin/
sudo mkdir /etc/redis
sudo cp default.toml /etc/redis/
sudo mkdir /var/log/redis

Configuration

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

[metrics]
# change port config, to run multiple instance in one machine.
port = 2110

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

# listen_addr means the cluster front end server address.
listen_addr="0.0.0.0:9001"

# cache_type only support redis_cluster
cache_type="redis_cluster"
# redis cluster nodes
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

# Configure password for backend server. It will send this password to backend server on connect.
# Empty value will be ignored.
auth = "" # mypassw

changelog

see CHANGELOG.md

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.1%
  • Other 0.9%