How to add a Solr core without restarting the Solr server

solr

Question

How do I add a Solr core without restarting the Solr server?

Is it possible at all?

My current way of adding Solr cores (with server restart)

According to this FAQ I do the following:

  1. Copy an existing Solr core
  2. Rename the core name by opening the file core.properties and editing the field name like name=my_core
  3. Restart the Solr Windows service

My preferred way of adding Solr cores (without server restart)

Same as above but after step 2 I'd like to have some way to make the core visible in the Solr web interface without having to restart the entire server.

My research so far

Resources on the Internet indicate that it should be possible, but I havent been able to get it to work yet.

Forum: Load cores without restarting/reloading Solr

In this forum they just say "yes, it is possible" and point to this Solr documentation page called CoreAdmin.

Serverfault question: solr core reload without an tomcat restart

This serverfault question solr core reload without an tomcat restart has an answer which points to #RELOAD section of the same CoreAdmin Solr documentation as above, but I can't get Solr to load new cores with neither

http://localhost:8983/solr/admin/cores?action=RELOAD&core=my_core 

nor

http://localhost:8983/solr/admin/cores?action=RELOAD

For http://localhost:8983/solr/admin/cores?action=RELOAD&core=my_core I get an HTTP 400 Bad Request.

For http://localhost:8983/solr/admin/cores?action=RELOAD I get the following NullPointerException which I don't know how to interpret:

<response>
    <lst name="responseHeader">
        <int name="status">500</int>
        <int name="QTime">0</int>
    </lst>
    <lst name="error">
        <str name="trace">
            java.lang.NullPointerException at java.util.TreeMap.getEntry(TreeMap.java:342) at java.util.TreeMap.containsKey(TreeMap.java:227) at java.util.TreeSet.contains(TreeSet.java:234) at org.apache.solr.handler.admin.CoreAdminHandler.handleReloadAction(CoreAdminHandler.java:726) at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestInternal(CoreAdminHandler.java:226) at org.apache.solr.handler.admin.CoreAdminHandler.handleRequestBody(CoreAdminHandler.java:189) at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143) at org.apache.solr.servlet.SolrDispatchFilter.handleAdminRequest(SolrDispatchFilter.java:783) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:282) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:220) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:368) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72) at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745)
        </str>
        <int name="code">500</int>
    </lst>
</response>

Versions

  • Windows Server 2008 R2 Standard
  • Solr 5.1.0

Best Answer

  1. Copy an existing Solr core
  2. Rename the core name by opening the file core.properties and editing the field name like name=my_core
  3. Restart the Solr Windows service
  4. On the Solr web interface, select Core Admin and click on button Add Core
  5. Type

    name = my_core

    instanceDir: my_core

  6. Click button Add Core

Solr Core Admin Add Core