Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Upgrading Contrail Command using Backup Restore Procedure

date_range 18-Jul-23

You cannot use the SQL data with the new version of Contrail Command container if the database schema changes while upgrading the Contrail Command container.

You can resolve the issue by:

  1. Back up SQL database in yaml format db dump.

    Run the following docker exec contrail_command command on the Contrail Command node to backup the DB.

    Contrail Networking Release 2005 or later:

    docker exec contrail_command commandutil convert --intype rdbms --outtype yaml --out /etc/contrail/db.yml -c /etc/contrail/command-app-server.yml; mkdir ~/backups; mv /etc/contrail/db.yml ~/backups/

    Contrail Networking Release 2003 or earlier:

    docker exec contrail_command contrailutil convert --intype rdbms --outtype yaml --out /etc/contrail/db.yml -c /etc/contrail/contrail.yml; mkdir ~/backups; mv /etc/contrail/db.yml ~/backups/

  2. Upgrade the Contrail Command container.

    Specify the desired version of Contrail Command container (container_tag) in the deployer input file (command_servers.yml) and deploy playbook.

    You must use PostgreSQL in the command_servers.yml file.

    The step depends on how you have deployed the Contrail Command.

    • Contrail Command is deployed using docker installation:

      docker run -td --net host -v <ABSOLUTE_PATH_OF_COMMAND_SERVERS_FILE>:/command_servers.yml --privileged --name contrail_command_deployer_<contrail_container_tag> hub.juniper.net/contrail/contrail-command-deployer:<<contrail_container_tag>

    • Contrail Command is deployed through juju-charms:

      juju config contrail-command image-tag=<contrail_container_tag>

      After entering this command, enter the juju config contrail-command image-tag command to ensure the Contrail Command container is associated with the new image tag.

      If the command output displays the old image tag, wait several minutes then retry the juju config contrail-command image-tag command.

      If the command output displays the new image tag, proceed to the next step. If the command output continues to display the old image tag, re-enter the juju config contrail-command image-tag=contrail_container_tag to upgrade the container.

    The contrail_container_tag for any Contrail Release 20 software can be obtained from README Access to Contrail Networking Registry 20xx.

  3. This step depends on your Contrail Networking release.

    Contrail Networking Release 2005 or later:

    Migrate the yaml formatted db dump to the new database schema:

    content_copy zoom_out_map
    docker exec contrail_command mkdir /root/backups 
    docker cp /root/backups/db.yml contrail_command:/root/backups/ 
    docker exec contrail_command commandutil migrate --in /root/backups/db.yml --out /root/backups/db_migrated.yml

    Contrail Networking Release 2003 or earlier:

    Modify the yaml-formatted db dump by adding or removing the fields per the new database schema.

  4. Restore the modified yaml formatted db dump to the SQL database.

    Contrail Networking Release 2005 or later:

    content_copy zoom_out_map
    docker exec contrail_command commandutil convert --intype yaml --in /root/backups/db_migrated.yml --outtype rdbms -c /etc/contrail/command-app-server.yml

    Contrail Networking Release 2003 or earlier:

    content_copy zoom_out_map
    docker exec contrail_command mkdir /root/backups docker cp /root/backups/db.yml contrail_command:/root/backups/
    docker exec contrail_command contrailutil convert --intype yaml --in ~/backups/db.yml --outtype rdbms -c /etc/contrail/contrail.yml
Note:

If the restore procedure fails because of schema mismatch, repeat Step 3 and Step 4 with incremental db dump changes.

footer-navigation