1. 程式人生 > 其它 >nexus中異常導致的不能正常啟動的問題 '/nexus-data/db/config'

nexus中異常導致的不能正常啟動的問題 '/nexus-data/db/config'

在kubeopertor中建立新的k8s叢集時,總是報錯10.12.8.16:8081/xx/xxx不通導致建立叢集失敗。在kubeoperator中檢視nexus的容器狀態為unhealth,且nexus的8081 8082 8083埠均不通,檢視nexus容器得到報錯

ERROR [ForkJoinPool.commonPool-worker-1] *SYSTEM com.orientechnologies.orient.core.storage.impl.local.paginated. OLocalPaginatedStorage - Exception `75806EC9` in storage `plocal:/nexus-data/db/config`: 2.2.36 (build d3beb772c02098ceaea89779a7afd4b7305d37 88, branch 2.2.x)
com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/nexus-data/db/config' with mode=rw
DB name="config"

可能是由於之前這臺伺服器的磁碟滿了導致導致orientdb資料損壞,需要進行資料修復,重啟nexus重啟伺服器依然異常。

由報錯可知是config資料庫出現問題

經過百度看到文章http://www.renhl.com/linux/2020/06/05/nexus-repair-orientdb.html

使用root許可權進入容器

docker exec -it -u root  4344ab1ab44e sh

進入該db目錄,刪除所有*.wal檔案

cd /nexus-data/db/config

rm -rf *.wal

查詢修復工具nexus-orient-console.jar的路徑

find / -name nexus-orient-console.jar

執行修復

java -jar /opt/sonatype/nexus/lib/support/nexus-orient-console.jar

orientdb> export database config-export

orientdb> drop database

orientdb> create database plocal:/nexus-data/db/config admin admin

orientdb> import database config-export.json.gz -preserveClusterIDs=true

orientdb> rebuild index *

orientdb> disconnect

這樣資料庫修復好了

還需要給db資料庫更改許可權,現在很多屬主是root啟動會有問題。

chmod 777 -R  /nexus-data/nexus/db

重啟nexus

docker start container_id && docker logs -f container_id

nexus啟動成功,8081 8082 8083 埠都通了。