Restore Apstra Database
Always restore a database from a new backup, never from older backups or from the backup included in a show_tech.
When you restore a database, the worker VMs will go into a failed state. This problem also occurs when you restore a backup to another worker VM with the same IP address. To fix this issue, add the worker VMs again.
If you make changes after you back up the database, those changes aren't included in the restore. This could create differences between device configs and the Apstra environment. If this happens, you must perform a full config push, which is service-impacting.
Don't restore a database using the backup included in a show_tech. Juniper Support and Engineering use it for analysis. It doesn't include credentials, so it's not suitable for restoring your production environment.
If you're restoring a backup to a new Apstra server that uses a different network
interface for access (eth1 vs eth0 for example), you must update the
metadb
variable in the [controller]
section of the /etc/aos/aos.conf
configuration file, then
restart the Apstra server.
-
Verify that the contents of the snapshot folder are on the filesystem. Backups
are saved as dated snapshots
(
/var/lib/aos/snapshot/<date>/aos.data.tar.gz
). The file must be namedaos.data.tar.gz
.admin@aos-server:~$ sudo ls -lah /var/lib/aos/snapshot/2023-06-29_18-40-03 [sudo] password for admin: total 49M drwx------ 3 root root 4.0K Jun 29 18:40 . drwx------ 7 root root 4.0K Jun 29 18:40 .. -rw------- 1 root root 49M Jun 29 18:40 aos.data.tar.gz -rwxr-xr-x 1 root root 2.6K Jun 29 18:40 aos_restore -rw------- 1 root root 1 Jun 29 18:40 comment.txt drwx------ 2 root root 4.0K Jun 29 18:40 metadata admin@aos-server:~$
-
Run the
aos_restore
command as illustrated below. The restore process first backs up the current database.admin@aos-server:~$ sudo bash /var/lib/aos/snapshot/2023-06-29_18-40-03/aos_restore Including secret keys from the backup Include all sysdb files New AOS snapshot: 2023-06-29_19-31-43 [+] Stopping 5/5 ✔ Container aos_nginx_1 Stopped 0.2s ✔ Container aos_metadb_1 Stopped 10.6s ✔ Container aos_sysdb_1 Stopped 10.4s ✔ Container aos_auth_1 Stopped 10.5s ✔ Container aos_controller_1 Stopped 10.7s (Reading database ... 83485 files and directories currently installed.) Removing aos-compose (99.0.0-5949) ... tar: Removing leading `/' from member names /var/lib/aos/db/ /var/lib/aos/db/_AosAuth-0000000064947a9d-000b0094-log /var/lib/aos/db/_Main-0000000064947aa0-000a1865-log-valid /var/lib/aos/db/_AosAuth-0000000064947a9d-000b0094-checkpoint-valid /var/lib/aos/db/_Main-0000000064947aa0-000a1865-log /var/lib/aos/db/_Main-0000000064947aa0-000a1865-checkpoint-valid /var/lib/aos/db/_Central-0000000064947a9e-000b9681-log /var/lib/aos/db/_AosSysdb-0000000064947a9d-000c83d2-checkpoint-valid /var/lib/aos/db/_AosAuth-0000000064947a9d-000b0094-log-valid /var/lib/aos/db/_AosAuth-0000000064947a9d-000b0094-checkpoint /var/lib/aos/db/_AosSysdb-0000000064947a9d-000c83d2-log-valid /var/lib/aos/db/.devpi/ /var/lib/aos/db/.devpi/server/ /var/lib/aos/db/.devpi/server/.nodeinfo /var/lib/aos/db/.devpi/server/.sqlite /var/lib/aos/db/.devpi/server/.serverversion /var/lib/aos/db/.devpi/server/.event_serial /var/lib/aos/db/_Main-0000000064947aa0-000a1865-checkpoint /var/lib/aos/db/_Metadb-0000000064947a9d-000b82ea-log /var/lib/aos/db/_Metadb-0000000064947a9d-000b82ea-log-valid /var/lib/aos/db/_AosSysdb-0000000064947a9d-000c83d2-log /var/lib/aos/db/blueprint_backups/ /var/lib/aos/db/blueprint_backups/configlets/ /var/lib/aos/db/blueprint_backups/configlets/167/ /var/lib/aos/db/blueprint_backups/configlets/167/graph.md5sum /var/lib/aos/db/blueprint_backups/configlets/167/graph.json.zip /var/lib/aos/db/blueprint_backups/configlets/161/ /var/lib/aos/db/blueprint_backups/configlets/161/graph.md5sum /var/lib/aos/db/blueprint_backups/configlets/161/graph.json.zip /var/lib/aos/db/blueprint_backups/configlets/166/ /var/lib/aos/db/blueprint_backups/configlets/166/graph.md5sum /var/lib/aos/db/blueprint_backups/configlets/166/graph.json.zip /var/lib/aos/db/blueprint_backups/configlets/164/ /var/lib/aos/db/blueprint_backups/configlets/164/graph.md5sum /var/lib/aos/db/blueprint_backups/configlets/164/graph.json.zip /var/lib/aos/db/blueprint_backups/configlets/163/ /var/lib/aos/db/blueprint_backups/configlets/163/graph.md5sum /var/lib/aos/db/blueprint_backups/configlets/163/graph.json.zip /var/lib/aos/db/_Central-0000000064947a9e-000b9681-log-valid /var/lib/aos/db/_AosSysdb-0000000064947a9d-000c83d2-checkpoint /var/lib/aos/db/_Metadb-0000000064947a9d-000b82ea-checkpoint-valid /var/lib/aos/db/_AosController-0000000064947aa0-000d40b6-log /var/lib/aos/db/_AosController-0000000064947aa0-000d40b6-checkpoint /var/lib/aos/db/_Auth-0000000064947a9e-000a44d7-checkpoint /var/lib/aos/db/_Central-0000000064947a9e-000b9681-checkpoint /var/lib/aos/db/_Central-0000000064947a9e-000b9681-checkpoint-valid /var/lib/aos/db/_AosController-0000000064947aa0-000d40b6-log-valid /var/lib/aos/db/_Auth-0000000064947a9e-000a44d7-checkpoint-valid /var/lib/aos/db/_Auth-0000000064947a9e-000a44d7-log /var/lib/aos/db/_Auth-0000000064947a9e-000a44d7-log-valid /var/lib/aos/db/_Metadb-0000000064947a9d-000b82ea-checkpoint /var/lib/aos/db/_AosController-0000000064947aa0-000d40b6-checkpoint-valid /var/lib/aos/anomaly/ /var/lib/aos/anomaly/_Anomaly-0000000064947a9e-000c9d0a-checkpoint-valid /var/lib/aos/anomaly/_Anomaly-00000000649452ff-00034e81-checkpoint /var/lib/aos/anomaly/_Anomaly-00000000649452ff-00034e81-checkpoint-valid /var/lib/aos/anomaly/_Anomaly-0000000064947a9e-000c9d0a-checkpoint /var/lib/aos/anomaly/_Anomaly-00000000649452ff-00034e81-log-valid /var/lib/aos/anomaly/_Anomaly-0000000064947a9e-000c9d0a-log /var/lib/aos/anomaly/_Anomaly-00000000649452ff-00034e81-log /var/lib/aos/anomaly/_Anomaly-0000000064947a9e-000c9d0a-log-valid /etc/aos/aos.conf /etc/aos-img-chksum/ /etc/aos-img-chksum/checksums.signed /etc/aos-img-chksum/checksums /etc/aos-img-chksum/key.pub /opt/aos/aos-compose.deb /opt/aos/frontend_images/ /opt/aos/frontend_images/jinja_docs.zip /opt/aos/frontend_images/sdt_docs.zip /opt/aos/frontend_images/aos-web-ui.zip /etc/aos/version /etc/aos-auth/secret_key /etc/aos-credential/secret_key Selecting previously unselected package aos-compose. (Reading database ... 83454 files and directories currently installed.) Preparing to unpack /opt/aos/aos-compose.deb ... Unpacking aos-compose (99.0.0-5949) ... Setting up aos-compose (99.0.0-5949) ... Verifying checksums for docker images... Signature Verified Successfully Verified. [+] Building 0.0s (0/0) [+] Running 5/5 ✔ Container aos_nginx_1 Started 0.3s ✔ Container aos_metadb_1 Started 0.2s ✔ Container aos_sysdb_1 Started 0.2s ✔ Container aos_auth_1 Started 0.2s ✔ Container aos_controller_1 Started 0.3s admin@aos-server:~$
-
When the database has been restored and migrated to a new server, the entire
system state has been copied from the backed up installation to the new target.
Run the command
service aos status
to validate the restoration.admin@aos-server:~$ sudo service aos status ● aos.service - LSB: Start AOS management system Loaded: loaded (/etc/init.d/aos; generated) Active: active (exited) since Thu 2023-06-22 16:45:14 UTC; 1 week 0 days ago Docs: man:systemd-sysv-generator(8) CPU: 433ms Jun 22 16:45:14 aos-server aos[1512]: Container aos_sysdb_1 Starting Jun 22 16:45:14 aos-server aos[1512]: Container aos_controller_1 Starting Jun 22 16:45:14 aos-server aos[1512]: Container aos_nginx_1 Starting Jun 22 16:45:14 aos-server aos[1512]: Container aos_metadb_1 Starting Jun 22 16:45:14 aos-server aos[1512]: Container aos_nginx_1 Started Jun 22 16:45:14 aos-server aos[1512]: Container aos_metadb_1 Started Jun 22 16:45:14 aos-server aos[1512]: Container aos_controller_1 Started Jun 22 16:45:14 aos-server aos[1512]: Container aos_sysdb_1 Started Jun 22 16:45:14 aos-server aos[1512]: Container aos_auth_1 Started Jun 22 16:45:14 aos-server systemd[1]: Started LSB: Start AOS management system. admin@aos-server:~$
-
The database is stored on the Apstra server itself. If the server needs to be
restored or if its disk image becomes corrupt, any backups/restores are lost
along with the Apstra server. We recommend that you periodically move
backups/restores off of the Apstra server to a secure location. Also, if you've
scheduled cron jobs to periodically backup the
database, make sure to rotate those files off of the Apstra server to keep the
Apstra server VM disk from becoming full. Copy the contents of the snapshot
directory to your backup infrastructure.
admin@aos-server:~$ sudo ls -lah /var/lib/aos/snapshot/ total 32K drwx------ 8 root root 4.0K Jun 29 19:31 . drwxr-xr-x 13 root root 4.0K Jun 29 19:32 .. drwx------ 3 root root 4.0K Jun 29 15:44 2023-06-29_15-44-51 drwx------ 3 root root 4.0K Jun 29 15:45 2023-06-29_15-45-37 drwx------ 3 root root 4.0K Jun 29 16:21 2023-06-29_16-21-36 drwx------ 3 root root 4.0K Jun 29 18:11 2023-06-29_18-11-34 drwx------ 3 root root 4.0K Jun 29 18:40 2023-06-29_18-40-03 drwx------ 3 root root 4.0K Jun 29 19:31 2023-06-29_19-31-43 admin@aos-server:~$