How to access the admin interface of an EmbeddedSolrServer instance?

In my web application, I run org.apache.solr.client.solrj.embedded.EmbeddedSolrServer for debugging purposes, I would like to access the admin interface.

This is how I create the server instance:

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

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

 http://localhost:<defaultport>/admin 

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

Does Else have a parameter that I use to specify a web path to access the admin user interface?

+4
source share
2 answers

No no. At least while the application is not working.

The built-in solr server reads and writes the index directly to your file system in the solr installation directory. To access the admin console, disable the application. In the console, navigate to your example in the solr installation directory. Type java -jar start.jar. Then you can go to http://localhost:8983/solr to access the admin directory.

You cannot start your solr server and run an application that accesses the same index through EmbeddedSolrServer, or you will get a LockObtainFailedException. Solr allows only one reader / writer per index at a time, and the reader / writer receives a “lock” to access the index. This prevents index corruption from multiple simultaneous read / write operations.

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

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

+6
source

Yes, you can just use reditect

redirect the desired URL

http: // localhost : / admin

to solr admin url

http: // localhost: 8983 / solr

0
source

Source: https://habr.com/ru/post/1484446/


All Articles