-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support slot-based data migration #430
Conversation
- Clear unnecessary option
- code optimization
@ChrisZMF Please resolve conflicts (related to kvrocks2redis) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, let's review ASAP @git-hulk
Hi @ChrisZMF I have merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Cheers!
@ChrisZMF Thanks for your great PR which authentically makes kvrocks scalable , also thanks for your patience of keeping following CRs and tolerating my preferences.
Cheers! @ShooterIT I didn't have other suggestions, can you help to summary this PR. |
I am really glad this PR is accepted. Thank you for the suggestions you given for this PR to make it better. It really makes a lot of sense to me. @ShooterIT @git-hulk |
A new command CLUSTERX MIGRATE is used for migrate slot data, slot-based migration process mainly includes the following stages: migrating existing data and migrating incremental data. Command format: CLUSTERX MIGRATE $slot $dst_nodeid - $slot is the slot which is to migrate - $dst_nodeid is the node id of destination server in the cluster. We also introduce an internal command CLUSTER IMPORT for importing the migrating slot data into destination server. Migration status are shown into the output of CLUSTER INFO command. After migration slot, you also should use CLUSTERX SETSLOT command to change cluster slot distribution. For more details, please see apache#412 and apache#430
A new command CLUSTERX MIGRATE is used for migrate slot data, slot-based migration process mainly includes the following stages: migrating existing data and migrating incremental data. Command format: CLUSTERX MIGRATE $slot $dst_nodeid - $slot is the slot which is to migrate - $dst_nodeid is the node id of destination server in the cluster. We also introduce an internal command CLUSTER IMPORT for importing the migrating slot data into destination server. Migration status are shown into the output of CLUSTER INFO command. After migration slot, you also should use CLUSTERX SETSLOT command to change cluster slot distribution. For more details, please see apache#412 and apache#430
A new command CLUSTERX MIGRATE is used for migrate slot data, slot-based migration process mainly includes the following stages: migrating existing data and migrating incremental data. Command format: CLUSTERX MIGRATE $slot $dst_nodeid - $slot is the slot which is to migrate - $dst_nodeid is the node id of destination server in the cluster. We also introduce an internal command CLUSTER IMPORT for importing the migrating slot data into destination server. Migration status are shown into the output of CLUSTER INFO command. After migration slot, you also should use CLUSTERX SETSLOT command to change cluster slot distribution. For more details, please see #412 and #430
if (svr->GetConfig()->cluster_enabled) { | ||
svr->slot_migrate_->SetMigrateStopFlag(false); | ||
LOG(INFO) << "Change server role to master, restart migration task"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn’t this block of code are dead code? since in the beginning we will throw an error if we are in the cluster mode
Status Execute(Server *svr, Connection *conn, std::string *output) override {
if (svr->GetConfig()->cluster_enabled) {
return Status(Status::RedisExecErr, "can't change to slave in cluster mode");
}
sorry for commenting in this very old PR... i tracked the changes, afraid i am missing something.
resolves #412
Support Commands
$slot
$dst_nodeid
$dst_nodeid
is the node id of destination server in the cluster. See [NEW] Support redis cluster mode [NEW] Support redis cluster mode #219 for more details.$slot
$state
It is an internal command which will be sent by the source server to notify the destination server to prepare for data importing. This command cannot be used by clients.
CLUSTER INFO
.Example:
Source node info:
Destination node info:
After migration slot, you should use CLUSTERX SETSLOT #463 to change cluster slot distribution.