forked from longhorn/longhorn
-
Notifications
You must be signed in to change notification settings - Fork 0
Best practices for deploying Longhorn in production
Sheng Yang edited this page May 8, 2020
·
12 revisions
- Minimal of 3 nodes
- 4 vCPUs per node or more.
- 4 GiB per node or more.
- Ubuntu 18.04
- CentOS 7/8
- It's recommended to dedicate a disk for Longhorn storage for production, instead of using the root disk.
- If you need to use the root disk, use the default
minimal available storage percentage
setup which is 25%, and setoverprovisioning percentage
to 200% to minimize the chance of DiskPressure. - If you're using a dedicated disk to Longhorn, you can lower the setting
minimal available storage percentage
to 10%. - On Overprovisioning percentage, it depends on how much space does your volume use on average. For example, if your workload only used half of the available volume size, you can set Overprovisioning percentage to
200
, which means Longhorn will consider the disk has twice the schedulable size as it's full size minus the reserved space.
- If you need to use the root disk, use the default
- Since Longhorn doesn't support sharding between the different disks at the moment, it's recommended to use LVM to aggregate all the disks for Longhorn into a single partition, so it can be easily extended in the future.
- Any extra disks must be written in the
/etc/fstab
to allow automatic mounting after the machine reboots. - Don't use symbolic link for the extra disks. Use
mount --bind
instead ofln -s
and make sure it's in thefstab
. See here for details.
- For using a directory other than the default
/var/lib/longhorn
for storage, change the settingDefault Data Path
before installing the system.- You can also use
Default node/disk configuration
feature to customize the default disk after installation. Remember to enableCreate default disk only on labeled node
if you want to use it.
- You can also use
If you're using ext4
as the filesystem of the volume, adding liveness check to workload can help automatically recovery from network caused interruption or node reboot/docker restart. See https://longhorn.io/docs/0.8.0/users-guide/recover-volume/ for details.
- We highly recommend using the built-in backup feature of Longhorn.
- For each volume, schedule at least one recurring backup. If you must run Longhorn in production without backupstore, then schedule at least one recurring snapshot for each volume.
- Longhorn system will create snapshots automatically when rebuilding a replica. Recurring snapshot or backup can also automatically clean up the system generated snapshot.