Windows版Nexus因磁盘空间占满导致orientdb数据损坏修复
由于年底公司项目多,大量程序打包,导致windows虚拟机用于存放库文件的nexus所在磁盘空间减少,jenkins打包和本地发布jar包出现无响应情况,开始怀疑为磁盘空间不足导致,关闭系统扩展了虚拟机磁盘空间,但是依旧无法启动服务,查看“E:\Nexus\sonatype-work\nexus3\log”下的日志报如下:
2024-12-07 09:55:29,080+0800 ERROR [ForkJoinPool.commonPool-worker-4] *SYSTEM ROOT - $ANSI{green {db=component}} Error during storage close
java.lang.NullPointerException: null
at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.cutTill(ODiskWriteAheadLog.java:919)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.makeFullCheckpoint(OAbstractPaginatedStorage.java:3705)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.doClose(OAbstractPaginatedStorage.java:4412)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.close(OAbstractPaginatedStorage.java:581)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:316)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:259)
at org.sonatype.nexus.orient.DatabaseManagerSupport.connect(DatabaseManagerSupport.java:143)
at org.sonatype.nexus.orient.DatabaseInstanceImpl.doStart(DatabaseInstanceImpl.java:56)
at org.sonatype.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:104)
at org.sonatype.goodies.lifecycle.Lifecycles.start(Lifecycles.java:44)
at org.sonatype.nexus.orient.DatabaseManagerSupport.createInstance(DatabaseManagerSupport.java:252)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
at org.sonatype.nexus.orient.DatabaseManagerSupport.instance(DatabaseManagerSupport.java:231)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
at java.util.concurrent.CountedCompleter.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
2024-12-07 09:55:29,080+0800 ERROR [ForkJoinPool.commonPool-worker-4] *SYSTEM ROOT - Exception `4170C1CB` in storage `plocal:Y:/Nexus/sonatype-work/nexus3/db/component`: 2.2.34 (build f340442755a31eabc91b87cb3ef99eda5cee6ebd, branch 2.2.x)
com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage 'Y:/Nexus/sonatype-work/nexus3/db/component' with mode=rw
DB name="component"
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:323)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:259)
at org.sonatype.nexus.orient.DatabaseManagerSupport.connect(DatabaseManagerSupport.java:143)
at org.sonatype.nexus.orient.DatabaseInstanceImpl.doStart(DatabaseInstanceImpl.java:56)
at org.sonatype.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:104)
at org.sonatype.goodies.lifecycle.Lifecycles.start(Lifecycles.java:44)
at org.sonatype.nexus.orient.DatabaseManagerSupport.createInstance(DatabaseManagerSupport.java:252)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(Unknown Source)
at org.sonatype.nexus.orient.DatabaseManagerSupport.instance(DatabaseManagerSupport.java:231)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.ForEachOps$ForEachTask.compute(Unknown Source)
at java.util.concurrent.CountedCompleter.exec(Unknown Source)
at java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(Unknown Source)
at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.lang.NullPointerException: null
at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.cutTill(ODiskWriteAheadLog.java:919)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.makeFullCheckpoint(OAbstractPaginatedStorage.java:3705)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.recoverIfNeeded(OAbstractPaginatedStorage.java:3936)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:288)
... 17 common frames omitted
经网上查询为磁盘空间不足导致数据库文件损坏!但是查看修复方式几乎全是linux上的,按照其步骤尝试发现修改一些方式后可修复,为防止原作者删除文档,故修改为windows版发布。
执行指令:
E:\Nexus\nexus-3.11.0-01\jre\bin\java -jar E:\Nexus\nexus-3.11.0-01\lib\support\nexus-orient-console.jar
此指令是进入orientdb数据库工具包,nexus自带,且可用自带的jre运行。
在工具包运行下的命令行执行指令:
CONNECT PLOCAL:E:/Nexus/sonatype-work/nexus3/db/component admin admin
注意:windows复制出来的“\”要全改成“/”否则将会报错,路径不识别。
通常数据库损坏时,该方式现无法访问数据库。
输入“exit”指令,退出工具包程序,到“E:\Nexus\sonatype-work\nexus3\db\component”目录下,删除所有wal后缀的文件。
然后执行上方指令重新进入工具包(忘记要不要登录到component 下了,因无损坏环境,故可先尝试是否可admin登陆,再执行指令),逐条执行如下指令:
REBUILD INDEX *
REPAIR DATABASE --fix-graph
REPAIR DATABASE --fix-links
REPAIR DATABASE --fix-ridbags
REPAIR DATABASE --fix-bonsai
DISCONNECT
执行完成后,尝试重启系统,查看nexus服务是否正常启动