Hello,
we are using Nexus 3.70.3 OSS and I want to upgrade the OrientDB to H2 for upgrading to 3.74.0 OSS.
When running the migrator java -jar nexus-db-migrator-3.70.3-01.jar --healthcheck
I get in the healthcheck log:
16:25:00 [main] ERROR c.s.n.d.m.tasklet.HealthCheckTasklet - Cannot open local storage '/home/nexus/component' with mode=rw
DB name="component"
com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/home/nexus/component' with mode=rw
DB name="component"
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:323)
...
Caused by: com.orientechnologies.orient.core.exception.OStorageException: Cannot open the storage 'component' because it does not exist in path: /home/nexus/component
DB name="component"
which is not suprising to me, as we are running our Nexus with -Dkaraf.data=/srv/nexus-data/nexus
When I run java -jar nexus-db-migrator-3.70.3-01.jar --healthcheck --migration_type=h2
the error change to
16:43:22 [main] INFO c.s.n.d.m.validator.PathValidator - Validating Orient directory contains .bak files: /home/nexus
16:43:22 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener -
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
16:43:22 [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to execute ApplicationRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:763)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at com.sonatype.nexus.db.migrator.MigratorApplication.main(MigratorApplication.java:117)
Caused by: com.sonatype.nexus.db.migrator.exception.InvalidMigrationFilesException: The migration files in /home/nexus do not match the expected requirements: No backup files (*.bak) found.
How to tell the db-migrator that my db is located in /srv/nexus-data/nexus/db ?
I have copied the nexus-db-migrator-3.70.3-01.jar in the folder /srv/nexus-data/nexus and started the db-migrator in the folder /srv/nexus-data/nexus
But I still not get it running:
[nexus]$ cat logs/hjava -jar nexus-db-migrator-3.70.3-01.jar --healthcheck --migration_type=h2
09:25:17 [main] WARN c.s.n.d.migrator.MigratorApplication - Please ensure any Nexus Repository instance has been gracefully shut down before proceeding.
09:25:17 [main] INFO c.s.n.d.migrator.MigratorApplication - Do you want to continue [y/n]?
y
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - --healthcheck parameter is present. Setting it to true and start health check process
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - --content_migration parameter is absent. Setting it to true.
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - Force parameter wasn't found. Setting it to false by default.
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - ------------------------------------------------------------
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - Java version: Red Hat, Inc. 1.8.0_432
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - JVM arguments:
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - Migrator arguments: --migration_type=h2 --healthcheck=true --content_migration=true --export_json=false --force=false
09:25:19 [main] INFO c.s.n.d.migrator.MigratorApplication - ------------------------------------------------------------
09:25:20 [main] INFO c.s.n.d.migrator.MigratorApplication - Starting MigratorApplication v3.70.3-01 using Java 1.8.0_432 on apwedevlnxdo18.airplus.net with PID 2368892 (/srv/nexus-data/nexus/nexus-db-migrator-3.70.3-01.jar started by nexus in /srv/nexus-data/nexus)
09:25:20 [main] INFO c.s.n.d.migrator.MigratorApplication - No active profile set, falling back to 1 default profile: "default"
09:25:22 [main] INFO o.s.b.c.r.s.JobRepositoryFactoryBean - No database type set, using meta data indicating: H2
09:25:22 [main] INFO c.s.n.d.migrator.MigratorApplication - Started MigratorApplication in 3.251 seconds (JVM running for 5.948)
09:25:22 [main] INFO o.s.b.a.b.JobLauncherApplicationRunner - Running default command line with: [--migration_type=h2, --healthcheck=true, --content_migration=true, --export_json=false, --force=false]
09:25:22 [main] INFO c.s.n.d.m.v.JobParametersValidatorImpl - Migrator started in health-check mode. Skip other parameters validation
09:25:22 [main] INFO c.s.n.d.m.validator.PathValidator - Validating Orient directory contains .bak files: /srv/nexus-data/nexus
09:25:22 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener -
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
09:25:22 [main] ERROR o.s.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to execute ApplicationRunner
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:776)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:763)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at com.sonatype.nexus.db.migrator.MigratorApplication.main(MigratorApplication.java:117)
Caused by: com.sonatype.nexus.db.migrator.exception.InvalidMigrationFilesException: The migration files in /srv/nexus-data/nexus do not match the expected requirements: No backup files (*.bak) found.
The database files are located in /srv/nexus-data/nexus/db.
When I run the db backup task, the backup files are located in
[nexus]$ ls -l /srv/nexus-data/nexus/db-backup
total 3212
-rw-r--r--. 1 nexus nexus 2753823 Dec 2 2019 component-2019-12-02-01-00-00-3.19.1-01.bak
-rw-r--r--. 1 nexus nexus 381377 Dec 2 2019 config-2019-12-02-01-00-00-3.19.1-01.bak
-rw-r--r--. 1 nexus nexus 143633 Dec 2 2019 security-2019-12-02-01-00-00-3.19.1-01.bak
I believe you will succeed if put the migrator JAR in the same directory as the .bak files – I meen /srv/nexus-data/nexus/db – and run the java command from that directory as well.
I was now able to run the migrator tool - even not successfully - with following setup:
I created a folder /srv/nexus-data/nexus/db-migration as copy of /srv/nexus-data/nexus/db
I had to go into the folder /srv/nexus-data/nexus/db-migration/component
I had to copy my *.bak files into the component folder
Then I was able to run the health check successfully:
[nexus]$ cd /srv/nexus-data/nexus/db-migration/component
[nexus component]$ java -jar ../../db-migration/nexus-db-migrator-3.70.3-01.jar --healthcheck --migration_type=h2
...
16:01:08 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - ------------------------------------------------------------
16:01:08 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - Database integrity: OK
16:01:08 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - ------------------------------------------------------------
16:01:08 [main] INFO c.s.n.d.m.l.ProvidingJobInfoListener - Please see health-check logs for more details.
But I am not able to run the actual migration, but I will address this in a separate thread.