restatedev / restate

Restate is the platform for building resilient applications that tolerate all infrastructure faults w/o the need for a PhD.
https://docs.restate.dev
Other
1.66k stars 38 forks source link

Initial cluster configuration #2351

Open muhamadazmy opened 6 days ago

muhamadazmy commented 6 days ago

Initial cluster configuration

Summary:

Initial cluster configuration and handling

Configuration file

Introduce a new configuration

cluster-configuration = "empty|default"

By setting this to "default" (that the the default value) the node seeds the cluster configuration with default config

Setting cluster-configuration to empty. Starts the node with empty cluster configuration. In that case, the node does not provision the partition table or the logs until the configuration is set explicitly via restatectl cluster config set

Once configuration is set, the configuration of the cluster auto resumes. No extra actions are needed.

cluster config get/set

restatectl cluster config gives users a simple interface to inspect and update configuration

Example

restatectl cluster config get

⚙️ Version: 1:
―――――――――――――
num-partitions = 24
default-provider = "local"
nodeset-selection-strategy = "strict-fault-tolerant-greedy"
partition-processor-replication-strategy = "on-all-nodes"

[replication-property]
node = 1

To change the config, create a new toml file with following content cluster-config-example.toml

num-partitions = 24
default-provider = "local"
nodeset-selection-strategy = "strict-fault-tolerant-greedy"
[partition-processor-replication-strategy]
factor = 2

[replication-property]
node = 2

Then run

restatectl cluster config set cluster-config-example.toml
  num-partitions = 24
  default-provider = "local"
  nodeset-selection-strategy = "strict-fault-tolerant-greedy"
 -partition-processor-replication-strategy = "on-all-nodes"

  [replication-property]
 -node = 1
 +node = 2
 +
 +[partition-processor-replication-strategy]
 +factor = 2

  💡   Please note that changes in configuration can take up to 5 seconds
       before they are seen by all nodes.

       If Configuration is being set for the first time. The system will initialize the logs with the
       given configuration.

       Changes of configuration does not automatically trigger a reconfigure of the logs. Reconfiguration
       will happen when detected to be needed by the system or by using the `restatectl cluster reconfigure`
       command.

? Apply changes? (y/n) › no

Stack created with Sapling. Best reviewed with ReviewStack.

AhmedSoliman commented 3 days ago

I'm removing my self from this review until it's ready. Please add me back as reviewer when you apply the changes we discussed offline.

muhamadazmy commented 20 hours ago

Thank you @pcholakov for your review. I will process all your comments. Also don't be sorry over grammar nitpicking! that's my fav kind of nitpicking 😀