Resolved Java(use Jedis) and C++ projects need to use same redis cluster.
- Realize the Jedis hash ring. Use same consisten hash.
Example: example/simple.cpp
//Create Redis cluster nodes, {node_name, node_weight}.
jedishrc::JedishrcConfig config{
{"Node1:8000", 1}, {"Node2:8001", 1}, {"Node3:8002", 1}
};
//Create hash ring with config.
jedishrc::Jedishrc pool(config);
auto node = pool.GetNode(key);
- C++11