When creating a volume I am getting this warning:
Warning! Every volume is pinned to a specific physical host. You should create two or more volumes per application to avoid downtime. Learn more at Fly Volumes overview · Fly Docs
I have looked at the docs and have some questions.
Does this mean something like this?
fly volumes create primary_volume --size 5 --region ord
fly volumes create backup_volume --size 5 --region ord
[mounts]
source = “primary_volume”
destination = “/data”
[mounts]
source = “backup_volume”
destination = “/backup”
Then in my app I check if /data is available if so use it if not use /backup ?
if my primary volume fails for some reason will everything keep going or will the VM crash ?
Am I missing anything here ?
What is the common pattern used here for a backup volume if the main volume fails ?
Using LiteFS as an example, this just means to have ≥2 Machines, each of which would inherently have its own volume.
(You would want that anyway; otherwise, there’s no point in using LiteFS!)
Machine A’s volume is the backup for Machine B’s volume, and Machine B’s volume is the backup for Machine A’s.
The LiteFS machinery keeps the two of them in synch automatically, so when one of the underlying physical host machines fails (which it inevitably will), then you will lose at most a few seconds of data.
Hope this helps!
Aside: Volumes are never shared on the Fly.io platform, which surprises a lot of people at first. They really are just a slice of the physical host machine’s local NVMe drive. Also, a Machine cannot run without its volume.
Aside2: For LiteFS, the [mounts]
stanza would typically be…
[mounts]
source = "litefs"
destination = "/var/lib/litefs"
And you generally wouldn’t have a second [mounts]
section. The source
field is a kind of selector, and does not uniquely identify a volume. Instead, it’s more of a family of volumes—which can be attached to a related family of Machines.
(The Fly.io platform’s approach to volumes is rather nuanced and idiosyncratic, taking even long-term users by surprise sometimes…)
1 Like
Thanks, I guess they could be a little clearer with the warning