Nexus修复文档
问题描述
? 公司内部一个私有jar无法上传至服务器,后进入nexus,查看日志,发现报disk异常,查看磁盘占用,只剩几百兆的磁盘在那边瑟瑟发抖了。
? 后公司网管在双休的时候对磁盘进行了停机扩容操作,但是停机扩容后,nexus依然无法启动,大概的报错如下:
docker $ANSI{green {db=component}} Exception during storage data restore
java.lang.NullPointerException: null
? 大概的分析以后,感觉是因为磁盘满了,或者服务器关机,没有关闭nexus导致了数据库文件损坏,遂进行百度,发现如下文章Nexus因磁盘空间占满异常停机orientdb数据损坏修复,以及docker nexus3 磁盘空间满导致orientdb数据库异常
修复过程
? 根据文档操作,首先碰到了第一个问题
java -jar ${NexusHomePath}/lib/support/nexus-orient-console.jar
? 此命令需要docker内部提示权限不足,需使用root权限执行
? 遂需要在exec的时候加上-u root参数
docker exec -ti -u root 2a5f8f9d74d0 bash
? 再次进入容器后,按照文档内操作
rm -rf /nexus-data/db/component/*.wal
java -jar /opt/sonatype/nexus/lib/support/nexus-orient-console.jar
connect plocal:/nexus-data/db/component admin admin
REPAIR DATABASE --fix-graph
REPAIR DATABASE --fix-links
REPAIR DATABASE --fix-ridbags
REPAIR DATABASE --fix-bonsai
REBUILD INDEX *
disconnect
exit
遇到的坑
? 此时坑的就来了,按照文档的说法,这样子执行完以后,再restart容器,理论上应该可以正常执行,但是却报了另一个异常
2021-11-21 14:52:50,412+0000 ERROR [FelixStartLevel] *SYSTEM com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog - $ANSI{green {db=component}} Error during file initialization for storage 'component'
java.io.FileNotFoundException: /nexus-data/db/component/component.8.wal (Permission denied)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OLogSegmentV2.getRndFile(OLogSegmentV2.java:397)
at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OLogSegmentV2.init(OLogSegmentV2.java:441)
at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:279)
at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:158)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.initWalAndDiskCache(OLocalPaginatedStorage.java:600)
at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:279)
at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:259)
at org.sonatype.nexus.orient.DatabaseManagerSupport.connect(DatabaseManagerSupport.java:178)
at org.sonatype.nexus.orient.DatabaseManagerSupport.createInstance(DatabaseManagerSupport.java:312)
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
at org.sonatype.nexus.orient.DatabaseManagerSupport.instance(DatabaseManagerSupport.java:289)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290)
at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:401)
at java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:734)
at java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:159)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:173)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:650)
at org.sonatype.nexus.orient.restore.RestoreServiceImpl.doStart(RestoreServiceImpl.java:76)
at org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport.start(StateGuardLifecycleSupport.java:69)
at org.sonatype.nexus.orient.restore.RestoreServiceImpl$$EnhancerByGuice$$169965294.GUICE$TRAMPOLINE(<generated>)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:74)
at org.sonatype.nexus.common.stateguard.MethodInvocationAction.run(MethodInvocationAction.java:39)
at org.sonatype.nexus.common.stateguard.StateGuard$TransitionImpl.run(StateGuard.java:193)
at org.sonatype.nexus.common.stateguard.TransitionsInterceptor.invoke(TransitionsInterceptor.java:57)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.google.inject.internal.InterceptorStackCallback.invoke(InterceptorStackCallback.java:55)
at org.sonatype.nexus.orient.restore.RestoreServiceImpl$$EnhancerByGuice$$169965294.start(<generated>)
at org.sonatype.nexus.extender.NexusLifecycleManager.startComponent(NexusLifecycleManager.java:199)
at org.sonatype.nexus.extender.NexusLifecycleManager.to(NexusLifecycleManager.java:111)
at org.sonatype.nexus.extender.NexusContextListener.moveToPhase(NexusContextListener.java:319)
at org.sonatype.nexus.extender.NexusContextListener.frameworkEvent(NexusContextListener.java:216)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1597)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
at java.lang.Thread.run(Thread.java:748)
? 提示的已经很明显了(Permission denied)
? 于是去/nexus-data/db/component/这个目录下,查看权限,果然是这个问题
[root@2a5f8f9d74d0 component]
total 175364
-rw-r--r-- 1 root root 16778240 Nov 21 14:47 OFunction.name.hib
-rw-r--r-- 1 root root 66560 Nov 21 14:47 OFunction.name.him
-rw-r--r-- 1 root root 66560 Nov 21 14:47 OFunction.name.hit
-rw-r--r-- 1 root root 1024 Nov 21 14:47 OFunction.name.hnb
-rw-r--r-- 1 root root 1024 Nov 21 14:47 ORole.name.nbt
-rw-r--r-- 1 root root 66560 Nov 21 14:47 ORole.name.sbt
-rw-r--r-- 1 root root 1024 Nov 21 14:46 OUser.name.nbt
-rw-r--r-- 1 root root 66560 Nov 21 14:46 OUser.name.sbt
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 asset.cpm
-rw-r--r-- 1 nexus nexus 9503744 Nov 19 08:13 asset.pcl
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 asset_1.cpm
-rw-r--r-- 1 nexus nexus 9503744 Nov 19 08:13 asset_1.pcl
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 asset_2.cpm
-rw-r--r-- 1 nexus nexus 9503744 Nov 19 07:16 asset_2.pcl
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 asset_3.cpm
-rw-r--r-- 1 nexus nexus 9503744 Nov 19 07:16 asset_3.pcl
-rw-r--r-- 1 root root 1024 Nov 21 14:47 asset_bucket_component_name_idx.nbt
-rw-r--r-- 1 root root 7275520 Nov 21 14:47 asset_bucket_component_name_idx.sbt
-rw-r--r-- 1 root root 1024 Nov 21 14:47 asset_bucket_name_idx.irs
-rw-r--r-- 1 root root 1024 Nov 21 14:47 asset_bucket_name_idx.nbt
-rw-r--r-- 1 root root 7996416 Nov 21 14:47 asset_bucket_name_idx.sbt
-rw-r--r-- 1 root root 263168 Nov 21 14:47 asset_component_idx.irs
-rw-r--r-- 1 root root 66560 Nov 21 14:47 asset_component_idx.nbt
-rw-r--r-- 1 root root 787456 Nov 21 14:47 asset_component_idx.sbt
-rw-r--r-- 1 root root 1024 Nov 21 14:47 asset_name_ci_idx.irs
-rw-r--r-- 1 root root 1024 Nov 21 14:47 asset_name_ci_idx.nbt
-rw-r--r-- 1 root root 6489088 Nov 21 14:47 asset_name_ci_idx.sbt
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 browse_node.cpm
-rw-r--r-- 1 nexus nexus 3146752 Nov 19 06:56 browse_node.pcl
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 browse_node_1.cpm
-rw-r--r-- 1 nexus nexus 3081216 Nov 19 06:56 browse_node_1.pcl
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 browse_node_2.cpm
-rw-r--r-- 1 nexus nexus 3081216 Nov 19 06:56 browse_node_2.pcl
-rw-r--r-- 1 nexus nexus 132096 Nov 19 06:56 browse_node_3.cpm
-rw-r--r-- 1 nexus nexus 3146752 Nov 19 06:56 browse_node_3.pcl
-rw-r--r-- 1 root root 1049600 Nov 21 14:47 browse_node_asset_id_idx.sbt
-rw-r--r-- 1 root root 1024 Nov 21 14:47 browse_node_component_id_idx.irs
-rw-r--r-- 1 root root 525312 Nov 21 14:47 browse_node_component_id_idx.sbt
-rw-r--r-- 1 root root 1024 Nov 21 14:47 browse_node_repository_name_parent_path_name_idx.nbt
-rw-r--r-- 1 root root 10093568 Nov 21 14:47 browse_node_repository_name_parent_path_name_idx.sbt
-rw-r--r-- 1 nexus nexus 66560 Oct 27 06:40 bucket.cpm
-rw-r--r-- 1 nexus nexus 132096 Oct 27 06:40 bucket.pcl
-rw-r--r-- 1 nexus nexus 66560 Sep 24 02:03 bucket_1.cpm
-rw-r--r-- 1 nexus nexus 132096 Sep 24 02:03 bucket_1.pcl
-rw-r--r-- 1 nexus nexus 66560 Sep 24 02:09 bucket_2.cpm
-rw-r--r-- 1 nexus nexus 132096 Sep 24 02:09 bucket_2.pcl
-rw-r--r-- 1 nexus nexus 66560 Sep 24 02:15 bucket_3.cpm
-rw-r--r-- 1 nexus nexus 132096 Sep 24 02:15 bucket_3.pcl
-rw-r--r-- 1 root root 1024 Nov 21 14:47 bucket_repository_name_idx.nbt
-rw-r--r-- 1 root root 66560 Nov 21 14:47 bucket_repository_name_idx.sbt
-rw-r--r-- 1 root root 23660 Nov 21 14:50 cache.stt
-rw-r--r-- 1 nexus nexus 114 Sep 9 07:01 command-cache.json
-rw-r--r-- 1 root root 46465024 Nov 21 14:47 component.7.wal
-rw-r--r-- 1 root root 65536 Nov 21 14:50 component.8.wal
-rw-r--r-- 1 nexus nexus 66560 Nov 18 12:13 component.cpm
-rw-r--r-- 1 nexus nexus 1049600 Nov 18 12:13 component.pcl
-rw-r--r-- 1 nexus nexus 40 Nov 21 14:50 component.wmr
-rw-r--r-- 1 nexus nexus 66560 Nov 18 12:13 component_1.cpm
-rw-r--r-- 1 nexus nexus 1115136 Nov 18 12:13 component_1.pcl
-rw-r--r-- 1 nexus nexus 66560 Nov 19 06:56 component_2.cpm
-rw-r--r-- 1 nexus nexus 1049600 Nov 19 06:56 component_2.pcl
-rw-r--r-- 1 nexus nexus 66560 Nov 19 06:56 component_3.cpm
-rw-r--r-- 1 nexus nexus 1049600 Nov 19 06:56 component_3.pcl
-rw-r--r-- 1 root root 1024 Nov 21 14:46 component_bucket_group_name_version_idx.nbt
-rw-r--r-- 1 root root 1442816 Nov 21 14:47 component_bucket_group_name_version_idx.sbt
-rw-r--r-- 1 root root 1024 Nov 21 14:47 component_bucket_name_version_idx.irs
-rw-r--r-- 1 root root 1024 Nov 21 14:47 component_bucket_name_version_idx.nbt
-rw-r--r-- 1 root root 1115136 Nov 21 14:47 component_bucket_name_version_idx.sbt
-rw-r--r-- 1 root root 66560 Nov 21 14:47 component_ci_name_ci_idx.irs
-rw-r--r-- 1 root root 1024 Nov 21 14:47 component_ci_name_ci_idx.nbt
-rw-r--r-- 1 root root 328704 Nov 21 14:47 component_ci_name_ci_idx.sbt
-rw-r--r-- 1 root root 1024 Nov 21 14:47 component_group_name_version_ci_idx.irs
-rw-r--r-- 1 root root 1024 Nov 21 14:47 component_group_name_version_ci_idx.nbt
-rw-r--r-- 1 root root 1442816 Nov 21 14:47 component_group_name_version_ci_idx.sbt
-rw-r--r-- 1 root root 5528 Nov 21 14:47 database.ocf
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 default.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 default.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 deleted_blob_index.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 deleted_blob_index.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 deleted_blob_index_1.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 deleted_blob_index_1.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 deleted_blob_index_2.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 deleted_blob_index_2.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 deleted_blob_index_3.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 deleted_blob_index_3.pcl
-rw-r--r-- 1 root root 16778240 Nov 21 14:47 deleted_blob_index_blobstore_blob_id_idx.hib
-rw-r--r-- 1 root root 66560 Nov 21 14:47 deleted_blob_index_blobstore_blob_id_idx.him
-rw-r--r-- 1 root root 66560 Nov 21 14:47 deleted_blob_index_blobstore_blob_id_idx.hit
-rw-r--r-- 1 root root 1024 Nov 21 14:47 deleted_blob_index_blobstore_blob_id_idx.hnb
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 dictionary.nbt
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 dictionary.sbt
-rw-r--r-- 1 nexus nexus 2 Nov 21 14:50 dirty.fl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 docker_foreign_layers.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 docker_foreign_layers.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 docker_foreign_layers_1.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 docker_foreign_layers_1.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 docker_foreign_layers_2.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 docker_foreign_layers_2.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 docker_foreign_layers_3.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 docker_foreign_layers_3.pcl
-rw-r--r-- 1 root root 1024 Nov 21 14:47 docker_foreign_layers_digest_idx.nbt
-rw-r--r-- 1 root root 66560 Nov 21 14:47 docker_foreign_layers_digest_idx.sbt
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 e.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 e.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 e_1.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 e_1.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 e_2.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 e_2.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 e_3.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 e_3.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 index.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 index.pcl
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 internal.cpm
-rw-r--r-- 1 nexus nexus 132096 Sep 9 07:01 internal.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 manindex.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 manindex.pcl
-rw-r--r-- 1 nexus nexus 7614 Nov 21 14:50 name_id_map.cm
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 ofunction.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 ofunction.pcl
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 orole.cpm
-rw-r--r-- 1 nexus nexus 132096 Sep 9 07:01 orole.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 oschedule.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 oschedule.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 osequence.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 osequence.pcl
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 ouser.cpm
-rw-r--r-- 1 nexus nexus 132096 Sep 9 07:01 ouser.pcl
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 statushealthcheck.cpm
-rw-r--r-- 1 nexus nexus 132096 Nov 21 13:54 statushealthcheck.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 statushealthcheck_1.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 statushealthcheck_1.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 statushealthcheck_2.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 statushealthcheck_2.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 statushealthcheck_3.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 statushealthcheck_3.pcl
-rw-r--r-- 1 root root 1024 Nov 21 14:47 statushealthcheck_node_id_idx.nbt
-rw-r--r-- 1 root root 66560 Nov 21 14:47 statushealthcheck_node_id_idx.sbt
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 v.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 v.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 v_1.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 v_1.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 v_2.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 v_2.pcl
-rw-r--r-- 1 nexus nexus 1024 Sep 9 07:01 v_3.cpm
-rw-r--r-- 1 nexus nexus 66560 Sep 9 07:01 v_3.pcl
? 有大量的root用户的东西
? 那简单了,把这些给nexus不就好了么
chown nexus:nexus *
? 重启容器,结束!
? 随后再去根据文档Nexus因磁盘空间占满异常停机orientdb数据损坏修复设置了一下我们的定时清理任务
|