Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create new cores in SOLR via HTTP?

Tags:

Is it possible to create new cores in SOLR via HTTP? I can't seem to find a definitive answer to what seems like a very simple question...

Each core I want to create will have the same schema/configuration (multi-tenant SaaS architecture).

I found this page:

  • https://wiki.apache.org/solr/CoreAdmin#CREATE

Which makes me think it's possible, but it's not very clear on specifically what each parameter I'm supposed to pass in actually is:

  • instanceDir - is this the path to where I want the new core to reside, or where the existing "template" core resides? is it a full file path, or a relative one? relative to what?

  • config - is this a full file path to the existing config file? or a relative one? relative to what?

  • schema - same as above

  • dataDir - is this the data dir of the existing core, or the new one? full file path? relative? relative to what? does it already have to exist, or will SOLR create it for me?

like image 295
Keith Palmer Jr. Avatar asked Feb 07 '14 05:02

Keith Palmer Jr.


People also ask

Where are Solr cores stored?

Any core. properties file in any directory of your Solr installation (or in a directory under where solr_home is defined) will be found by Solr and the defined properties will be used for the core named in the file. In standalone mode, solr. xml must reside in solr_home .


Video Answer


1 Answers

Yes, you can create the Solr cores via HTTP. You have found the correct URL (https://wiki.apache.org/solr/CoreAdmin) to look into. All the above parameters are optional.

instanceDir - This is the path where your new core will be created. It'll create the folder structure provided by you, under "/example/solr/". If you don't provide this parameter, it'll automatically create a new core (with the collection no) like collection1.

config - If you want to have a different solrconfig.xml for the new core, then provide this. Otherwise, it'll share the existing core's (collection1) config by default.

schema - If you want to have a different schema.xml for the new core, then provide this. Otherwise, it'll share the existing core's (collection1) schema by default.

dataDir - This is the path where your new core's data will be stored. It'll create the folder structure provided by you under the new core folder.

If you really don't want some different configuration for your new core, follow the sample HTTP URL

http://localhost:8983/solr/admin/cores?action=CREATE&name=core_name&numShards=2&replicationFactor=2

Hope this will help.

like image 113
buddy86 Avatar answered Sep 29 '22 13:09

buddy86