Restore Miria PostgreSQL DB – Linux

Tested with Miria installed in folder /Miria on a CentOS 8.4 server.
Standard PostgreSQL port 5433  is used.
Test DB to restore is compressed, named miria-centos8_5433_DATA_Backup.bz2 and located in /root.
Note: this article doesn’t cover the eventual AMM database restore.

  1. Prepare new Linux server
  2. Run first Linux updates
    1. yum update
  3. Reboot for safety
    1. reboot
  4. Install good version of Miria Server + AMM server if needed
  5. Optional: Install Admin UI on a Windows workstation if needed
  6. Optional: Connect to Miria Linux server as root (and define first password) with Admin UI or Web UI
  7. Only if step 6 done: disconnect from DB
  8. Stop services
    1. systemctl stop ADA_ADA
    2. systemctl stop amm_agent
    3. systemctl stop amm_server
    4. systemctl stop amm_db
    5. systemctl stop ADADB_ADA
  9. Check there is no more process with name starting by “ada”
    1. ps -ef | grep -i ada
  10. Rename actual data folder to data.old
    1. cd /Miria/Database/PostgreSQL
    2. mv data data.old
  11. Copy an empty data cluster (provided by Miria)
    1. mkdir data
    2. cp /Miria/Tools/empty_ADA_cluster.tgz /Miria/Database/PostgreSQL/data/
    3. gunzip data/empty_ADA_cluster.tgz
    4. cd data
    5. tar -xvf empty_ADA_cluster.tar
    6. cd ..
    7. mkdir data/log
    8. sudo chown -R postgres:postgres data
    9. sudo chmod -R 700 data
  12. Copy the previous database configuration
    1. cp data.old/postgresql.conf data/
      1. Answer “y” to replace the existing file
  13. Restart the PostgreSQL ADADB_ADA service
    1. systemctl start ADADB_ADA
  14. Unzip the backup file
    1. bunzip2 /root/miria-centos8_5433_DATA_Backup.bz2
  15. Restore the database
    1. su postgres
    2. cd /Miria/Database/PostgreSQL/bin
    3. ./psql -p 5433 -q -f ../miria-centos8_5433_DATA_Backup
      1. Enter “postgres” without the quote as password
    4. exit (when finished)
  16. Restart Miria services
    1. systemctl start amm_db
    2. systemctl start amm_server
    3. systemctl start amm_agent
    4. systemctl start ADA_ADA