Last active
December 21, 2024 21:09
-
-
Save marcelmaatkamp/123e8793e07a72a382d8d0e8d66bbd8f to your computer and use it in GitHub Desktop.
Fix Sonatype Nexus OrientDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls /opt/sonatype/sonatype-work/nexus3/db/ | |
OSystem accesslog analytics audit component config model.properties security | |
$ docker-compose exec nexus java -jar ./lib/support/nexus-orient-console.jar | |
CONNECT PLOCAL:/opt/sonatype/sonatype-work/nexus3/db/component admin admin | |
REBUILD INDEX * | |
REPAIR DATABASE --fix-graph | |
REPAIR DATABASE --fix-links | |
REPAIR DATABASE --fix-ridbags | |
REPAIR DATABASE --fix-bonsai | |
DISCONNECT |
Another note about this: With nexus OSS 3.15.1, when it ran out of disk space, it created WAL files with zero file size. These caused orientdb to croak with null pointer exceptions on startup. I just had to remove the zero size files, and then the above commands worked perfectly.
Many thanks
~/go/src/etcd-io/etcd/tools/etcd-dump-db (main ✔) docker exec -u 0 -ti af9b0952e351 bash
[root@af9b0952e351 /]# java -jar /opt/sonatype/nexus/lib/support/nexus-orient-console.jar
OrientDB console v.2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d3788, branch 2.2.x) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> CONNECT PLOCAL:/opt/sonatype/sonatype-work/nexus3/db/component admin admin
Connecting to database [PLOCAL:/opt/sonatype/sonatype-work/nexus3/db/component] with user 'admin'...
2023-08-21 08:11:10:770 WARNI {db=component} Storage 'component' was not closed properly. Will try to recover from write ahead log... [OLocalPaginatedStorage]
2023-08-21 08:11:10:779 WARNI {db=component} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRec
ord{lsn=LSN{segment=23, position=160518}} will be skipped during data restore [OLocalPaginatedStorage]
2023-08-21 08:11:10:779 WARNI {db=component} Record OFuzzyCheckpointStartRecord{lsn=LSN{segment=23, position=160525}} com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointStartRecord{lsn=null,previousCheckpoint=LSN{segment=23, position=160478}} will be skipped during data restore [OLocalPaginatedStorage]
2023-08-21 08:11:10:780 WARNI {db=component} Record com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OFuzzyCheckpointEndRecord{lsn=LSN{segment=23, position=160565}} will be skipped during data restore [OLocalPaginatedStorage]OK
orientdb {db=component}> REBUILD INDEX *
Rebuilding index(es)...
Rebuilt index(es). Found 108 link(s) in 10.375000 sec(s).
Index(es) rebuilt successfully
orientdb {db=component}> REPAIR DATABASE --fix-graph
Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors)
orientdb {db=component}> REPAIR DATABASE --fix-links
Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors)
orientdb {db=component}>
orientdb {db=component}> REPAIR DATABASE --fix-ridbags
Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors)
orientdb {db=component}> REPAIR DATABASE --fix-bonsai
Repairing database...
- Removing broken links...
-- Done! Fixed links: 0, modified documents: 0
Repair database complete (0 errors)
orientdb {db=component}> disconnect
Disconnecting from the database [component]...OK
orientdb>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are getting bigmyx's error:
You can truncate the record as described here: https://mariosk.wordpress.com/2019/09/07/how-a-nexus-repository-manager-corruption-led-to-a-mini-odyssey/
After i fixed all the dups to fix index: asset_bucket_component_name_idx i encountered a lot more appeared in the browse_node_repository_name_parent_path_name_idx index, after fixing a couple of dozes manually i dropped the class browse_node as mentioned here: https://issues.sonatype.org/browse/NEXUS-16419 this should only have affect on the webui and after restart you the indexes are repopulated.