Download Instance Copy

(Blake Erhardt-Ohren) #1

I want to download a copy of our instance to send for hosting on a new server. How do I download this copy?

2 Likes

(Herbert Kiwalya) #2

@dhis2-backend is it possible?

0 Likes

(Kelvin Murumba) #3

The easiest way is always to backup the database and export to the new instance. @herbert_kiwalya. The Instance has all of its details in the database. Then restore to the new instance created in the new server.

1 Like

(M.Selvaraaj Prabu) #4

Yes, @KMurumba is correct. I always take a backup of our DHIS2 instance and restore on my laptop for testing/development purposes. It just works - except the following:

  1. We need to run the analytics once again to see the reports etc. I don’t know why.
  2. The customisation of login page. I suppose the pictures we load are kept under a system level folder, not part of the database.
1 Like

(Kelvin Murumba) #5

This is true because, with the new instance, you have to run analytics to get data from the database. So it is something that needs to be run. It is the reason why for any change in data, you have to run the analytics to get data in visualization.

The images are always stored in the system folders (War File). These should be noted so that all the relevant images are copied to the new server.

1 Like

(M.Selvaraaj Prabu) #6

Hi @berhard,

* Please tick the “Solution” box below if the answer helps to resolve your issue.

This will help others to identify whether a question/clarification is answered correctly.

1 Like

(Calle Hedberg) #7

Hi,

It’s not 100% correct that you HAVE to run analytics - you can dump and then restore the db WITH all the analytics tables. But it is in general much more efficient to drop the analytics tables (e.g. by using the psql “-T analytics*” parameter) and then re-run analytics, for several reasons:

  • Restoring uses a single thread whereas analytics runs use multi-threading, so the latter is faster.
  • The dump file is smaller and thus easier to transfer (assuming it’s a net transfer).

There are at least two formats you can use for dumping postgresql databases: either as a folder where each table is dumped and compressed, or as a single file. The latter is probably easier, so use these commands (assuming the user role is called ‘dhis’). -f is the filename and -d the database name

pg_dump -U dhis -T analytics* -f .sql
to restore on the new server:
psql -U dhis -f
.sql -d
Enter password when prompted.

Regards
Calle

1 Like