On 12/13/2016 8:38 AM, Zheng Lin Edwin Yeo wrote:
> Is it possible to rename a collection without using a collection API?
> I could not find any rename action in the Collections API. 

No.  There is no rename functionality.  The workaround is to use the
alias feature, which Erick mentioned.  Renaming a collection could be
done with a significant amount of manual editing, both in the relevant
nodes and in zookeeper.  If you want to try this, I strongly recommend
that you shut down the relevant Solr instances.  As you can might
imagine, it would be highly disruptive.

> I read from here
> http://stackoverflow.com/questions/34889307/how-can-i-rename-a-core-created-in-solr
> that we can use action=RENAME 

That's on a *core*, not a *collection*.  Using the core rename
functionality while running SolrCloud will cause issues.  It might be as
simple as losing one shard replica, or it could completely break the
collection.

The CoreAdmin API still has the rename commmand in 6.3, but the
Collections API has never had it.  It is theoretically possible to
implement it, but it would never execute in an atomic way, which is the
main reason it has never been done.

By atomic, I mean in a manner that results in the old collection
handling requests up to the change, then the new collection handling the
very next request.  The rename would probably take a few seconds, during
which both the old and the new collections might be nonfunctional.  It
would be nearly as disruptive as doing it manually.  This is problematic
for anything trying to query or update the collection.

Collection aliases provide nearly equivalent functionality in SolrCloud
to what's available in standalone mode with core renames.  If you always
use an alias, you have the option of changing an existing alias to point
at a new real collection, or you can make a new alias and then delete
the old one.

Thanks,
Shawn

Reply via email to