因为磁盘满了的时候,nexus的orientdb数据库文件损坏了。导致调用API时报错:Exception 241F5D11
in storage plocal:/nexus-data/db/component
参考:
进入到nexus db目录下,找到对应的component目录,
cd /usr/local/soft/sonatype-work4/nexus3/db/component
rm -rf *.wal
java -jar /usr/local/soft/nexus-3.13.0-01/lib/support/nexus-orient-console.jar
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/component admin admin
REBUILD INDEX *
REPAIR DATABASE --fix-graph
REPAIR DATABASE --fix-links
REPAIR DATABASE --fix-ridbags
REPAIR DATABASE --fix-bonsai
DISCONNECT
以root用户进入nexus的docker容器内,授权目录给所有用户
docker exec -it -u root 4344ab1ab44e sh
chmod 777 -R /nexus-data/nexus/db
重启nexus容器即可
参考脚本命令
cd /usr/local/soft/sonatype-work4/nexus3/db/accesslog
cd /usr/local/soft/sonatype-work4/nexus3/db/analytics
cd /usr/local/soft/sonatype-work4/nexus3/db/component
cd /usr/local/soft/sonatype-work4/nexus3/db/audit
cd /usr/local/soft/sonatype-work4/nexus3/db/config
cd /usr/local/soft/sonatype-work4/nexus3/db/security
rm -rf *.wal
java -jar /usr/local/soft/nexus-3.13.0-01/lib/support/nexus-orient-console.jar
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/accesslog admin admin
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/analytics admin admin
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/component admin admin
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/audit admin admin
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/config admin admin
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/security admin admin
REBUILD INDEX *
REPAIR DATABASE --fix-graph
REPAIR DATABASE --fix-links
REPAIR DATABASE --fix-ridbags
REPAIR DATABASE --fix-bonsai
DISCONNECT
数据库备份恢复:
java -jar /usr
/local/soft/nexus-3.13.0-01/lib/support/nexus-orient-console.jar
CONNECT PLOCAL:/usr/local/soft/sonatype-work4/nexus3/db/component admin admin
BACKUP DATABASE /usr/local/soft/nexus-3.13.0-01/backup/component20210226
RESTORE DATABASE /usr/local/soft/nexus-3.13.0-01/backup/component20210226
RESTORE DATABASE /usr/local/soft/nexus-3.13.0-01/backup/component-2021-02-25-22-33-54-3.13.0-01.bak
java -jar /usr/local/soft/nexus-3.13.0-01/lib/support/nexus-orient-console.jar
export database component-export
drop database
create database plocal:/usr/local/soft/sonatype-work4/nexus3/db/component admin admin
import database component-export.json.gz -preserveClusterIDs=true
rebuild index *
disconnect
参考链接:
[1]: https://www.jianshu.com/p/d7062aaf5ccb
[2]: http://www.manongjc.com/detail/28-fvyemwfkpimjbai.html