Skip to content

feat: LVM snapshots/clone as an alternative to ZFS

Anatoly Stansler requested to merge 88-lvm-support into master

Description

This MR introduces support of LVM2 volume manager in addition to previously available ZFS support. Database Lab user can now choose volume manager which suits his needs. Both volume managers have its own pros and cons, although we recommend to use ZFS. The main difference is that ZFS support thin-cloning from different snapshots of file system (cloning from different timestamps) and LVM not.

Changes:

  • First iteration of provision package refactoring
  • Package for working with LVM
  • ModeZFS is now ModeLocal
  • New VolumeManager interface

Config changes (update required):

  • mode: "zfs" -> mode: "local"
  • zfs -> local
  • volumeManager added, available options: "zfs", "lvm"

CI:

  • Build containers for feature branches and push them to GitLab storage (only latest)

sudo su -

# Create Physical Volume and Volume Group.
pvcreate /dev/disk/by-id/google-dblab-dev1-lvm1
vgcreate dblab_vg /dev/disk/by-id/google-dblab-dev1-lvm1

# Create Logical Volume for PGDATA.
lvcreate -l 10%FREE -n pg_lv dblab_vg
mkfs.ext4 /dev/dblab_vg/pg_lv
mkdir -p /var/lib/dblab/data
mount /dev/dblab_vg/pg_lv /var/lib/dblab/data

# Initialize DB with pgbench.
mkdir -p /var/lib/dblab-lvm/data/pgdata
#   Generate database with pgbench.

# Configure Database Lab.
#   mode: local
#   volumeManager: lvm
#   pool: dblab_vg/pg1_lv
#   pgDataSubdir: /pgdata/ # Required for LVM.

Related issue

Closes #103 (closed) #88 (closed) !74 (merged)

Examples

Checklist

  • the MR description has been reviewed
  • this MR contains text changes and they have been reviewed OR there are no texts changes
  • this MR contains GUI/CLI changes and they have been reviewed OR there are no GUI/CLI changes
  • this MR contains API changes, specifications reflect those changes and they have been reviewed OR there are no API changes
Edited by Anatoly Stansler

Merge request reports