How Solr knows the Cores it has on startup?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How Solr knows the Cores it has on startup?

Shashank Pedamallu
Hi,

I wanted to know how does Solr pick up cores on startup. Basically, what I would like to try is Read cores created from one Solr instance from another Solr instance. i.e.,

  *   I will have 2 Solr Instances SOLR1, SOLR2. Only SOLR1 is started.
  *   I’m creating a core (Core1) using SOLR1.
  *   After filling it to some capacity, I unload this core without deleting the data.
  *   I would now start SOLR2 and would like to point SOLR2 to Core1.
Can someone please share me the details on how I can achieve this?

Thanks,
Shashank
Reply | Threaded
Open this post in threaded view
|

Re: How Solr knows the Cores it has on startup?

simon-2
It will look for cores based on the discovery of core.propeties files. Full
details at the link below.

https://lucene.apache.org/solr/guide/6_6/defining-core-properties.html#defining-core-properties

There is a gotcha in what you want to do in that on  an unload, the
core.properties file is deleted in current versions of Solr - so you'll
have to find a way (outside Solr) to copy it or re-create it.

What is the use case here ?

best

-Simon

On Tue, Sep 12, 2017 at 1:27 PM, Shashank Pedamallu <[hidden email]>
wrote:

> Hi,
>
> I wanted to know how does Solr pick up cores on startup. Basically, what I
> would like to try is Read cores created from one Solr instance from another
> Solr instance. i.e.,
>
>   *   I will have 2 Solr Instances SOLR1, SOLR2. Only SOLR1 is started.
>   *   I’m creating a core (Core1) using SOLR1.
>   *   After filling it to some capacity, I unload this core without
> deleting the data.
>   *   I would now start SOLR2 and would like to point SOLR2 to Core1.
> Can someone please share me the details on how I can achieve this?
>
> Thanks,
> Shashank
>
Reply | Threaded
Open this post in threaded view
|

Re: How Solr knows the Cores it has on startup?

Shawn Heisey-2
In reply to this post by Shashank Pedamallu
On 9/12/2017 11:27 AM, Shashank Pedamallu wrote:
> I wanted to know how does Solr pick up cores on startup. Basically, what I would like to try is Read cores created from one Solr instance from another Solr instance. i.e.,
>
>   *   I will have 2 Solr Instances SOLR1, SOLR2. Only SOLR1 is started.
>   *   I’m creating a core (Core1) using SOLR1.
>   *   After filling it to some capacity, I unload this core without deleting the data.
>   *   I would now start SOLR2 and would like to point SOLR2 to Core1.
> Can someone please share me the details on how I can achieve this?

In Solr 4.4, the core discovery process became usable.  In 4.x versions
starting with 4.4, core discovery was optional, but recommended.

https://wiki.apache.org/solr/Core%20Discovery%20%284.4%20and%20beyond%29

In Solr 5.0, the old solr.xml way of specifying cores was removed, and
now Solr only supports core discovery.

Through the CoreAdmin API, you can add Solr cores that are positioned
anywhere on the filesystem, but if you want them to be found on startup,
they must all be located in one place, typically underneath the solr
home directory.  You can use filesystem tricks like symlinks to have the
true locations be variable.

It would be a very bad idea to try and have two Solr instances pointing
at the same solr home, unless you could be absolutely certain that they
would never run at the same time.  Instead, you should move or copy a
core from one instance's solr home to that of another instance to
transfer it.

Thanks,
Shawn

Reply | Threaded
Open this post in threaded view
|

Re: How Solr knows the Cores it has on startup?

Erick Erickson
Easiest way is just to copy the entire directory that contains
core.properties to the second Solr's SOLR_HOME directory (I'd have the
Solr instanced down). The core discovery Shawn mentioned just
recursively descends from SOLR_HOME and whenever it encounters a
core.properties figures out that this is a core and loads it. So you
have some directory like
blah/core1
that has core.properties in it. Just move core1 to SOLR_HOME for solr2.

But this really seems like an XY problem. What do you hope to gain by
this? Why not just create a new core on Solr2 and start using that? Or
do you have a lot of cores on this machine and are just balancing the
number of them? In the latter case, why not just use SolrCloud and
ADDREPLICA/DELETEREPLICA to move cores around?

Best,
Erick

On Wed, Sep 13, 2017 at 6:09 AM, Shawn Heisey <[hidden email]> wrote:

> On 9/12/2017 11:27 AM, Shashank Pedamallu wrote:
>> I wanted to know how does Solr pick up cores on startup. Basically, what I would like to try is Read cores created from one Solr instance from another Solr instance. i.e.,
>>
>>   *   I will have 2 Solr Instances SOLR1, SOLR2. Only SOLR1 is started.
>>   *   I’m creating a core (Core1) using SOLR1.
>>   *   After filling it to some capacity, I unload this core without deleting the data.
>>   *   I would now start SOLR2 and would like to point SOLR2 to Core1.
>> Can someone please share me the details on how I can achieve this?
>
> In Solr 4.4, the core discovery process became usable.  In 4.x versions
> starting with 4.4, core discovery was optional, but recommended.
>
> https://wiki.apache.org/solr/Core%20Discovery%20%284.4%20and%20beyond%29
>
> In Solr 5.0, the old solr.xml way of specifying cores was removed, and
> now Solr only supports core discovery.
>
> Through the CoreAdmin API, you can add Solr cores that are positioned
> anywhere on the filesystem, but if you want them to be found on startup,
> they must all be located in one place, typically underneath the solr
> home directory.  You can use filesystem tricks like symlinks to have the
> true locations be variable.
>
> It would be a very bad idea to try and have two Solr instances pointing
> at the same solr home, unless you could be absolutely certain that they
> would never run at the same time.  Instead, you should move or copy a
> core from one instance's solr home to that of another instance to
> transfer it.
>
> Thanks,
> Shawn
>