Re: Renaming a collection

2016-12-13 Thread Zheng Lin Edwin Yeo
Hi Erick and Shawn,

Thanks for the response and information.

Regards,
Edwin

On 14 December 2016 at 00:53, Shawn Heisey  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

2016-12-13 Thread Shawn Heisey
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

2016-12-13 Thread Erick Erickson
Why not just use a collection alias?

Best,
Erick

On Tue, Dec 13, 2016 at 7:38 AM, Zheng Lin Edwin Yeo
 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

2016-05-14 Thread Anil
Hi Arcadius,

Yeah.. i was using that. i am trying to understand if there is a way to
rename collection name.

Thanks for the response.

Regards,
Anil

On 14 May 2016 at 16:53, Arcadius Ahouansou  wrote:

> Hi Anil.
> You may want to look at collection alias
>
>
> https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api4
>
> When using alias, the name of the underlying collection should not really
> matter.
>
> Thanks.
>
>
> On 14 May 2016 at 10:58, Anil  wrote:
>
> > Seems solr allows to rename the core only not the collection.
> >
> > On 14 May 2016 at 15:06, Anil  wrote:
> >
> > > HI,
> > >
> > > Can we rename the collection ?
> > >
> > > if yes, action=rename with request path /admin/cores works ? Please
> > > clarify.
> > >
> > > i tried following code.. but no luck.
> > >
> > > CloudSolrServer cloudSolrServer = new
> > > CloudSolrServer("localhost:2181/solr");
> > > cloudSolrServer.setDefaultCollection("test-collection-2010");
> > > ModifiableSolrParams modParams = new ModifiableSolrParams();
> > > modParams.set(CoreAdminParams.ACTION,
> > > CoreAdminParams.CoreAdminAction.RENAME.name());
> > >
> > > // for (int i = 2010; i<= 2010; i++){
> > > modParams.set(CoreAdminParams.CORE, "test-collection-2010");
> > > modParams.set(CoreAdminParams.OTHER, "test-collection-new-2010");
> > > try {
> > > QueryRequest request = new QueryRequest(modParams);
> > > request.setPath("/admin/cores");
> > > System.out.println(request.toString());
> > > NamedList response = cloudSolrServer.request(request);
> > > System.out.println("collection rename of 2010 is completed");
> > > }catch(Exception ex){
> > > System.out.println("collection rename of 2010 is failed");
> > > ex.printStackTrace();
> > > }
> > > // }
> > >
> > > Thanks,
> > > Anil
> > >
> >
>
>
>
> --
> Arcadius Ahouansou
> Menelic Ltd | Applied Knowledge Is Power
> Office : +441444702101
> Mobile: +447908761999
> Web: www.menelic.com
> ---
>


Re: Renaming a collection

2016-05-14 Thread Arcadius Ahouansou
Hi Anil.
You may want to look at collection alias

https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api4

When using alias, the name of the underlying collection should not really
matter.

Thanks.


On 14 May 2016 at 10:58, Anil  wrote:

> Seems solr allows to rename the core only not the collection.
>
> On 14 May 2016 at 15:06, Anil  wrote:
>
> > HI,
> >
> > Can we rename the collection ?
> >
> > if yes, action=rename with request path /admin/cores works ? Please
> > clarify.
> >
> > i tried following code.. but no luck.
> >
> > CloudSolrServer cloudSolrServer = new
> > CloudSolrServer("localhost:2181/solr");
> > cloudSolrServer.setDefaultCollection("test-collection-2010");
> > ModifiableSolrParams modParams = new ModifiableSolrParams();
> > modParams.set(CoreAdminParams.ACTION,
> > CoreAdminParams.CoreAdminAction.RENAME.name());
> >
> > // for (int i = 2010; i<= 2010; i++){
> > modParams.set(CoreAdminParams.CORE, "test-collection-2010");
> > modParams.set(CoreAdminParams.OTHER, "test-collection-new-2010");
> > try {
> > QueryRequest request = new QueryRequest(modParams);
> > request.setPath("/admin/cores");
> > System.out.println(request.toString());
> > NamedList response = cloudSolrServer.request(request);
> > System.out.println("collection rename of 2010 is completed");
> > }catch(Exception ex){
> > System.out.println("collection rename of 2010 is failed");
> > ex.printStackTrace();
> > }
> > // }
> >
> > Thanks,
> > Anil
> >
>



-- 
Arcadius Ahouansou
Menelic Ltd | Applied Knowledge Is Power
Office : +441444702101
Mobile: +447908761999
Web: www.menelic.com
---


Re: Renaming a collection

2016-05-14 Thread Anil
Seems solr allows to rename the core only not the collection.

On 14 May 2016 at 15:06, Anil  wrote:

> HI,
>
> Can we rename the collection ?
>
> if yes, action=rename with request path /admin/cores works ? Please
> clarify.
>
> i tried following code.. but no luck.
>
> CloudSolrServer cloudSolrServer = new
> CloudSolrServer("localhost:2181/solr");
> cloudSolrServer.setDefaultCollection("test-collection-2010");
> ModifiableSolrParams modParams = new ModifiableSolrParams();
> modParams.set(CoreAdminParams.ACTION,
> CoreAdminParams.CoreAdminAction.RENAME.name());
>
> // for (int i = 2010; i<= 2010; i++){
> modParams.set(CoreAdminParams.CORE, "test-collection-2010");
> modParams.set(CoreAdminParams.OTHER, "test-collection-new-2010");
> try {
> QueryRequest request = new QueryRequest(modParams);
> request.setPath("/admin/cores");
> System.out.println(request.toString());
> NamedList response = cloudSolrServer.request(request);
> System.out.println("collection rename of 2010 is completed");
> }catch(Exception ex){
> System.out.println("collection rename of 2010 is failed");
> ex.printStackTrace();
> }
> // }
>
> Thanks,
> Anil
>