You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by nskarthik <ns...@gmail.com> on 2021/10/15 12:55:06 UTC

Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Hi

Spec : JDK15, Solrj / Solr8.10.0.

Process  Create Cores via SOLRJ with AAA on multiple requirements for Standalone Version Only 

Note  :  Would not like to use SOLAR CORE API 

Reason : Need to Hide the Admin UI from creation of duplicate / unnecessary cores  or controls.

Request : Please share snippet Java - code using SOLRJ  for the same.


with regard
 



Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by nskarthik <ns...@gmail.com>.
Hi
Thx for the AAA tip, will do some HMWK .

this thread can be closed.

thx for help appriciated,

with regards

On 2021/10/19 12:51:11, Shawn Heisey <ap...@elyograg.org> wrote: 
> On 10/18/2021 11:24 PM, nskarthik wrote:
> > Thx for the snippet of SolrJ code for Core Creation...
> > 
> > Request Do we have a Solr/Solrj internal implementation of AAA on this Core creation
> 
> I have never used that capability in Solr.  It's there, but I have found 
> that the best way to secure Solr is by restricting it at the network 
> level to only the IP addresses of people and software that actually need it.
> 
> https://solr.apache.org/guide/8_10/basic-authentication-plugin.html
> 
> > Do we have a GIT repository with these sorts of java-solr example.. to try
> 
> I wrote that code by hand from scratch by exploring the objects with 
> eclipse.  That I know of, there is no comprehensive repository available.
> 
> https://solr.apache.org/guide/8_10/using-solrj.html
> 
> The tests included with Solr's source code are probably the best 
> reference for all of SolrJ's capability.  I confess that I have not 
> looked at most of the tests.
> 
> Thanks,
> Shawn
> 

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/18/2021 11:24 PM, nskarthik wrote:
> Thx for the snippet of SolrJ code for Core Creation...
> 
> Request Do we have a Solr/Solrj internal implementation of AAA on this Core creation

I have never used that capability in Solr.  It's there, but I have found 
that the best way to secure Solr is by restricting it at the network 
level to only the IP addresses of people and software that actually need it.

https://solr.apache.org/guide/8_10/basic-authentication-plugin.html

> Do we have a GIT repository with these sorts of java-solr example.. to try

I wrote that code by hand from scratch by exploring the objects with 
eclipse.  That I know of, there is no comprehensive repository available.

https://solr.apache.org/guide/8_10/using-solrj.html

The tests included with Solr's source code are probably the best 
reference for all of SolrJ's capability.  I confess that I have not 
looked at most of the tests.

Thanks,
Shawn

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by nskarthik <ns...@gmail.com>.
Hi

Thx for the snippet of SolrJ code for Core Creation...

Request Do we have a Solr/Solrj internal implementation of AAA on this Core creation

Reason : I want restricted access for core creation.

Do we have a GIT repository with these sorts of java-solr example.. to try


with regards
karthik

On 2021/10/18 12:39:18, "Mark H. Wood" <mw...@iupui.edu> wrote: 
> On Sun, Oct 17, 2021 at 12:41:44PM -0600, Shawn Heisey wrote:
> > On 10/17/2021 7:08 AM, nskarthik wrote:
> > >>> not possible when Solr is in standalone mode
> > > I use Solr in NON-CLOUD  standalone mode.
> > > 
> > > Process :  /solr Create -c <new core>
> > > This feature just creates an empty core (copies all required default files ), but why this cannot be created from SOLRJ ?
> > > 
> > > If this feature is made available with AAA, Core creation would be simple and powerful.
> > 
> > When Solr is in cloud mode, the bin/solr script copies a config up to 
> > ZooKeeper and then calls the Collections API.  These are both API calls, 
> > not filesystem manipulation.  Solr does all the work of creating cores. 
> >   This is possible because with SolrCloud, the active config for a 
> > collection is not on disk, it's in ZooKeeper.
> > 
> > As you might have figured out, it's the config that makes things difficult.
> > 
> > Normally when Solr is in standalone mode, the bin/solr script creates a 
> > core directory with the required structure, copies a config into the 
> > newly created directory structure, and then calls the http-based 
> > CoreAdmin API to complete the registration of a new core in Solr.  Solr 
> > cannot do the directory/file creation in standalone mode.
> 
> Thank you for explaining this.  From time to time I run into something
> I need to do and am blocked because it only works in cloud mode.
> These prohibitions have always seemed completely arbitrary.  Maybe
> they will make more sense to me now.
> 
> -- 
> Mark H. Wood
> Lead Technology Analyst
> 
> University Library
> Indiana University - Purdue University Indianapolis
> 755 W. Michigan Street
> Indianapolis, IN 46202
> 317-274-0749
> www.ulib.iupui.edu
> 

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by "Mark H. Wood" <mw...@iupui.edu>.
On Sun, Oct 17, 2021 at 12:41:44PM -0600, Shawn Heisey wrote:
> On 10/17/2021 7:08 AM, nskarthik wrote:
> >>> not possible when Solr is in standalone mode
> > I use Solr in NON-CLOUD  standalone mode.
> > 
> > Process :  /solr Create -c <new core>
> > This feature just creates an empty core (copies all required default files ), but why this cannot be created from SOLRJ ?
> > 
> > If this feature is made available with AAA, Core creation would be simple and powerful.
> 
> When Solr is in cloud mode, the bin/solr script copies a config up to 
> ZooKeeper and then calls the Collections API.  These are both API calls, 
> not filesystem manipulation.  Solr does all the work of creating cores. 
>   This is possible because with SolrCloud, the active config for a 
> collection is not on disk, it's in ZooKeeper.
> 
> As you might have figured out, it's the config that makes things difficult.
> 
> Normally when Solr is in standalone mode, the bin/solr script creates a 
> core directory with the required structure, copies a config into the 
> newly created directory structure, and then calls the http-based 
> CoreAdmin API to complete the registration of a new core in Solr.  Solr 
> cannot do the directory/file creation in standalone mode.

Thank you for explaining this.  From time to time I run into something
I need to do and am blocked because it only works in cloud mode.
These prohibitions have always seemed completely arbitrary.  Maybe
they will make more sense to me now.

-- 
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/17/2021 2:03 PM, Shawn Heisey wrote:
> Here's SolrJ code to do core creation with a server that already has 
> configsets properly set up:
> 
> https://apaste.info/lt7S

I screwed up the URL when I redacted my actual server name and replaced 
it with server.example.com ... URLs should have two slashes after the 
http: part.

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/17/2021 12:41 PM, Shawn Heisey wrote:
> I need to run to the store right now, but I can look into how to write 
> the SolrJ code when that's finished.

Here's SolrJ code to do core creation with a server that already has 
configsets properly set up:

https://apaste.info/lt7S

Thanks,
Shawn

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/17/2021 7:08 AM, nskarthik wrote:
>>> not possible when Solr is in standalone mode
> I use Solr in NON-CLOUD  standalone mode.
> 
> Process :  /solr Create -c <new core>
> This feature just creates an empty core (copies all required default files ), but why this cannot be created from SOLRJ ?
> 
> If this feature is made available with AAA, Core creation would be simple and powerful.

When Solr is in cloud mode, the bin/solr script copies a config up to 
ZooKeeper and then calls the Collections API.  These are both API calls, 
not filesystem manipulation.  Solr does all the work of creating cores. 
  This is possible because with SolrCloud, the active config for a 
collection is not on disk, it's in ZooKeeper.

As you might have figured out, it's the config that makes things difficult.

Normally when Solr is in standalone mode, the bin/solr script creates a 
core directory with the required structure, copies a config into the 
newly created directory structure, and then calls the http-based 
CoreAdmin API to complete the registration of a new core in Solr.  Solr 
cannot do the directory/file creation in standalone mode.

There IS a way, though.  There is a Solr feature called configsets that 
makes it possible to use ONLY the CoreAdmin API to create a core.

https://solr.apache.org/guide/8_6/config-sets.html

You do have to set up the configsets location.  If you use the service 
installer, the default place for configsets is /var/solr/data/configsets 
... and that directory will not be created by the service installer.

With configsets properly set up, I was able to create a core with just 
this API call:

http://server:port/solr/admin/cores?action=CREATE&name=mycore&configSet=_default

This should be possible with SolrJ using the CoreAdmin capability.  I 
need to run to the store right now, but I can look into how to write the 
SolrJ code when that's finished.

Thanks,
Shawn

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by nskarthik <ns...@gmail.com>.
Hi

>>not possible when Solr is in standalone mode
I use Solr in NON-CLOUD  standalone mode.

Process :  /solr Create -c <new core>  
This feature just creates an empty core (copies all required default files ), but why this cannot be created from SOLRJ ?

If this feature is made available with AAA, Core creation would be simple and powerful.


with regards
Karthik 

On 2021/10/16 16:43:48, Shawn Heisey <ap...@elyograg.org> wrote: 
> On 10/15/2021 6:55 AM, nskarthik wrote:
> > Spec : JDK15, Solrj / Solr8.10.0.
> > 
> > Process  Create Cores via SOLRJ with AAA on multiple requirements for Standalone Version Only
> > 
> > Note  :  Would not like to use SOLAR CORE API
> > 
> > Reason : Need to Hide the Admin UI from creation of duplicate / unnecessary cores  or controls.
> > 
> > Request : Please share snippet Java - code using SOLRJ  for the same.
> 
> It is not possible when Solr is in standalone mode to create cores just 
> with the API or with SolrJ.
> 
> Using the CoreAdmin API (via SolrJ or directly via HTTP) is the last 
> step in creating a new core without restarting Solr in standalone mode, 
> but Solr cannot create the files on disk for a core unless it is in 
> SolrCloud mode.
> 
> Thanks,
> Shawn
> 

Re: Solrj / Solr8.10.0 , Create new Core Collection using Solrj

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/15/2021 6:55 AM, nskarthik wrote:
> Spec : JDK15, Solrj / Solr8.10.0.
> 
> Process  Create Cores via SOLRJ with AAA on multiple requirements for Standalone Version Only
> 
> Note  :  Would not like to use SOLAR CORE API
> 
> Reason : Need to Hide the Admin UI from creation of duplicate / unnecessary cores  or controls.
> 
> Request : Please share snippet Java - code using SOLRJ  for the same.

It is not possible when Solr is in standalone mode to create cores just 
with the API or with SolrJ.

Using the CoreAdmin API (via SolrJ or directly via HTTP) is the last 
step in creating a new core without restarting Solr in standalone mode, 
but Solr cannot create the files on disk for a core unless it is in 
SolrCloud mode.

Thanks,
Shawn