Skip to content

Instantly share code, notes, and snippets.

@ChakshuGautam
Last active October 10, 2019 09:00
Show Gist options
  • Save ChakshuGautam/fd70df63327ef17ad5b054f2b4b8c4a7 to your computer and use it in GitHub Desktop.
Save ChakshuGautam/fd70df63327ef17ad5b054f2b4b8c4a7 to your computer and use it in GitHub Desktop.
Process to follow when Metabase fails

Issue 1: Too big H2 database

This is mostly due to H2 database getting too big. So it doesn't load in 5 seconds. You can debug this using

docker logs b4f559dc829b --tail 100

If it is too big you will need to defrag it.

docker restart <containerID>; docker exec -it <containerID> /bin/bash;
wget http://repo2.maven.org/maven2/com/h2database/h2/1.4.196/h2-1.4.196.jar 
cd metabase.db;java -cp h2*.jar org.h2.tools.Shell -driver org.h2.Driver -url "jdbc:h2:./metabase.db" -user "" -password "";

This will open the SQL where running the following would defrag it.

shutdown defrag;

Now that you have a smaller database copy it to your docker host and keep it safe. Also now you need to spin up a new server and copy paste the older DB file to new one.

docker cp <oldContainerID>:/metabase.db .
docker run -d -p 3000:3000 -e "JAVA_TOOL_OPTIONS=-Xmx6g" metabase/metabase docker cp metabase.db <newContainerID>:/

Issue 2: Disk Filled

This is mostly due to two files.

  1. Docker logs filling up the system. To delete them use this
truncate -s 0 /var/lib/docker/containers/*/*-json.log
  1. Metabase internal DB filling up the system. To delete them,
docker exec -it <containerID> /bin/bash; cd metabase.db;

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment