If you backed up the embedded PostgreSQL database of a VMware Cloud Director appliance environment with an HA database configuration, you can deploy a new appliance cluster and restore the appliance database in it.

The restore workflow includes three major stages.

  • Copying the embedded database backup .tar file from the transfer service NFS shared storage.
  • Restoring the database to the embedded database primary and standby cells.
  • Deploying any required application cells.

Prerequisites

Procedure

  1. On the primary and standby cells, log in as root, and run the command to stop the VMware Cloud Director service.
    service vmware-vcd stop
  2. On the primary and standby cells, copy the backup .tar file to the /tmp folder.

    If there is not enough free space on the /tmp folder, use another location to store the .tar file.

  3. On the primary and standby cells, untar the backup file at /tmp.
    tar -zxvf db-backup-date_time_format.tgz

    In the /tmp folder, you can see the extracted global.properties, responses.properties, certificates.pem, certificates.key, proxycertficates.pem, proxycertficates.key, truststore.pem, and the database dump file named vcloud_date_time_format.

    Note: The truststore.pem file is only available for VMware Cloud Director 10.2.2 and later.
  4. On the primary cell only, log in as root to the console and run the following commands.
    1. Drop the vcloud database.
      sudo -i -u postgres /opt/vmware/vpostgres/current/bin/psql -c 'DROP DATABASE vcloud;'
    2. Run the pg_restore command.
      sudo -i -u postgres /opt/vmware/vpostgres/current/bin/pg_restore -C -d postgres /tmp/vcloud_date_time_name
  5. On the primary and standby cells, save a copy of the configuration data files, replace them, and reconfigure and start the VMware Cloud Director service.
    1. Back up the properties, certificates, private keys, and truststore files.

      The global.properties, responses.properties, certificates.pem, certificates.key, proxycertificates.pem, proxycertificates.key, user.http.pem, user.http.key, user.consoleproxy.pem, user.consoleproxy.key, and truststore.pem files are at /opt/vmware/vcloud-director/etc/.

      cd /opt/vmware/vcloud-director/etc
      mkdir -p backup
      cp global.properties responses.properties certificates.* proxycertificates.* truststore.* user.* backup
    2. Copy and replace the properties, certificates, private keys, and truststore files from the backup files that you extracted at Step 3.
      cd /tmp
      cp global.properties responses.properties certificates.* proxycertificates.* truststore.* user.* /opt/vmware/vcloud-director/etc/
    3. Run the following commands to reconfigure the VMware Cloud Director service.
      /opt/vmware/vcloud-director/bin/configure --unattended-installation --database-type postgres --database-user vcloud \
      --database-password db_password_new_primary --database-host eth1_ip_new_primary --database-port 5432 \
      --database-name vcloud --uuid --cert /opt/vmware/vcloud-director/etc/user.http.pem --key /opt/vmware/vcloud-director/etc/user.http.key --key-password key_password --consoleproxy-cert /opt/vmware/vcloud-director/etc/user.consoleproxy.pem --consoleproxy-key /opt/vmware/vcloud-director/etc/user.consoleproxy.key --consoleproxy-key-password key_password --primary-ip appliance_eth0_ip \
      --console-proxy-ip appliance_eth0_ip --console-proxy-port-https 8443 
      /opt/vmware/vcloud-director/bin/cell-management-tool reconfigure-database --database-ssl true
      Where:
      • The --key-password and --consoleproxy-key-password options match the passwords for the private keys on the appliance. The private key password might be the root password you used during the appliance deployment.
      • The --database-password option matches the database password that you set during the appliance setup in the VMware Cloud Director appliance management UI at https://appliance_eth0_ip:5480.
      • The --database-host option matches the eth1 network IP address of the primary database appliance.
      • The --primary-ip value matches the eth0 network IP address of the appliance cell that you are restoring. This is not the primary database cell IP address.
      • The --console-proxy-ip option matches the eth0 network IP address of the appliance that you are restoring.

      For troubleshooting information, see Reconfiguring the VMware Cloud Director Service Fails When Migrating or Restoring to VMware Cloud Director Appliance.

    4. Run the command to start the VMware Cloud Director service.
      service vmware-vcd start

      You can monitor the progress of the cell startup at /opt/vmware/vcloud-director/logs/cell.log.

  6. (Optional) Deploy any additional application cells. See Deployment and Initial Configuration of the VMware Cloud Director Appliance.
  7. If the new appliances use different IPs than the original appliances that you are replacing, you must update the configuration of the load balancer which fronts the VMware Cloud Director server group to include the IPs of the new appliances.
  8. After all cells of the server group finish the startup process, verify that the restore of your VMware Cloud Director environment is successful.
    1. Open the VMware Cloud Director Service Provider Admin Portal by using the eth0 network IP address of any cell from the new server group, https://et0_IP_new_cell/provider.

      If you updated the load balancer configuration as per step 7, you must use the public address of the server group to access the Service Provider Admin Portal.

    2. Log in to the Service Provider Admin Portal with your existing system administrator credentials.
    3. Validate that your vSphere and cloud resources are available in the new environment.
  9. After the successful verification of the database restore, use the Service Provider Admin Portal to delete the disconnected cells that belong to the old VMware Cloud Director environment.
    1. From the top navigation bar, under Resources, select Cloud Resources.
    2. In the left panel, click Cloud Cells.
    3. Select an inactive cell and click Unregister.
  10. If the failover mode before the restore was Automatic, you must set it again to Automatic by using the VMware Cloud Director appliance API.
  11. If the VMware Cloud Director appliance FIPS mode was on before the restore, you must set it again by using the VMware Cloud Director appliance API.

    The cell FIPS mode restores automatically.