How to setup Metabase on Windows as a service and ussing H2 apps db

For anyone interested, here's an easy way to get Metabase running as a windows service, which and be easily stopped and started for purpose of backing up the HE file. Every time I make substantial edits on the apps file i back it up. Included are batch files for start, stop, backup and install the service, as well as how to set up the gui nssm presents when installing. Note the path field contains the full path where java exists, including the executable...\ javaw which cannot be seen to the right. My folder containing metabase.jar and the is in Program Files (x86)\POPReports and that's where i need to run any nssm commands from.

All batch files must be run as Admin. This gui is invoked with command nssm install (what u want as service name)



here's my backup script. target folder is a memory stick on I: this will append backup date to the backup file.

Please, do NOT USE h2 as a database other than for testing purposes. YOU WILL LOSE EVERYTHING in your Metabase instance as H2 is NOT a proper database. Please move to Postgres or MySQL for a proper and production ready application database

1 Like

Have been using H2 for 3 years without issue. the thing is to back it up every time an edit is made. I am small time business owner tracking basic metrics of my sqlite business. Setting up postgress or mysql is cumbersome and resource intensive in my opinion as i have spend couple days wiht postgress setup and finally gave up. I also save my sql coding as .txt files separately, making edits there as better editor capabilities with notepad+, then paste into MB.

Yes, you will be able to use H2 for several years without issue. It will eventually reach a critial size and stop working. Then you'll have to migrate a much larger H2 database to a 'proper' database.
There's also a nasty security hole in H2.

Postgres can be daunting but worth the effort. Use PgAdmin to do all the work rather than mucking about with the command line.

MySQL (IMHO) is a nasty little database that's now owned by Oracle so worth avoiding.

If you need help setting up with Postgres, try one of the Metabase Experts (like me :smiley: )