#cache #redis #memcache #twemproxy

bin+lib aster-proxy

用 Rust 编写的轻量、快速且强大的缓存代理

17 个稳定版本

1.3.4 2021 年 6 月 2 日
1.3.3 2021 年 1 月 19 日
1.3.2 2020 年 6 月 5 日
1.3.1 2020 年 3 月 27 日
0.1.3 2018 年 11 月 30 日

##373缓存

Download history 2/week @ 2024-03-16 7/week @ 2024-03-30 1/week @ 2024-04-06

66 每月下载量

MIT 许可证

255KB
7K SLoC

aster

Aster LOC

Aster 是用 Rust 编写的轻量、快速但强大的缓存代理。

它支持 memcache/redis 单例/redis 集群协议,全部集成在一起。Aster 可以以两种模式进行代理

  1. 代理模式:与 twemproxy 相同。
  2. 集群模式:代理 redis 集群。您可以使用非集群 redis 客户端访问 redis 集群。(灵感来自 Corvus

用法

cargo build --all --release && RUST_LOG=libaster=info RUST_BACKTRACE=1 ./target/release/aster default.toml

配置

[[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"]

# 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

更新日志

查看 CHANGELOG.md

依赖

~30–41MB
~733K SLoC