Move the datamart (dedicated database server mode)

The setup with all services on one server includes having the datamart in the same PostgreSQL instance as TeamForge as well as running it on a separate instance. In either case, you can move the PostgreSQL datamart from its own instance to a separate box in the dedicated database server mode.

  1. Stop TeamForge on the app box. If you have a distributed setup, stop TeamForge on all other servers as well.
    • /etc/init.d/collabnet stop
  2. Create a dump of the PostgreSQL datamart.
    • su - postgres -c 'pg_dump -C -p <database-port > <reports-database-name > <path-to-dump-file>
  3. Create a new datamart instance using the datamart-pgsql-setup.sh or use the following commands on the database server.
    • su - postgres
    • initdb -D /var/lib/pgsql/9.6/reports
  4. Set the REPORTS_DATABASE_PORT token in site-options.conf file.
    Note: The port should use the same value as specified in postgresql.conf as specified in the previous step. The recommended value is 5632.
  5. Deploy services.
    • /opt/collabnet/teamforge/bin/teamforge provision
    Note:

    The "provision" command prompts for response before it bootstraps or migrates data during TeamForge installation and upgrade respectively. Enter "y" or "N" to proceed. For more information, see the TeamForge script.

    TeamForge 17.4 (and later) installer expects the system locale to be LANG=en_US.UTF-8. TeamForge "provision" command fails otherwise.

  6. Restore the datamart into the new instance.
    • /opt/collabnet/teamforge/runtime/scripts/db.py -a restore -t reporting -f <dump-location>
  7. Copy the postgresql-9.6 script from runtime scripts and replace /etc/init.d/postgresql-9.6
  8. Restore the datamart from the database box.
    • su - postgres -c 'psql -p <reports-database-port> <path-to-dump-file>
    Note: Restart the PostgreSQL service. If any warning messages are displayed, kill the service and start again.
  9. Start the PostgreSQL service on the database server.
    • /opt/collabnet/teamforge/bin/teamforge start -s postgres
  10. Start the services on all the servers.
    • /opt/collabnet/teamforge/bin/teamforge start
  11. Check your old reports for data accuracy.
  12. Permanently remove the old datamart from the TeamForge instance.
    • su - postgres -c 'dropdb <datamart-name> -p <database-port>'