When the primary appliance fails, you can perform a database failover.

When the primary appliance fails, the secondary database is read-only. When failover occurs, perform the following tasks:

  • Enable write operations on the secondary database

  • Permanently promote the secondary appliance to become the primary appliance

  • Restart the primary appliance

Enable Write Operations on the Secondary Database

The goal of this procedure is to switch the master database to the secondary appliance (tenant or service provider) if the primary appliance is not available. The goal is to enable write operations so that the secondary appliance's database is the master datasource.

  1. Stop the dtService, av-manager, and diagnose service on both the primary (if accessible) and the secondary appliance:

    sudo service dtService stop
    sudo service av-manager stop
    sudo service diagnose stop
  2. Stop all slony daemons on both the primary (if accessible) and the secondary appliances:

    sudo killall slon
  3. On the secondary appliance, connect to the fdb database and execute the following SQL command:

     drop schema _slony cascade;
  4. Repeat step 3 for the EDB and AVDB if the appliance belongs to a tenant organization.

  5. If the database on the primary appliance is still accessible, then backup the database, copy the database files, and restore the database into the secondary appliance (see Backing Up and Restoring Databases).

  6. Open the file /usr/local/desktone/release/active/conf/fdb.properties for edit and remove the IP address of the primary appliance.

  7. Repeat step 6 for /usr/local/desktone/release/active/edb.properties if the appliance belongs to a tenant organization.

  8. Repeat step 6 for /usr/local/desktone/release/active/avdb.properties if the appliance belongs to a tenant organization.

  9. Set DB_HOST and DB_PASSWORD environment variables:

    export DB_HOST=IP_of_TA2_appliance
    export DB_PASSWORD=database_password
    
  10. Execute av-setup script as sudo:

    sudo /usr/local/desktone/scripts/av-setup
  11. Open the applications.properties file for editing:

    vi /usr/local/xmpms/diagnose/config/application.properties
  12. In the applications.properties file, edit lines as follows:

    db.jdbc.url=jdbc:postgresql://<ip address>:5432/avdb?ssl=true
    db.fdb.jdbc.url=jdbc:postgresql://<ip address>:5432/fdb?ssl=true
    
  13. Start dtService, av-manager, and diagnose service on the secondary appliance:

    service dtService start
    service av-manager start
    service diagnose start

Promote the Secondary Appliance to Primary Appliance

To permanently promote the secondary appliance to be the primary appliance, you need to reinitialize slony as described in Reinitialize Slony.

Restart the Primary Appliance

When you restart the primary appliance after failover, perform a slony reinitialization on both the edb and avdb.