You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Zheng Lin Edwin Yeo <ed...@gmail.com> on 2016/12/13 15:38:22 UTC

Renaming a collection

Hi,

Is it possible to rename a collection without using a collection API? I
could not find any rename action in the Collections API.

I read from here
http://stackoverflow.com/questions/34889307/how-can-i-rename-a-core-created-in-solr

that we can use action=RENAME

http://localhost:8983/solr/admin/cores?action=RENAME&core=oldname&other=newname

However, this action=RENAME is not in the latest Solr guide, and it didn't
work either when I tried it.

I'm using Solr 6.2.1.

Regards,
Edwin

Re: Renaming a collection

Posted by Erick Erickson <er...@gmail.com>.
Why not just use a collection alias?

Best,
Erick

On Tue, Dec 13, 2016 at 7:38 AM, Zheng Lin Edwin Yeo
<ed...@gmail.com> wrote:
> Hi,
>
> Is it possible to rename a collection without using a collection API? I
> could not find any rename action in the Collections API.
>
> I read from here
> http://stackoverflow.com/questions/34889307/how-can-i-rename-a-core-created-in-solr
>
> that we can use action=RENAME
>
> http://localhost:8983/solr/admin/cores?action=RENAME&core=oldname&other=newname
>
> However, this action=RENAME is not in the latest Solr guide, and it didn't
> work either when I tried it.
>
> I'm using Solr 6.2.1.
>
> Regards,
> Edwin

Re: Renaming a collection

Posted by Zheng Lin Edwin Yeo <ed...@gmail.com>.
Hi Erick and Shawn,

Thanks for the response and information.

Regards,
Edwin

On 14 December 2016 at 00:53, Shawn Heisey <ap...@elyograg.org> wrote:

> 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
>
>

Re: Renaming a collection

Posted by Shawn Heisey <ap...@elyograg.org>.
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