Search code examples
javasolrj

How to access the admin interface of an EmbeddedSolrServer instance?


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?


Solution

  • 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