Nexus非正常关闭导致数据库异常,二方包无法上传问题
安装的nexus私服突然上传不了二方包,排查步骤如下:1、cd/apps/data/sonatype-work/nexus3/log/ ,tail -500f nexus.log,错误信息如下:test_repositories org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: PU
安装的nexus私服突然上传不了二方包,排查步骤如下:
1、cd /apps/data/sonatype-work/nexus3/log/ ,tail -500f nexus.log,错误信息如下:
test_repositories org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: PUT /repository/testRepositories-snapshot/com/midea/testp/1.0.7-SNAPSHOT/testp-1.0.7-20210720.031426-1.pom
com.orientechnologies.orient.core.exception.OPageIsBrokenException: Following files and pages are detected to be broken ['browse_node_3.cpm' :50;'browse_node_1.cpm' :51;'browse_node.cpm' :53;'asset_bucket_name_idx.sbt' :1053;'browse_node_2.cpm' :52;], storage is switched to 'read only' mode. Any modification operations are prohibited. Typically it means hardware error, before filling a bug please check your hardware. To restore database and make it fully operational you may export and import database to and from JSON.
2、通过错误日志,我们看到:storage is switched to 'read only' mode,很明显nexus库component
已经变成了read only
只读模式,需要重新创建component仓库,步骤如下:
3、进入nexus安装目录,停止nexus服务,比如我本地安装目录是:/usr/local/nexus-3.7.1-02,cd /usr/local/nexus-3.7.1-02/bin,执行 ./nexus stop
4、查看数据文件存储位置,vim /usr/local/nexus-3.7.1-02/bin/
5、备份数据文件,cd /apps/data/sonatype-work/nexus3/db,执行
cp -rv component /nexus_db_backup/
6、cd /usr/local/nexus-3.7.1-02/lib/support,执行 nexus-orient-console.jar,启动console,命令如:
java -jar nexus-orient-console.jar
(注意:如果component仓库数据量比较大,会报java heap OOM错误,可以在启动时调大内存,比如我的启动命令:java -jar -Xms45g -Xmx45g nexus-orient-console.jar)
7、控制台操作步骤如下:
#连接数据库
orientdb> connect PLOCAL:/apps/data/sonatype-work/nexus3/db/component admin admin
#导出数据库
orientdb {db=component}> EXPORT DATABASE /nexus_db_backup/orientdb-component.export
#关闭数据库连接
orientdb {db=component}> DISCONNECT
#删除有问题的数据库
orientdb> DROP DATABASE PLOCAL:/apps/data/sonatype-work/nexus3/db/component admin admin
#重新创建有问题的数据库
orientdb> CREATE DATABASE PLOCAL:/apps/data/sonatype-work/nexus3/db/component admin admin
#导入数据库
orientdb {db=component}> IMPORT DATABASE /nexus_db_backup/orientdb-component.export.gz
#关闭数据库连接
orientdb {db=component}> DISCONNECT
#退出控制台
orientdb> EXIT
8、启动nexus服务,cd /usr/local/nexus-3.7.1-02/bin
执行 ./nexus start
(注:如果nexus仓库服务文件比较大,启动nexus服务的时间可能会比较长,大约需要3-5分钟左右)
更多推荐
所有评论(0)