# Redis-rb-cluster
Redis Cluster client work in progress.
It wraps Redis-rb, and eventually should be part of it.
For now the goal is to write a simple (but not too simple) client that works
as a reference implementation, and can be used in order to further develop
and test Redis Cluster, that is a work in progress itself.
## Creating a new instance
In order to create a new Redis Cluster instance use:
startup_nodes = [
{:host => "127.0.0.1", :port => 6379},
{:host => "127.0.0.1", :port => 6380}
]
max_cached_connections = 2
rc = RedisCluster.new(startup_nodes,max_cached_connections)
The startup nodes are a list of addresses of Cluster Nodes, for the client to
work it is important that at least one address works. Startup nodes are used
in order to:
* Initialize the hash slot -> node cache, using the `CLUSTER NODES` command.
* To contact a random node every time we are not able to talk with the right node currently cached for the specified hash slot we are interested in, in the context of the current request.
The list of nodes provided by the user will be extended once the client
will be able to retrieve the cluster configuration.
The second parameter in the object initialization is the maximum number of
connections that the client is allowed to cache. Ideally this should be at
least equal to the number of nodes you have, in order to avoid closing and
reopening TCP sockets. However if you have very large cluster and want to
optimize for clients resource saving, it is possible to use a smaller value.
## Sending commands
Sending commands is very similar to redis-rb:
rc.get("foo")
Currently only a subset of commands are implemented (and in general multi-keys
commands are not supported by Redis Cluster), because for every supported
command we need a function able to identify the key among the arguments.
## Disclaimer
Redis Cluster is released as stable.
This client is a work in progress that might not be suitable to be used in production environments.
没有合适的资源?快使用搜索试试~ 我知道了~
基于 redis-rb 的 Redis Cluster Ruby 客户端.zip
共7个文件
rb:4个
txt:2个
md:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 166 浏览量
2024-12-03
14:21:21
上传
评论
收藏 10KB ZIP 举报
温馨提示
基于 redis-rb 的 Redis Cluster Ruby 客户端Redis-rb-集群Redis 集群客户端正在进行中。它包装了 Redis-rb,最终将成为其一部分。目前的目标是编写一个简单(但不是太简单)的客户端,作为参考实现,并可用于进一步开发和测试 Redis Cluster,这本身就是一项正在进行的工作。创建新实例要创建新的 Redis 集群实例,请使用startup_nodes = [ {:host => "127.0.0.1", :port => 6379}, {:host => "127.0.0.1", :port => 6380}]max_cached_connections = 2rc = RedisCluster.new(startup_nodes,max_cached_connections)启动节点是集群节点的地址列表,为了使客户端正常工作,至少一个地址有效非常重要。启动节点用于使用命令初始化哈希槽->节点缓存CLUSTER NODES。在当前请求的上下文中,每次我们无法与当前为我们感兴趣的指定哈
资源推荐
资源详情
资源评论
收起资源包目录
基于 redis-rb 的 Redis Cluster Ruby 客户端.zip (7个子文件)
cluster.rb 10KB
标签.txt 2B
crc16.rb 4KB
example.rb 688B
资源内容.txt 926B
consistency-test.rb 4KB
README.md 2KB
共 7 条
- 1
资源评论
徐浪老师
- 粉丝: 8455
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功