Upgrading to H2 database - Sonatype Nexus Repository - Sonatype Community

Upgrading to H2 database

post by judaly on Sep 18, 2024

Hallo all

This might seem like asking to ask but I want to make sure.

Reading Upgrading to 3.71.0+ for Instances Using OrientDB, Nexus Repository 3.70.x, and Java 8 or 11

as I have 3.70 version using OrientDB and java version 8.

I want clarification: On this page if I read correctly once I update to 3.70.2. ie latest 3.70 version.

once updated I need to move the full backup to a clean location.

Is the clean location a new install of nexus repo manager ? so that only on the new clean install does it start with H2.

thank you

Julian

post by jonas.krisch on Sep 19, 2024

Hi Julian

I just did the migration from orientDB to the internal H2 on a nexus (3.70.2) running in a container.

The clean working directory the documentation is referring to is just a folder outside your nexus directories.

That can be on the machine you are running nexus on or any other.

So first I recommend upgrading to 3.70.2.

Then run the backup task as mentioned in the documentation.

Then copy the backup files to the clean working dir (some dir outside your nexus dir structure), download the migrator jar file and put it in the same folder and execute the following command from within that directory

java -Xmx16G -Xms16G -XX:+UseG1GC -XX:MaxDirectMemorySize=28672M \
-jar nexus-db-migrator-*.jar \
--migration_type=h2

But I recommend doing this on a test environment before you do that and to backup your nexus data dir.

After that has been done you can move the nexus.mv.db file dir (just follow the documentation. it is pretty straight forward).

The only thing you need to be aware of is a possible version incompatibility with your java instance.

For me (as I am running nexus within a container) I had to run the jar file with openjdk11.

Hope that helped.

Cheers

Jonas

post by judaly on Sep 25, 2024

Hallo Jonas

Thank you for your reply and information.

One slightly off thing for me was that you ran the jar command with openjdk11. I thought I had to convert to H2 before upgrading to java 11?

seems weird

thanks

Julian

post by judaly on Sep 27, 2024

Hallo

will update this here regarding my last question.

Jonas didn’t come back before I updated and that impacted my upgrade.

Not Jonas’s Problem. I forgot the question.

Upon upgrading YES you have to USE java 11.

This step is not including in the upgrade steps or in the prerequisites

I had to install openjdk java 11.

After I stopped nexus and moved the backup files

Then using update-alternatives --config java I had to choose the choice for java 11

Only then did I run the "java xxx nexus db migrator xxx " command

Then when I attempted to restart it failed

TWO reasons… I copied the db file to location but I needed to the nexus user ownership

AND I needed to run update-alternatives again and return to java 8

Then nexus worked again

But I needed to check if the effort worked.

Only way is to confirm that nexus.orient.enabled was now false

I can now continue with the upgrade next week.

Please nexus people ! Upgrade your documentation Step

Thank you

Julian

post by mpiggott on Sep 27, 2024

Take a look at Phase 2 in the document you’ve linked in the original post which indicates the Java requirements.