7

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?

zsawyer
  • 1,824
  • 17
  • 24

2 Answers2

13

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

Mike Nitchie
  • 1,166
  • 2
  • 13
  • 29
  • I need to debug during the context of my application. So swapping `EmbeddedSolrServer` with `HttpSolrServer` during development (or at least during the debugging session) is now my method of choice. Thank you for a great and detailed answer! – zsawyer Jun 08 '13 at 21:49
0

Yes you can, just use reditect tricks

redirect the url you want

http://localhost:/admin

to solr admin url

http://localhost:8983/solr

LF00
  • 27,015
  • 29
  • 156
  • 295