To back up the NSX Advanced Load Balancer configuration, use the NSX Advanced Load Balancer UI, CLI commands or API commands shown in this section. Backups can be scheduled or on-demand.

Scheduled Backup via NSX Advanced Load Balancer UI

To view or edit the configuration backup scheduler’s current settings, an admin-tenant user first navigates to Administration >System > Configuration Backup.

Note:

The scheduled backups get stored in /var/lib/avi/backups/ on all Avi Controller in the cluster.

To effect changes, click on the edit option. The Backup Scheduler editor appears as below:

  • Enable Configuration Backup: Turns scheduled backups on or off.

  • Frequency: A value from 0 to 60 to combine with Frequency Unit to determine how often backups are to be taken. 0 indicates the backup sequence has no end time.

  • Frequency Unit: Backups occur daily by default. Use this field to change the units to minutes, hours, weeks or months.

  • Backup Passphrase: A passphrase is used to encrypt all sensitive fields contained within the backup. Choose a phrase that is not easy to guess and guard it carefully. Data cannot be restored without it.

Note:

Starting with NSX Advanced Load Balancer release 20.1.1, if a passphrase is not provided, the default backup passphrase is accepted as the export/import passphrase.

  • Local (on Controller): On by default, this switch tells NSX Advanced Load Balancer to preserve the number of indicated backups on the Controller. One can choose the local and remote backup options independently.

  • File Prefix: An optional character string that permits customers to customize the backup archive filename.

  • Number of backups to store: A number ranging from 0 to 20, default is 4. 0 is equivalent to unchecking the Local option. The oldest backup is deleted after the most recent backup successfully completes.

  • Remote Server: This option is off by default. It is recommended that a remote destination be specified in case the NSX Advanced Load Balancer Controller cluster fails in a non-recoverable fashion. One can choose the local and remote backup options independently. Turning this option on causes the Controller to log onto the indicated server using SSH user credentials, and then secure copy (scp) the backup data to the indicated directory.

    • Server Address is an FQDN or IP address reachable from the Controller.

    • User Credentials: Use the pulldown menu to select from a previously-defined SSH user or accept the option to create one.

    • Directory: If a target directory other than the SSH user’s home directory is desired, specify an absolute or relative pathname pointing to a directory to which the SSH user has write access.

Scheduled Backup via CLI

[admin:10-10-24-52]: > configure scheduler Default-Scheduler
+-------------------+------------------------------------------------+
| Field             | Value                                          |
+-------------------+------------------------------------------------+
| uuid              | scheduler-b5f7e673-8818-44d1-8f74-45238cc08235 |
| name              | Default-Scheduler                              |
| enabled           | True                                           |
| run_mode          | RUN_MODE_PERIODIC                              |
| start_date_time   | 2016-10-09T15:35:46.220623                     |
| frequency         | 1                                              |
| frequency_unit    | SCHEDULER_FREQUENCY_UNIT_DAY                   |
| backup_config_ref | Backup-Configuration                           |
| scheduler_action  | SCHEDULER_ACTION_BACKUP                        |
| tenant_ref        | admin                                          |
+-------------------+------------------------------------------------+

[admin:10-10-24-52]:  configure backupconfiguration Backup-Configuration
+------------------------+----------------------------------------------------------+
| Field                  | Value                                                    |
+------------------------+----------------------------------------------------------+
| uuid                   | backupconfiguration-5d65f12e-5da1-49e0-b703-ec65ae9a39c6 |
| name                   | Backup-Configuration                                     |
| save_local             | True                                                     |
| maximum_backups_stored | 4                                                        |
| tenant_ref             | admin                                                    |
+------------------------+----------------------------------------------------------+
One can specify the value of start_date_time from the CLI (not possible via the Avi UI):

[admin:10-10-24-52]: > configure scheduler Default-Scheduler
[admin:10-10-24-52]: scheduler> no enabled
[admin:10-10-24-52]: scheduler> start_date_time 2017-05-11T00:00:00
Overwriting the previously entered value for start_date_time
[admin:10-10-24-52]: scheduler> save
[admin:10-10-24-52]: > configure scheduler Default-Scheduler
[admin:10-10-24-52]: scheduler> enabled
Overwriting the previously entered value for enabled
[admin:10-10-24-52]: scheduler> save

Scheduled Backup via API

In this example a PUT changes the scheduler frequency to 1 week:

PUT : api/scheduler/ {'_last_modified': u'1476209663670990', 'backup_config_ref': 'https://10.10.24.52/api/backupconfiguration/backupconfiguration-5d65f12e-5da1-49e0-b703-ec65ae9a39c6', 'enabled': True, 'frequency': 1, 'frequency_unit': u'SCHEDULER_FREQUENCY_UNIT_WEEK', 'name': u'Default-Scheduler', 'run_mode': u'RUN_MODE_PERIODIC', 'scheduler_action': u'SCHEDULER_ACTION_BACKUP', 'start_date_time': u'2016-10-09T15:35:46.220623', 'tenant_ref': u'https://10.10.24.52/api/tenant/admin', 'url': 'https://10.10.24.52/api/scheduler/scheduler-b5f7e673-8818-44d1-8f74-45238cc08235', 'uuid': u'scheduler-b5f7e673-8818-44d1-8f74-45238cc08235'}

On-demand Backup via NSX Advanced Load Balancer CLI

To back up the NSX Advanced Load Balancer configuration on-demand, at any arbitrary time, use the following CLI command:

: > export configuration file /tmp/avi_config.json full_system Please enter the passphrase to encrypt configuration: Downloaded the attachment to /tmp/avi_config.json Completed writing the export configuration to /tmp/avi_config.json

On-demand Backup via REST API

To back up the NSX Advanced Load Balancer configuration on-demand, at any arbitrary time, use the following API request:

GET https://[CONTROLLER-IP]/api/configuration/export?full_system=true

To include a passphrase, use one of the following options:

In versions 16.1.3 and above:

GET https://[CONTROLLER-IP]/api/configuration/export?full_system=true&passphrase=[PASSPHRASE]

In versions 16.2 and above, use the following POST method and include passphrase in the JSON data:

POST https://[CONTROLLER-IP]/api/configuration/export?full_system=true JSON data: {"passphrase":"[PASSPHRASE]"}

Make sure to replace [CONTROLLER-IP] with the IP address of the NSX Advanced Load Balancer Controller (if using a single NSX Advanced Load Balancer Controller node), or the IP address of the NSX Advanced Load Balancer Controller cluster.

On-demand Backup Script Utilizing Python

Refer to the link below:

https://github.com/avinetworks/sdk/blob/master/python/avi/sdk/samples/avi_config_backup.py

Configuring Backup using Amazon S3

Starting with NSX Advanced Load Balancer release 18.2.3, backup configuration can be stored on Amazon S3 bucket as well.

To enable backup configuration on Amazon S3, use the configure backupconfiguration command and set value of the upload_to_s3 flag to true.

Provide the value of the following attributes to save the backup file on the Amazon S3 bucket for the required instance.

  • aws_access_key : Access Key ID

  • aws_secret_access : Secret Access Key

  • aws_bucket_id : Name of the S3 bucket

[admin:10-1-1-1]: configure backupconfiguration Backup-Configuration
Note:

For enabling NSX Advanced Load Balancer Controller’s backup, you should have write permission to S3 bucket.