Restore a database in the docker system

Hello,
I have created a docker cluster using
d2 cluster up 2.35.0 --db-version 2.35 --update
command. However, it created an empty database. I’ve downloaded a demo database from a repository. But am not able to restore it using “d2 cluster db restore” command (actually which command will work I don’t know). It’s returning

Restoring database (this may take some time)…
‘.’ is not recognized as an internal or external command,
operable program or batch file.
node:events:498
throw er; // Unhandled ‘error’ event

Any guidance from the experts will be extremely helpful.

Monjur

you can use d2 with a database seed command like this,
d2 cluster up 2.35.0 --db-version 2.35 --seedFile <path-to-your-gunzipped-database-file>

Many thanks @kose .
No, it didn’t work. Its returning the same error. BTW, I’m using Windows OS.

Monjur

Hi @Monjur , I have had similar issues in the past and my solution implied stopping the Tomcat container and importing the file directly in the database by using psql command pointing at the internal docker IP. Might not be what you are looking for but at least is a workaround :slight_smile:

@Monjur try deleting the previously failed installation

d2 cluster down 2.35.0 --clean

Then again run

d2 cluster up 2.35.0 --seedFile <correct path-to-your-gunzipped- SQL dump file>

Ensure the path to your .SQL file is correct and the user has the right access permission

@jaime.bosque, my friend, you made my day. I followed your trick and slapped the docker system till it worked. BTW, I am very happy to chat with you again. I would love to hang out with you again in Negombo or anywhere.

@kose, many many thanks. When I have bad times, no commands work. I really appreciate your help.

3 Likes

I am happy it worked, Monjour! Really looking forward to meeting you in person again very soon :star_struck::slight_smile:

1 Like

many thanks for the solution @jaime.bosque @kose

This page d2 cluster has additional arguments for selecting stable or dev , dhis2-version, --db-version

  1. for running latest dev version at port 8080
d2 cluster up devinstance --channel dev --dhis2-version master --db-version dev --port 8080 --seedFile pathtoDBsql
  1. For running Stable version 2.38.1 at port 8081
d2 cluster up stable2.38.1 --channel stable --dhis2-version 2.38.1 --db-version dev --port 8081 --seedFile pathtoDBsql
1 Like