Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves #219
Deploy Kvrocks Cluster
In our cluster solution, you should firstly deploy some kvrocks instances and set replication relationship, and
Kvrocks doesn't support to communicate with each others, so we need to tell every node the cluster topology.
The command is
CLUSTER SETNODES$ALL_NODES_INFO$VERSION$FORCE$ALL_NODES_INFOformat:$node_id$ip $port$role$master_node_id$slot_range.$role: master or slave,$master_node_id: master_node_id if it is slave, otherwise, this value is-. slave needn't set$slot_range.Example:
$VERSIONmeans current cluster topology version that is stored or generated by management component such as config server or meta-server.Kvrocks can know itself node id by compared with itself ip and port in received
all nodes info, but you maybe bind kvrorks to0.0.0.0, so it is necessary to setNODEIDexplicitly to let it know itself. As the same with redis cluster, node id is 40 characters length.$NODE_IDMoreover, cluster doesn't handle failover and migration, you should set cluster topology again after failover, of course, you should do that if you add some new nodes into cluster.
Access Kvrocks Cluster
After setting cluster topology, we have tested, it adopt
redis-cli,redis-benchmark,python redis cluster sdk, andredis-cluster-proxy. So you may doesn't need to change your redis cluster request code to access kvrocks cluster.Have a try
In
tool/try_cluster, you can changeBIN_PATHof kvrocks bin path, and then./try_cluster.sh startto create a small cluster that has 6 nodes(3 maters and 3 replicas)then run
./try_cluster.sh watchto observe cluster nodes, you also can do some tests byredis-cli,redis-benchmark,redis cluster sdkandredis-cluster-proxyfor your fun.finally you can run
./try_cluster.sh stopto stop all nodes and clean up directory.Supplements
Use
CLUSTERXcommand to set cluster topology instead ofCLUSTER#324