To understand the terminology used on this page, it might be helpful to read through the architecture reference.
Controlling clusters with restatectl
Restate includes a command line utility tool to connect to and control running Restate servers called restatectl
.
This tool is specifically designed for system operators to manage Restate servers and is particularly useful in a cluster environment.
Follow the installation instructions to get
restatectl
set up on your machine.restatectl
tool communicates with Restate at the advertised address specified in the server configuration - by default TCP port 5122.
View the cluster's current state
View the cluster's current state
--addresses http://localhost:5122/
:Provisioning clusters
Provisioning clusters
Check out the cluster deployment documentation
List all nodes and their assigned roles
List all nodes and their assigned roles
View log configuration
View log configuration
View the current log configuration (provider, replication, and nodeset) and the effective logs per partition:Output:
Lists all partition, their current state, and any dead nodes
Lists all partition, their current state, and any dead nodes
View the cluster settings
View the cluster settings
Update the cluster settings
Update the cluster settings
Growing the cluster
You can expand an existing cluster by adding new nodes after it has been started.1
Starting point: single node
A Restate cluster can initially be started with a single node.
Follow the cluster deployment instructions and ensure that:
- It uses the replicated loglet. If you use local loglet, check this migration guide.
default-replication
is set to 1- Snapshotting is enabled, to ensure that newly added nodes are fully utilized by the system.
2
Launch new nodes
Launch a new node with the same
cluster-name
and specify at least one existing node’s address in metadata-client.addresses
.
This allows the new node to discover the metadata servers and join the cluster.3
Modify cluster configuration
Update the cluster’s replication settings to take advantage of the additional nodes and improve fault tolerance.Increase log replication to your desired number. For example, to replicate to two nodes:
Then list the logs:
You might need to re-run the command a few times until all logs reflect the updated replication setting.
If the update takes longer than expected, check the node logs for errors or warnings.
Output
Output
Output
Output
Managing the Replicated Loglet
You can manage the replicated loglet via:log-server
node in the cluster has a storage state which determines how the control plane may use this node. The set-storage-state
tool allows you to manually override this state as operational needs dictate.
New log servers come up in the provisioning
state and will automatically transition to read-write
. The read-write
state means that the node is considered both healthy to read from and accept writes, that is it may be selected as a nodeset member for new loglet segments.
View storage state of log server
You can view the current storage state of log servers in your cluster using thelist-servers
sub-command.
Output
Output
data-loss
, read-only
, and disabled
. Nodes may transition to data-loss
if they detect that some previously written data is not available. This does not necessarily imply corruption, only that such nodes may not participate in some quorum checks. Such nodes may transition back to read-write
if they can be repaired.
The read-only
and disabled
states are of particular interest to operators. Log servers in read-only
storage state may continue to serve both reads and writes, but will no longer be selected as participants in new segments’ nodesets. The control plane will reconfigure existing logs to move away from such nodes.
Manually update the log server state
Danger of data loss:
set-storage-state
is a low-level command that allows you to directly set log servers’ storage-state. Changing this can lead to cluster unavailability or data loss.set-storage-state
sub-command to manually update the log server state, for example to prevent log servers from being included in new nodesets. Consider the following example:
N1
. Depending on the configured log replication level, you may see a warning about compromised availability or, if insufficient log servers are available to achieve the minimum required replication, the log will stop accepting writes altogether.
The restatectl
checks whether it is possible to create new node sets after marking a given node or set of nodes as read-only.
Examine the logs using restatectl logs describe
.
Troubleshooting Clusters
Node id misconfiguration puts log server in data-loss state
Node id misconfiguration puts log server in data-loss state
If a misconfigured Restate node with the log server role attempts to join a cluster where the node id is already in use, you will observe that the newly started node aborts with an error:Restarting the existing node that previously owned this id will also cause it to stop with the same message. Follow these steps to return the initial log server into service without losing its stored log segments.First, prevent the misconfigured node from starting again until the configuration has been corrected. If this was a brand new node, there should be no data stored on it, and you may delete it altogether.The reused node id has been marked as having
You should also observe that the control plane is now avoiding using this node for log storage. This will result in reduced fault tolerance or even unavailability, depending on the configured minimum log replication:
To restore the original node’s ability to accept writes, we can update its metadata using
You can validate that the server is once again being used for log storage using
data-loss
. This precaution that tells the Restate control plane to avoid selecting this node as member of new log nodesets. You can view the current status using the restatectl replicated-loglet
tool:Output
Output
Output
Output
set-storage-state
subcommand.Only proceed if you are confident that you understand the reason why the node is in this state, and are certain that its locally stored data is still intact. Since Restate cannot automatically validate that it safe to put this node back into service, we must use the
--force
flag to override the default state transition rules.Output
Output
logs list
and replicated-loglet servers
subcommands.Handling missing snapshots
Handling missing snapshots
You are observing a partition processor repeatedly crash-looping with a Confirm that this is consistent with other nodes in the cluster.Check the server logs for any access errors; does the node have the necessary credentials and are those credentials authorized to access the snapshots destination?If you have lost all nodes which previously hosted this partition, you have permanent data loss - the partition state can not be fully recovered. Get in touch with us to assist in re-starting the partition accepting the data loss.Request a snapshot for this partition:You can manually confirm that the snapshot was published to the expected destination. Within the specified snapshot bucket and prefix, you will find a partition-based tree structure. Navigate to the bucket path Identify an up-to-date node which is running the partition by running:On this node, configure a local destination for the partition snapshot repository - make sure this already exists:Restart the node. If you have multiple nodes which may assume leadership for this partition, you will need to either repeat this on all of them, or temporarily shut them down. Create snapshot(s) for the affected partition(s):Copy the contents of the snapshots repository to the node experiencing issues, and configure it to point to the snapshot repository. If you have multiple snapshots produced by multiple peer nodes, you can merge them all in the same location - each partition’s snapshots will be written to dedicated sub-directory for that partition.
TrimGapEncountered
error, or see one of the following errors in the Restate server logs:A log trim gap was encountered, but no snapshot repository is configured!
A log trim gap was encountered, but no snapshot is available for this partition!
The latest available snapshot is from an LSN before the target LSN!
Recovery procedure
1. Identify whether a snapshot repository is configured and accessible
If a snapshot repository is set up on other nodes in the cluster, and simply not configured on the node where you are seeing the partition processor startup errors, correct the configuration on the new node - refer to Configuring Snapshots. If you have not yet set up a snapshot repository, please do so now. If it is impossible to use an object store to host the snapshots repository, you can export snapshots to a local filesystem and manually transfer them to other nodes - skip to step2b
.In your server configuration, you should have a snapshot path specified as follows:2. Publish a snapshot to the repository
Snapshots are produced periodically by partition processors on certain triggers, such as a number of records being appended to the log. If you are seeing the following error, check that snapshot are being written to the object store destination you have configured.Verify that this partition has an active node:{prefix}/{partition_id}
- you should see an entry for the new snapshot id matching the output of the create snapshot command.2b. Alternative: Manually transfer snapshot from another node
If you are running a cluster but are unable to setup a snapshot repository in a shared object store destination, you can still recover node state by publishing a snapshot from a healthy node ot the local filesystem and manually transferring it to the new node.Experimenting with snapshots without an object store:
Note that shared filesystems are not a supported target for cluster snapshots, and have known correctness risks. The
file://
protocol does not support conditional updates, which makes it unsuitable for potentially contended operation.