Migrating Intigua existing data to a new database.

This article explain how to migrate data from existing H2 database, to a new Postgres database.

Installing up Postgres

If you don't have postgres installed, installed it: yum install postgresql-server service postgresql initdb chkconfig postgresql on service postgresql start

Setting up Postgres

edit the DB as specified in the document: Edit: /var/lib/pgsql/data/postgresql.conf Change connection settings: listen_addresses = '*' port = 5432 Edit /var/lib/pgsql/data/pg_hba.conf right under "# IPv4 local connections" add the following line: host all all md5 "# IPv6 local connections" add the following line: host all all ::/0 md5

Configure for Intigua

setup intigua user and db: Create intigua user sudo -u postgres psql and then: CREATE USER intigua WITH encrypted PASSWORD 'myPassword'; create database intiguadb; GRANT ALL PRIVILEGES ON DATABASE intiguadb to intigua; to quit type: \q

Migrating data

Note: before migrating the Data, make sure you are running Intigua 2.8 and up. Steps:
  • Stop the nginx service: service nginx stop
  • edit /usr/share/tomcat/default/conf/ Change the database properties, to point to the postgres dtabase. for Example:
  • Construct the database schema. Intigua will do that automatically when it starts, so just start tomcat using service tomcat start. Wait for it to load (for example, use wget -qO - localhost:8080/vmanage-server to test if the login page has loaded)
  • Once tomcat has started successfully, stop it service tomcat stop
  • Now migrate the data using the migration tool. Example:
    java -jar intigua-db-migrator-0.0.65-jar-with-dependencies.jar --sourceUrl jdbc:h2:/usr/share/intigua/intigua-ms-db/intigua-ms-database --sourceUser sa --sourcePassword sa --targetUrl jdbc:postgresql://localhost:5432/intiguadb --targetUser intigua --targetPassword myPassword 

once the migration tool has completed successfully, we are done migrating the data. you can now start intigua: service nginx start
service tomcat start