Change Solr base context path

时光毁灭记忆、已成空白 提交于 2019-12-11 10:47:02

问题


I've installed a Solr (5.3.1 and 5.5.0) in a Ubuntu machine.

With apache I've made a

ProxyPass /MySolr http://{url}:8984/solr

ProxyPassReverse /MySolr http://{url}:8984/solr

So, when I load {url}/MySolr the Dashboard doesn't load because one json.

http://{url}/solr/admin/cores?wt=json&indexInfo=false&_=...

That's normal because the correct URL to load would be:

http://{url}/MySolr/admin/cores?wt=json&indexInfo=false&_=...

When i see the other resouces, solr get the correct URL like:

http://{url}/MySolr/js/scripts/segments.js?_=5.5.0

Any idea?


回答1:


This process will not work because probably this json is specified with absolute path. In this case Solr doesn't know your mapping. If you want to change the context path you need to change this configuration on Jetty. This way solr will start using the new context. The first step is create a symbolic link MySolr pointing to solr directory (default located in $SOLR_INSTALL_DIR/server/). Now change the Jetty configuration file $SOLR_INSTALL_DIR/server/contexts/solr-jetty-context.xml to point to the new context path like this:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath"><Property name="hostContext" default="/MySolr"/></Set>
  <Set name="war"><Property name="jetty.base"/>/solr-webapp/webapp</Set>
  <Set name="defaultsDescriptor"><Property name="jetty.base"/>/etc/webdefault.xml</Set>
  <Set name="extractWAR">false</Set>
</Configure>

Now just restart Solr to be able to access using the new base context path.



来源:https://stackoverflow.com/questions/36059747/change-solr-base-context-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!