On 3/25/22 10:08, Armin Mueller wrote:
I'm trying to create a new core with SolrJ's CoreAdminRequest.createCore.

CoreAdmin cannot create the directory/files for a new core.  They must already exist before the create is called.  If you want Solr to create cores without touching the filesystem yourself beforehand, you must run in SolrCloud mode, and then you'll be creating collections, not using CoreAdmin.  There is a ConfigSets feature for standalone mode that MIGHT do what you need, but I have never actually used it, and I don't think SolrJ has any convenience methods for it.

In wherever your solr home is, create the "xyz" directory, in that directory create a "conf" directory, and in the conf directory, put your solrconfig.xml, managed-schema, and any config files referenced by those files.  Change the ownership on all that to whatever user is running the Solr process.

Then when you run the createCore method, do it without the last two arguments.  Solr will find the config in the conf directory, create a data directory, and create a "core.properties" file so the core will be automatically loaded when Solr starts up again.

You might be thinking "but wait ... bin/solr can do it!"  That's because bin/solr creates the core directory and copies a config in place BEFORE it calls CoreAdmin.

Thanks,
Shawn

Reply via email to