solr cloud切换数据目录
一、背景
solr由于运行了几年时间,数据占用空间大,于是便挂载了一块大的数据盘,并把之前数据目录里的数据拷贝到新挂载目录,启动后发现控制台无法打开,并且报错,报错信息如下截图:
HTTP ERROR 404 javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down. URI: /solr/ STATUS: 404 MESSAGE: javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down. SERVLET: default CAUSED BY: javax.servlet.ServletException: javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down. CAUSED BY: javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down. Caused by: javax.servlet.ServletException: javax.servlet.UnavailableException: Error processing the request. CoreContainer is either not initialized or shutting down. at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:162) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:516) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:773) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:905) at java.lang.Thread.run(Thread.java:748)
二、解决方案
1、设置路径并拷贝数据
找到solr的solr.in.sh配置 文件,一般再安装目录的bin目录下,我的是/opt/solr/bin,修改SOLR_HOME为新数据目录
这里注意一个点拷贝原来数据到新目录时一定要全部拷贝,包括solr.xml 文件 我报错的原因就是没有拷贝solr.xml,其实注释已经说的很清楚了,当时没注意到
# Path to a directory for Solr to store cores and their data. By default, Solr will use server/solr Solr存储内核及其数据的目录路径。 默认情况下,Solr将使用server/ Solr # If solr.xml is not stored in ZooKeeper, this directory needs to contain solr.xml 如果solr.xml不在ZooKeeper中,则需要在该目录下存放solr.xml
#SOLR_HOME=/opt/solr/data 原来的目录 SOLR_HOME=/data/solr/data 新挂载的目录
2、重启
/etc/init.d/solr restart
作者:凉生墨客
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。