How to access the admin interface of an EmbeddedSolrServer instance?

余生颓废 提交于 2019-12-10 14:27:16

问题


In my web app I am running an org.apache.solr.client.solrj.embedded.EmbeddedSolrServer for debugging purposes I would like to access the admin interface.

This is how I instantiate the server:

new EmbeddedSolrServer(new CoreContainer.Initializer().initialize(), "");           

Is there a way to open the admin interface of this embedded server like so?

http://localhost:<defaultport>/admin

If so which port would I have to use (what is the default port)?

Else is there a setting that I use to specify the web path for accessing the admin UI?


回答1:


No, there isn't. At least, not while your application is running.

The embedded solr server reads and writes the index directly on your filesystem in your solr install directory. To access the admin console, shut down your app. In a console navigate to your /example in your solr install directory. Type java -jar start.jar. Then, you can navigate to http://localhost:8983/solr to access the admin directory.

You can not have your solr server running and be running an application that accesses the same index via EmbeddedSolrServer or you will get a LockObtainFailedException. Solr only allows one reader/writer per index at a time, and that reader/writer obtains a 'lock' in order to access the index. This prevents the index from becoming corrupted from multiple simultaneous reads/writes.

For that reason, I prefer to use the HttpSolrServer instead of the EmbeddedSolrServer, even for a development environment.

See: http://wiki.apache.org/solr/Solrj#EmbeddedSolrServer




回答2:


Yes you can, just use reditect tricks

redirect the url you want

http://localhost:/admin

to solr admin url

http://localhost:8983/solr



来源:https://stackoverflow.com/questions/16922247/how-to-access-the-admin-interface-of-an-embeddedsolrserver-instance

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