apache / incubator-pegasus

Apache Pegasus - A horizontally scalable, strongly consistent and high-performance key-value store
https://pegasus.apache.org/
Apache License 2.0
1.98k stars 313 forks source link

Dynamic reload duplication config #2102

Open ninsmiracle opened 2 months ago

ninsmiracle commented 2 months ago

Feature Request

In PR #2000 , we can ignore cluster id with paramater dup_ignore_other_cluster_ids. However, I think this function can be more flexible. There is no doubt that, cluster id is very useful in multiple clusters duplication situation, backup-cluster can use it to judge data's priority. So we may want to dynamic relod duplication config when we doing duplication.

Describe the feature you'd like: Here is a case: At beging, we have two clusters like cluster A dup data to cluster B. (A ----> B) And now, demand changes: C cluster also need to dup to cluster B. (A,C -----> B) We don't need to restart the nodes on B, and can reload the config ABOUT DUP.

acelyc111 commented 1 month ago

@ninsmiracle How many configuration key-value pairs are needed to be reload in this case?

There are several ways to update configs, http and remote_command, it's not a good idea to introduce another method.

ninsmiracle commented 1 month ago

There are 2 key-value paris needed to be reload,such like this:

[[pegasus.clusters]]
   c3tst-cluster1 = 10.xxx.xxx.x:22601,10.xxx.xx.x:22601
   c4tst-cluster2 = 10.xxx.xx.x:37001,10.xxx.xx.x:37001
   # you can add cluster's meta list here
   xxxxx = xxxxxxxxxxxx

  [[duplication-group]]
  c3tst-cluster1 = 1 
  c4tst-cluster2 = 2 
 # you can add cluster_id here
  xxxx = 3      

We only need to recognize these two parameters in this issues.

ninsmiracle commented 1 month ago

Regarding the second discussion, I think update the config via http is not a good idea. Here is the method we used (If we apply this feat): 1.Push new config file (config.ini) with your own method to target cluster. 2.Open pegasus-shell and type remote_command -t all dup-config-reload. 3.Begin duplication as normal. Just like: dup add -c c3tst-cluster3 -p

In step1, we require the cluster maintenance personnel to push the config file to the nodes of the target cluster first. This step is to ensure that the latest config file can be read immediately when the cluster node is restarted after a downtime.

In step2, we can see that we use remote_command to upload the latest config file paramaters (those about duplication) to memory.

So that, in step 3, you can use dup command without restart target cluster's nodes.