记一次异常停机损坏了orientdb 导致nexus2无法启动

在一台centos7上通过docker部署了nexus2.
昨天zabbix报警,主机宕机了。查看控制台发现有SATA报错(原因不明)。
主机重启后,nexus服务启动失败。报错
Cannot open local storage ‘/sonatype-work/db/npm’ with mode=rw

详细日志如下:

2017-08-14 01:13:10,635+0000 ERROR [jetty-main-1] *SYSTEM com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore - Life-cycle operation failed
com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/sonatype-work/db/npm' with mode=rw
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:224) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:248) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore.doStart(OrientMetadataStore.java:112) [nexus-npm-repository-plugin-2.14.2-01/:na]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129) [goodies-lifecycle-1.9.jar:1.9]
        at com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore.startOnce(OrientMetadataStore.java:211) [nexus-npm-repository-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.service.internal.MetadataServiceFactoryImpl.createProxyMetadataService(MetadataServiceFactoryImpl.java:70) [nexus-npm-repository-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.proxy.DefaultNpmProxyRepository.<init>(DefaultNpmProxyRepository.java:105) [nexus-npm-repository-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.proxy.DefaultNpmProxyRepository$$FastClassByGuice$$6ad68420.newInstance(<generated>) [sisu-guice-3.2.6.jar:na]
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:32) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:89) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115) [sisu-guice-3.2.6.jar:3.2.6]
        at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176) [org.eclipse.sisu.inject-0.3.1.jar:na]
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:87) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012) [sisu-guice-3.2.6.jar:3.2.6]
        at org.sonatype.nexus.configuration.application.runtime.DefaultApplicationRuntimeConfigurationBuilder.createRepository(DefaultApplicationRuntimeConfigurationBuilder.java:52) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:681) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:665) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createRepositories(DefaultNexusConfiguration.java:637) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createInternals(DefaultNexusConfiguration.java:621) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.NxApplication.doStart(NxApplication.java:160) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.nexus.webapp.WebappBootstrap.contextInitialized(WebappBootstrap.java:168) [classes/:na]
        at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) [jetty-webapp-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) [jetty-webapp-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.Server.doStart(Server.java:282) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:247) [nexus-bootstrap-2.14.2-01.jar:2.14.2-01]
Caused by: java.io.IOException: Input/output error
        at java.io.RandomAccessFile.readBytes(Native Method) ~[na:1.8.0_102]
        at java.io.RandomAccessFile.read(RandomAccessFile.java:377) ~[na:1.8.0_102]
        at java.io.RandomAccessFile.readFully(RandomAccessFile.java:436) ~[na:1.8.0_102]
        at java.io.RandomAccessFile.readFully(RandomAccessFile.java:416) ~[na:1.8.0_102]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog$LogSegment.initPageCache(ODiskWriteAheadLog.java:555) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog$LogSegment.init(ODiskWriteAheadLog.java:279) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:692) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:616) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.initWalAndDiskCache(OLocalPaginatedStorage.java:292) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:167) ~[nexus-orient-plugin-2.14.2-01/:na]
        ... 52 common frames omitted
2017-08-14 01:13:10,640+0000 WARN  [jetty-main-1] *SYSTEM com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore - Could not start OrientMetadataStore
com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/sonatype-work/db/npm' with mode=rw
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:224) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:248) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore.doStart(OrientMetadataStore.java:112) ~[nexus-npm-repository-plugin-2.14.2-01/:na]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129) [goodies-lifecycle-1.9.jar:1.9]
        at com.bolyuba.nexus.plugin.npm.service.internal.orient.OrientMetadataStore.startOnce(OrientMetadataStore.java:211) ~[nexus-npm-repository-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.service.internal.MetadataServiceFactoryImpl.createProxyMetadataService(MetadataServiceFactoryImpl.java:70) [nexus-npm-repository-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.proxy.DefaultNpmProxyRepository.<init>(DefaultNpmProxyRepository.java:105) [nexus-npm-repository-plugin-2.14.2-01/:na]
        at com.bolyuba.nexus.plugin.npm.proxy.DefaultNpmProxyRepository$$FastClassByGuice$$6ad68420.newInstance(<generated>) [sisu-guice-3.2.6.jar:na]
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:105) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector.access$000(ConstructorInjector.java:32) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector$1.call(ConstructorInjector.java:89) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115) [sisu-guice-3.2.6.jar:3.2.6]
        at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176) [org.eclipse.sisu.inject-0.3.1.jar:na]
        at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:87) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:56) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092) [sisu-guice-3.2.6.jar:3.2.6]
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012) [sisu-guice-3.2.6.jar:3.2.6]
        at org.sonatype.nexus.configuration.application.runtime.DefaultApplicationRuntimeConfigurationBuilder.createRepository(DefaultApplicationRuntimeConfigurationBuilder.java:52) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:681) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:665) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createRepositories(DefaultNexusConfiguration.java:637) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createInternals(DefaultNexusConfiguration.java:621) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.NxApplication.doStart(NxApplication.java:160) [nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.nexus.webapp.WebappBootstrap.contextInitialized(WebappBootstrap.java:168) [classes/:na]
        at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) [jetty-webapp-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) [jetty-webapp-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.Server.doStart(Server.java:282) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:247) [nexus-bootstrap-2.14.2-01.jar:2.14.2-01]
Caused by: java.io.IOException: Input/output error
        at java.io.RandomAccessFile.readBytes(Native Method) ~[na:1.8.0_102]
        at java.io.RandomAccessFile.read(RandomAccessFile.java:377) ~[na:1.8.0_102]
        at java.io.RandomAccessFile.readFully(RandomAccessFile.java:436) ~[na:1.8.0_102]
        at java.io.RandomAccessFile.readFully(RandomAccessFile.java:416) ~[na:1.8.0_102]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog$LogSegment.initPageCache(ODiskWriteAheadLog.java:555) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog$LogSegment.init(ODiskWriteAheadLog.java:279) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:692) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog.<init>(ODiskWriteAheadLog.java:616) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.initWalAndDiskCache(OLocalPaginatedStorage.java:292) ~[nexus-orient-plugin-2.14.2-01/:na]
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:167) ~[nexus-orient-plugin-2.14.2-01/:na]
        ... 52 common frames omitted
2017-08-14 01:13:10,657+0000 ERROR [jetty-main-1] *SYSTEM org.sonatype.nexus.NxApplication - Could not start Nexus, user configuration exception!
org.sonatype.configuration.validation.InvalidConfigurationException: Could not lookup a new instance of Repository!
        at org.sonatype.nexus.configuration.application.runtime.DefaultApplicationRuntimeConfigurationBuilder.createRepository(DefaultApplicationRuntimeConfigurationBuilder.java:55) ~[nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:681) ~[nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.instantiateRepository(DefaultNexusConfiguration.java:665) ~[nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createRepositories(DefaultNexusConfiguration.java:637) ~[nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.configuration.application.DefaultNexusConfiguration.createInternals(DefaultNexusConfiguration.java:621) ~[nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.nexus.NxApplication.doStart(NxApplication.java:160) ~[nexus-core-2.14.2-01.jar:2.14.2-01]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport$Handler.doStart(LifecycleSupport.java:70) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext$MainMap_Starting.started(LifecycleHandlerContext.java:255) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleHandlerContext.started(LifecycleHandlerContext.java:57) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.sisu.goodies.lifecycle.LifecycleSupport.start(LifecycleSupport.java:129) [goodies-lifecycle-1.9.jar:1.9]
        at org.sonatype.nexus.webapp.WebappBootstrap.contextInitialized(WebappBootstrap.java:168) [classes/:na]
        at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249) [jetty-servlet-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) [jetty-webapp-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) [jetty-webapp-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.server.Server.doStart(Server.java:282) [jetty-server-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) [jetty-util-8.1.16.v20140903.jar:8.1.16.v20140903]
        at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:247) [nexus-bootstrap-2.14.2-01.jar:2.14.2-01]
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage '/sonatype-work/db/npm' with mode=rw
  at com.bolyuba.nexus.plugin.npm.proxy.DefaultNpmProxyRepository.<init>(DefaultNpmProxyRepository.java:104)
  while locating com.bolyuba.nexus.plugin.npm.proxy.DefaultNpmProxyRepository
  while locating org.sonatype.nexus.proxy.repository.Repository annotated with @com.google.inject.name.Named(value=npm-proxy)

解决

网上查到说是由于非正常关机导致 orientdb 损坏。
需要使用orientdb控制台命令修复。

在nexus的镜像中没有找到orientdb的console命令,所以从官网下载了最新的2.2.25版。

把docker容器中损坏的db复制出来,进行修复:

# 进入容器
docker exec -it nexus /bin/bash

cd /sonatype-work/db

tar czf npm.tar.gz npm

# ^d 退出容器

# 从容器中复制出来,解压到/tmp下
docker cp nexus:/sonatype-work/db/npm.tar.gz /tmp

cd /tmp && tar xzf npm.tar.gz

安装orientdb:

cd /opt
tar xzf orientdb-community-importers-2.2.25.tar.gz
ln -s orientdb-community-importers-2.2.25 orient 

使用orient控制台命令修复:

# 设置环境变量
export ORIENTDB_HOME=/opt/orientdb 
export PATH=$PATH:$ORIENTDB_HOME/bin
# 启动控制台
${ORIENTDB_HOME}/bin/console.sh
# 连接数据库
CONNECT PLOCAL:/tmp/npm admin admin

# 修复
REBUILD INDEX *
REPAIR DATABASE --fix-graph
REPAIR DATABASE --fix-links
REPAIR DATABASE --fix-ridbags
REPAIR DATABASE --fix-bonsai
DISCONNECT

修复后传回docker容器:

cd /tmp
docker cp npm nexus:/sonatype-work/db/

# 启动容器
docker start nexus && docker logs -f nexus

启动时报错,提示文件没有写权限。
这才发现使用docker cp传回的文件都是root账号的。而nexus进程是以nexus账号运行的。

# 使用 --user参数 以root账号进入容器
docker exec -it --user root nexus /bin/bash

# 修改文件所有者为 nexus
cd /sonatype-work/db/
chown -R nexus.nexus npm

# 重启容器
docker start nexus && docker logs -f nexus

重启时报错

Caused by: com.orientechnologies.orient.core.exception.OSerializationException: Cannot load database's configuration. The database seems corrupted
        at com.orientechnologies.orient.core.storage.impl.local.OStorageConfigurationSegment.load(OStorageConfigurationSegment.java:84) ~[na:na]
        at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.open(OAbstractPaginatedStorage.java:162) ~[na:na]
        ... 52 common frames omitted
Caused by: java.lang.NullPointerException: Name is null
        at java.lang.Enum.valueOf(Enum.java:236) ~[na:1.8.0_102]
        at com.orientechnologies.orient.core.config.OStorageClusterConfiguration$STATUS.valueOf(OStorageClusterConfiguration.java:24) ~[na:na]
        at com.orientechnologies.orient.core.config.OStorageConfiguration.fromStream(OStorageConfiguration.java:263) ~[na:na]
        at com.orientechnologies.orient.core.storage.impl.local.OStorageConfigurationSegment.load(OStorageConfigurationSegment.java:82) ~[na:na]
        ... 53 common frames omitted

网上查到说2.1.x版本的数据库与2.2.x的控制台命令有兼容性问题,而且无法回退。
因此下载2.1.17版本,重新进行修复。

这次把orientdb安装到容器里,直接在容器内修复。免得通过docker cp复制来复制去了。

docker cp orientdb-community-2.1.17.tar.gz nexus:/opt/

docker exec -it --user root nexus /bin/bash

cd /opt
tar xzf orientdb-community-2.1.17.tar.gz

ln -s orientdb-community-2.1.17 orientdb

# 删除刚才用2.2.x修复过的损坏的db
cd /sonatype-work/db
rm -rf npm
# 解压原来的备份
tar xzf npm.tar.gz

# 启动控制台
export ORIENTDB_HOME=/opt/orientdb 
export PATH=$PATH:$ORIENTDB_HOME/bin
${ORIENTDB_HOME}/bin/console.sh

# 修复
CONNECT PLOCAL:/sonatype-work/db/npm admin admin

REBUILD INDEX *
REPAIR DATABASE --fix-graph
REPAIR DATABASE --fix-links
REPAIR DATABASE --fix-ridbags
REPAIR DATABASE --fix-bonsai
DISCONNECT

# 重启容器
docker start nexus && docker logs -f nexus

重启nexus,成功启动。

上一篇:取消ORACLE11g用户密码过期期限


下一篇:Al x 量化:智能投顾如何解决金融机构财富管理业务的痛点?