Nexus H2 repair steps for version 3.79 - Sonatype Nexus Repository / Best Practices - Sonatype Community
Nexus H2 repair steps for version 3.79
Hello Team,
I am performing the recovery of my h2 db in nexus3. Here are the steps and current setup.
Environment:
- Nexus Version: 3.79.1
- H2 Version: 2.2.224
- Java Version: 11
- Deployment: OpenShift
Steps I am performing for H2 DB Recovery
- Scaled down Nexus pod and opened a debug container.
- 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.
Response from Matthew Piggott
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.
Follow-up from Glen Rodrigues
@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 terminal.
Further Guidance from Matthew Piggott
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.