On 8/13/2013 3:07 AM, xinwu wrote: > When I managed collections via the Collections API. > How can I set the 'instanceDir' name? > eg:http://localhost:8983/solr/admin/collections?action=CREATE&name=mycollection&numShards=3&replicationFactor=4 > > My instanceDir is 'mycollection_shard2_replica1'. > How can I change it to 'mycollection'?
I don't think the collections API can do this, and to be honest, I don't know why you would want to. It would make it impossible to have more than one shard per Solr node, a capability that many people require. The question of "why would you want to?" is something I'm genuinely asking here. Admin URLs accessed directly by client programs are the only logical reason I can think of. For querying and updating the index, you can use /solr/mycollection as a base URL to access your index, even though the shard names are different. As for the admin URLs that let you access system information, SOLR-4943 will make most of that available without a core name in Solr 4.5. To access core-specific information, you need to use the actual core name, but it should be possible to gather information about which machine has which core in an automated way. That said, if you create your collection a different way, you should be able to do exactly what you want. What you would want to do is use the zkcli command "linkconfig" to link a new collection with an already uploaded config set, and then create the individual cores in your collection using the CoreAdmin API instead of the Collections API. http://wiki.apache.org/solr/SolrCloud#Command_Line_Util http://wiki.apache.org/solr/SolrCloud#Creating_cores_via_CoreAdmin Thanks, Shawn