How To Restore a database backup ?
-
I realize this sounds silly but I restored a previous h2 database core backup inside mango through the settings ui and now mango wont start
I have the zip backup from the previous day and unzipped into an sql file
I need help getting this into the databaseAlso I have the server on linux and set up as a service so how can I see the mango console from a command window??
Thanks -in - advance -
Hi Phillip,
A. Do a restore at the command line:
- Stop Mango
- Move Mango/databases/mah2.h2.db to Mango/databases/corr-mah2.h2.db
- In the Mango/ directory, run (with your paths/credentials corrected to your Mango directory/OS):
java -cp C:\Mango\lib\h2-1.4.196.jar org.h2.tools.RunScript -url "jdbc:h2:C:\Mango\databases\mah2;MV_STORE=FALSE;MVCC=FALSE" -user "" -password "" -script C:\Mango\backup\core-database-H2-Mar-10-2017_000500.zip -options compression zip
- Start Mango.
B. Mango console output when service,
tail -n 30 -f /path/to/mango/logs/ma.log
or if you feel like it add a bash alias in your bashrc or aliases file,alias mlog='tail -n 30 -f /path/to/mango/logs/ma.log'
and you can usemlog
forever after.Edit: updated h2 jar version number
-
Joel just told me another easy way to do it...
- Stop Mango.
- mv Mango/databases/mah2.h2.db Mango/databases/trouble-mah2.h2.db
- Start Mango on a clean database, login admin/admin
- Use the system settings H2 Backup section to restore a database backup.
- Restart Mango
-
Joel's method is how I got to this point. I restored yesterday's backup from the settings console and it immediately started logging errors. I restarted mango and it would not start. Where do I get a clean mah2.db?
Thanks -
It will recreate itself if there is no database at the path specified in env.properties
What error are you getting when you start it? It's also possible there's a quick fix using the Mango/bin/h2-web-console.sh script.
-
ok I have it starting up
Ill let you know how I make out
looks promising -
when I pick the database to restore there are two entries .zip and .zip.zip
which one is the correct selection?? -
.zip, the .zip.zip issue was recently fixed. If you'll look you're see .zip.zip is 0 bytes.
-
do I restart the server immediately or wait a few mins while this unzips?
-
Shouldn't matter. As long as you do not kill -9 the process it will wait for the task to finish.
-
I had no success restoring the backup db. I tried several times and also copied the zip to my laptop to see if I could restore it on that system but no either way it hangs on restart.. Is it possible for me to send you the zip file and you send me back a mah2 db that I can just put into that directory?
-
Can you describe what you mean 'hangs on restart' more fully?
Do you have an error when starting Mango that prevents Mango from starting?
-
Okay I was able to get the db up on my laptop by starting it in SAFE mode (thank God) so its a memory issue on the laptop hanging. On the cloud server I have lots of memory. Can I now just copy this mah2.db and mah2.lock to my cloud server's database folder. and start cloud mango?
-
You don't need the lock file.
I don't feel like you've provided any of the information I've asked for at any stage. This will quickly disinterest me in this thread.
-
Sorry I must apologize Phil, One month ago I thought mango's were delicious. So I have been learning much every day and you have provided me with much insightful help and instruction thus far. Joel's methodology worked for me to restore the backup db. It was more my misunderstanding about what was happening on my pc that was confusing me and I am not yet comfortable working in terminal window on linux so I try the stuff on the pc first. Anyhow, every issue we have been experiencing has been a result of running out of memory as the root issue. We get frozen out or it crashes. Growing pains. Tomorrow we shall have 8gb and 4 cpu's to play with and life should return to happy. A while ago you helped me with scripting the missing point interpolation and deleting outliers. Scripting is fine but I found that exporting specific data value ranges from watchlists and then importing back in through excel permits me the best control over deletion and adding points. Which was a brilliant suggestion you made to another user with same issue.
I have abandoned my scripting efforts on interpolating points. Thankfully you say :) lol
Anyway thanks again for your support and sorry for the disconnect..
Mango Rocks
I Love it :) -
It is alright. I'm sure you can understand that to provide the best support I have to assess what information is probably relevant and available, and then get that information. I try to keep some eye to the long term for threads, and if our exchanges contain things like the text of the exact error the user encounters or simple descriptions of exact symptoms makes everything more searchable.
Best of luck on the new computer! I wonder, have you been setting a heap limit with an ext-enabled script?
-
Ha ha you got it I was just messaging you back about the heap size and how I go about that . We have 8gb like this... What do you recommend and how to do it. Please and thanks. I'll start including some of the data from now on # top :)
I'm in a different time zone than our servers in case you were wondering.This is from inside.. Our ES is much snappier than this system right now as its configured.
-
Hard to see so
-
You can simply move a script for a correct size from Mango/bin/ext-avialable into Mango/bin/ext-enabled like memory-medium.sh, which sets a static heap of 5 Gb.
For 8 you could consider modifying it to 6 Gb, like,
#!/bin/bash case "$1" in init) # Startup with Java Memory setup for Medium size installation # The heap is set to non-expanding for increased performance. If memory use is a factor # set the Minimum heap size to a lower number and let the JVM adjust when necessary. JAVAOPTS="$JAVAOPTS -Xms6g -Xmx6g" ;; esac
-
That was easy .. Do I restart mango or the server to activate this configuration?