Support cluster mode#302
Merged
Merged
Conversation
git-hulk
approved these changes
Jun 13, 2021
Member
git-hulk
left a comment
There was a problem hiding this comment.
LGTM, the cluster topology and version would store on local storage?
Member
Author
|
@git-hulk That is a good question, I still consider that, we must should know the nodes may keep old cluster topology if restarted. That may cause terrible things if the IP and port are reused. |
Member
|
yup, use ip:port as the unique identifier would cause problems, the node id would be better if we also persist it. |
karelrooted
approved these changes
Jun 15, 2021
ShooterIT
added a commit
that referenced
this pull request
Jun 16, 2021
One cluster mode is similar with redis cluster, please see #219
ShooterIT
added a commit
to ShooterIT/kvrocks
that referenced
this pull request
Jul 15, 2021
One cluster mode is similar with redis cluster, please see apache#219
Merged
ShooterIT
added a commit
that referenced
this pull request
Jul 19, 2021
One cluster mode is similar with redis cluster, please see #219
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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