# redis cluster **Repository Path**: hakuyo/redis-cluster ## Basic Information - **Project Name**: redis cluster - **Description**: 根据官方集群方案,实现了集群中 key 值的get/set,不包括集群管理 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-03-20 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 本方案参考的集群方案是官方方案,不是自己另外实现一套集群方案, 只涉及数据访问,不涉及节点及槽号迁移等的管理, 实现不支持进程/线程安全,一次设置多个值的命令没测试, 本实现依赖于 hiredis 库,需要自行修改 src/Makefile 中的相关路径, 并没有做成设置成相关路径的 Makefile 选项, hiredis 参见 https://github.com/redis/hiredis.git, 实现方案参考了 https://github.com/shinberg/cpp-hiredis-cluster.git, 明确了 slot 迁移后,要重新连接, asking 时不用重连,只需要发送asking 命令即可。根据此思想实现了相关 cluster 访问方案, 环境,centos6.6 x64, redis-3.2.9,ruby-2.2.9 测试中,发现 migrate 只能实现 主备的 数据迁移,并不能实现slot的迁移, 最终确定,通过 redis 安装包中自带的 redis-trib.rb reshard 可以实现, 但在自己的测试环境中并没有测试通过,即执行此命令,执行结果失败。 reids 集群环境搭建 见 redis_cluster_env_setup.txt, 相关 *.sh 是集群测试脚本。 src/下是源码实现,如果顺利编译,会生成 get 和 set 可执行文件,用于测试读取和写入