问题
I have a SolrCloud (v5.2) setup with 2 different cores [users, docs
] working properly.
Now I need to be able to dynamically add new cores that are configuration-wise identical to the docs
core that already exists. I don't want to duplicate the configuration (I tried an it works OK) as I need to actually share the synonyms.txt
and some other files that constantly change.
I think that I need "configsets" but I cannot get them to work. I uploaded the "template" conf using this command:
sh zkcli.sh -zkhost zk1:2181 -cmd upconfig -confname template -confdir /home/user1/template/conf
And then I tried to create a new core using the template
configset like this:
http://solr1:8983/solr/admin/cores?action=CREATE&configSet=template&name=test1
But I get this error:
Error CREATEing SolrCore 'test1': Unable to create core [test1] Caused by: Could not find configName for collection test1 found:[users, docs, template, .system]
I think that I have some missing knowledge on how configsets work.
回答1:
the default path to directory with configset is $SOLR_HOME/configsets ie in my example is /opt/solr/solr-5.4.0/server/solr/configsets. This path can be configured in solr.xml.
So, if you use the default path for configset then this
sh zkcli.sh -zkhost zk1:2181 -cmd upconfig -confname template -confdir /home/user1/template/conf
should be replaced with
sh zkcli.sh -zkhost zk1:2181 -cmd upconfig -confname template -confdir /home/user1/......../../../configsets
just replace this path /home/user1/......../../../configsets with your correct path for the configsets
Hope this helps
回答2:
You can share a configuration for a Core and just create a new Collection. Any changes to the configuration will affect all Collections.
Use this call to create the new Collection:
http://solr1:8983/solr/admin/collections?action=CREATE&name=test1&collection.configName=docs&numShards=1
来源:https://stackoverflow.com/questions/36715193/solr-adding-cores-using-a-configset-in-a-solrcloud-setup-does-not-work