Understanding Partition and Log Replication
Restate uses two complementary replication mechanisms to ensure both availability and durability in a distributed cluster:Partition Replication
Partition replication determines how many partition processors apply the log for each partition. Each partition handles service invocations for a specific key range. Partition processors run in a leader-follower model where one is the leader (actively processing invocations) while followers replay the log for redundancy. Key benefits:- Fast failover: Followers are already caught up with the log and can quickly take over as leader without reconstructing state from snapshots, reducing Mean Time To Recovery (MTTR) when a node fails
- Each partition replica consumes disk space and I/O resources to apply log records locally
- Does not improve data durability (that’s the role of log replication)
- How many nodes simultaneously run partition processors that apply the log for each partition
Log Replication
Log replication determines how many log-server nodes store copies of the durable write-ahead log (Bifrost). This is the foundation of data durability in Restate — the log stores the replicated data, not the partition processors. Key characteristics:- Durability guarantee: The log is the source of truth for all partition state changes. Your data is safe as long as you don’t lose
nlog-server nodes, wherenis the replication property value - Quorum-based writes: Log records are replicated to multiple nodes before being acknowledged
- Enables partition recovery: Partitions can be restored on any node by replaying the log or loading from snapshots
- Write latency: Higher replication factors increase susceptibility to straggler delays, as writes must wait for slower nodes in the quorum
- Storage costs: Each log-server replica stores a full copy of the log segments
- How many log-server nodes store copies of each log segment
Replication Properties
Both partition and log replication use the same replication property format, which can be either:- Simple node count:
2means 2 replicas across any nodes - Location-aware replication:
{zone: 2, node: 3}means 3 total replicas distributed across at least 2 zones (requires setting thelocationconfiguration option on nodes)
default-replication setting in your configuration controls both partition and log replication by default, though they can be configured independently using restatectl config set.
Location-Aware Replication
Restate supports location-aware placement to improve fault tolerance across failure domains like zones and regions. Configuration: Each node can declare its location in the cluster configuration:"us-east"— Region only"eu-central.zone-1"— Region and zone""(empty) — Default location (no specific assignment)
{node: 3}— 3 replicas, distributed across any 3 nodes{zone: 2, node: 3}— 3 replicas, distributed across at least 2 different zones{region: 2, zone: 3, node: 5}— 5 replicas, across at least 2 regions and 3 zones
Relationship Between the Two
Partition replication and log replication work together to provide complete availability and durability:- Log replication ensures your data is durable and survives node failures—the log stores the actual replicated data across log-server nodes
- Partition replication ensures your application stays available by maintaining hot standby partition processors that apply the log
- Partition processors don’t store the replicated data; they apply log records to their local state. The log is the authoritative source
- You must set log replication high enough to tolerate node failures and maintain durability
Deploying Restate clusters
To deploy a distributed Restate cluster without external dependencies, you need to configure the following settings in your server configuration:node-name specified.
The node name defaults to the hostname. Restate uses a subdirectory inside restate-data named after the node name to store local data. You will not be able to change the node name once it is in use without removing the node from the cluster, or else risk data loss.
Nodes can have identical configurations aside from node name.
advertised-address or advertised-host if the auto-detection doesn’t work for your environment (e.g., behind certain NAT configurations or load balancers).cluster-name specified.
At most one node can be configured with auto-provision = true.
It is important to avoid having more than one node enabled to auto-provision a cluster as this can lead to provisioning multiple clusters if not all nodes can see each other during startup.
If this happens, you will need to abandon the redundantly provisioned cluster(s), as it is not possible to merge clusters.
If no node is allowed to auto provision, then you have to manually provision the cluster.
Refer to the Cluster provisioning section for more information.
Sizing Clusters
default-provider = "replicated" (this is the default).
The default-replication determines the minimum number of nodes the data must be replicated to for both log and partition replication.
If you run at least 2 * default-replication - 1 nodes, then the cluster can tolerate default-replication - 1 node failures.
Nodes running the log-server role store segments of replicated logs.
Metadata availability is crucial for cluster availability, and the default metadata server type replicated can tolerate node failures.
Every node that runs the metadata-server role will join the metadata store cluster.
To tolerate n metadata node failures, you need to run at least 2 * n + 1 Restate nodes with the metadata-server role configured.
The metadata-client should be configured with at least one advertised address of a node that runs the metadata-server role. Nodes automatically include themselves if they run the metadata-server role, so for single-node setups, this field can be left empty.
Restate nodes running the worker role host partitions and handle service invocations, journaling execution, and data storage and queries. The default-replication property sets the total number of replicas that the cluster will schedule for any given partition. Only one of these partitions is designated as a leader and actively processes invocations; additional partition replicas are followers and serve as hot standby in case they need to take over processing. Running additional partition replicas does not increase durability, which is determined by log replication and object store snapshots, however it can increase system availability by ensuring a new partition leader can be quickly promoted.
restatectl config set --log-replication / --partition-replication.http-ingress role will accept external invocation requests and route them to the appropriate partitions.
Cluster provisioning
Once you start the node that is configured withauto-provision = true, it will provision the cluster so that other nodes can join.
The provision step initializes the metadata store and writes the initial NodesConfiguration with the initial cluster configuration to the metadata store.
In case none of the nodes is allowed to auto-provision, then you need to provision the cluster manually via restatectl.
restatectl config set command, e.g. if you add more nodes to the cluster in the future.
Cluster-wide features
At provision time, Restate enables a set of cluster-wide features by default. The resulting feature set is persisted in the cluster’sNodesConfiguration and cannot be changed after provisioning, so review it before you provision a production cluster.
--disable-feature with the feature name.
You can disable several features by repeating the flag or by passing a comma separated list:
restatectl to provision the cluster, will enable all available features.controlled-idempotent-sharding (recommended), which limits the number of partitions keys across which service invocations are sharded.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.
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
List all nodes and their assigned roles
List all nodes and their assigned roles
View log configuration
View log configuration
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 clusters
You can expand an existing cluster by adding new nodes after it has been started.Starting point: single node
- It uses the replicated loglet. If you use local loglet, check this migration guide.
default-replicationis set to 1- Snapshotting is enabled, to ensure that newly added nodes are fully utilized by the system.
Launch new nodes
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.Modify cluster configuration
Output
Output
Output
Output
Managing Replicated Logs
Restate relies on a distributed write-ahead log to durably record data flowing through the cluster. The replicated loglet provider is the default backend for both single- and multi-node cluster logs however, in a distributed deployment, understanding how it works becomes more important for safe operation. You can manage the replicated loglet provider 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
Use theset-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:
Output
Output
N... 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 tool checks whether it is possible to create new nodesets after marking a given node or set of nodes as read-only.
Examine the logs using restatectl logs describe.
Removing Nodes & Shrinking Clusters
You may need to permanently remove nodes from a cluster, whether to replace failing hardware or downsize capacity. This procedure ensures safe node removal without data loss or service interruption. If you are only replacing failing or failed hardware, and intend to keep the cluster at the original size, add replacement nodes first and do not adjust the replication settings. Use these steps only to permanently remove nodes from a cluster; nodes that are only temporarily down should not be removed from the cluster.Review cluster nodes and settings
data-loss.Adjust replication settings (if downsizing)
{node: 3} replication) to a 3-node cluster:Prepare nodes for removal
log-server or worker roles, set the storage state to read-only and worker state to draining on each node you plan to remove. This tells the cluster to reconfigure and move log nodesets and partition replicas to other nodes.N..,[N..] with the comma-separated list of nodes you wish to remove.Remove nodes from metadata server
metadata-server role, remove them from the metadata Raft group:Verify nodes are not in use
- Nodes show
read-onlystorage state - Nodes show
drainingworker state - Nodes are no longer metadata service members
Create partition snapshots
--trim-log, the log trim is delayed by 10 minutes after creating a snapshot by default, which would delay the rest of this procedure.Confirm migration
Stop the node processes
Remove node entries from cluster
Troubleshooting Clusters
Node id misconfiguration puts log server in data-loss state
Node id misconfiguration puts log server in data-loss state
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.Output
Output
logs list and replicated-loglet servers subcommands.Handling missing snapshots
Handling missing snapshots
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.file:// protocol does not support conditional updates, which makes it unsuitable for potentially contended operation.