Nexus H2 repair steps for version 3.79 - Sonatype Nexus Repository / Best Practices - Sonatype Community

Nexus H2 repair steps for version 3.79

post by Glen_Rodrigues on Mar 2

Hello Team,

I am performing the recovery of my h2 db in nexus3. Here are the steps and current setup.

Environment:

Steps I am performing for H2 DB Recovery

  1. Scaled down Nexus pod and opened a debug container.
  2. Ran H2 Recover tool:
java -cp /sonatype/nexus/system/com/h2database/h2/2.2.224/h2-2.2.224.jar org.h2.tools.Recover -dir /nexus-data/db -db nexus

But “/sonatype/nexus/system/com/h2database/h2/2.2.224/h2-2.2.224.jar” is not present in nexus 3.79, but it does in nexus 3.70 so is there any other ways to get the corrupted data back.

post by mpiggott on Mar 2

In newer versions of Nexus the jar is embedded in a single jar (we also use a newer version of H2). You can also download H2 the h2 jar yourself.

Reminder we don’t recommend using H2 in Kubernetes environments as it does not guarantee graceful shutdown which may lead to database corruption.

post by Glen_Rodrigues on Mar 3

@mpiggott Thanks for the reply. Do we have any other steps to access the H2 console in nexus 3.79? I want to change the password of the admin user and replace it with the password created for H2 from the terminal.

post by mpiggott on Mar 3

You might check to see if H2 has an OpenShift operator and mount the volume in that operator. Aside from that, you may need to extract the database from the volume and use H2 outside of Openshift.