Version 3.12.1

3.5.1. Job storage options

All backup job configurations except inc_files contain identical storage options. Below is an example of settings for storing backups on local storage.

storages_options: 
  - storage_name: local
    backup_path: /var/nxs-backup/dump
    retention:
      days: 7
      weeks: 4
      months: 6

Remote storage

If you want to use remote storage to copy your backups, use the corresponding storage name. The storage name must be declared and configured in the main config in the `storage_connects` block of the main config (nxs-backup.conf).

If you want to use remote storage to copy your backups for long storing, use the corresponding storage name and its retention parameters.

Example of usage s3 remote storage and its retention parameters.

storages_options:
- storage_name: s3_aws
  backup_path: /backups/dump
  retention:
    days: 30
    weeks: 0
    months: 12

Disabling backups rotation

In some specific cases, you may need the ability to disable backup rotation on the storage. For example, if a user without deletion rights is used to upload backups to the storage. In this case, use the enable_rotate parameter with the value false and configure retention according to your desire to deliver copies daily/weekly/monthly.

storages_options:
  - storage_name: s3
    backup_path: /backups/databases
    enable_rotate: false
    retention:
      days: 1
      weeks: 0
      months: 0

Warning! When disabling rotation, you should delete outdated backups yourself to avoid filling up your storage.

Store a certain number of backups

In some exceptional cases, you may need to store a strictly defined number of backups. For example, if you additionally want to collect a database dump once an hour and store 24 copies.

In this case, create an additional backup job and specify the count_instead_of_period parameter with a value of true in the storage retention options.

storages_options: 
  - storage_name: local
    backup_path: /backups/hourly_dump
    retention: 
      count_instead_of_period: true 
      days: 24 
      weeks: 0 
      months: 0 

In this example, the daily copies subdirectory will strictly hold 24 backups, regardless of how often nxs-backup is run.

Storages options reference

# List of storages to which backups should be delivered and their rotation rules
storages_options: list 
    # The name of the storage added to the main config. The name `local` is used to store a copy on host.
  - storage_name: string # Reuired
    # Path to directory where backups will be stored
    backup_path: string # Reuired
    # Enables backup rotation according to retention parameters.
    enable_rotate: bool # Default: true
    # Set of rules to store and rotate the backups.
    retention: map 
      # Use backup retention count instead of retention period.
      count_instead_of_period: bool # Default: false
      # Count of days/daily copies to store backups. Multiple copies can be created in one day.
      days: numeric # Default: 7
      # Count of weeks/weekly copies to store backups created on sunday.
      weeks: numeric # Default: 5
      # Count of months/montly copies to store backups created on the first day of month.
      months: numeric # Default: 12