Service Primitives
Volumes
Persistent disks attached to instances.
A volume is a persistent filesystem an instance mounts at a path, 1 to 256 GB, living on one node's disk.
Put a volume block on a deployment and you get one volume per replica. Replica n always gets volume n back, through restarts, rollouts and scaling.
A deployment named db with three replicas has three volumes, db-0 to db-2, all on node-a. Scaling to two stops the third instance but keeps db-2 with its data. Scaling back to three gives the new instance db-2 again.
You can also create a volume on its own and attach it to an instance you start.
Things to know
- One writer. A volume is attached to one instance at a time, so rollouts stop before they start. A single-replica deployment has a short gap on every rollout.
- A volume pins its node. If that node is down, so is that replica.
- Size and mount path are fixed. Changing either in
unisrv.hclreplaces the deployment with one that starts empty. - Deleting a deployment keeps its volumes. They stay in the environment, detached, until you delete them.
A volume is one disk on one machine, not replicated. Back up anything you can't lose.
CLI HCL reference: volume.