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 Richard Walker <ri...@ardc.edu.au> on 2019/07/16 06:14:07 UTC

Upload/use a plugin JAR in ZooKeeper

Hi, I'm trying to use a plugin JAR containing
a custom query parser.

I've been able to get this to work the "simple" way,
by putting the JAR in the file system, and specifying
basic

  <lib dir="..." regex="..." />
  <queryParser name="..." class="..." />

values in solrconfig.xml. No problem doing it this way.

But I'm running in SolrCloud mode and I'd like to take
advantage of an option that the user guide seems to offer
at this page:

https://lucene.apache.org/solr/guide/8_1/resource-and-plugin-loading.html

But, so far, I don't see how to make it work.

To be specific, I'm trying to use this idea:

"Resources and plugins may be stored:
• in ZooKeeper under a collection’s configset node (SolrCloud only);"

Note: I'm _not_ trying to do the _third_ option listed, i.e.,
"• in Solr’s Blob Store (SolrCloud only)", that uses
the ".system" collection.

The user guide seems to suggest that I can upload the JAR
to the collection's config using zk cp:
"To upload a plugin or resource to a configset
already stored on ZooKeeper, you can use bin/solr zk cp."

So, I've used zk cp to upload the JAR to
zk:/configs/my_collection/my_plugin.jar
(I also tried various other subdirectories such as
zk:/configs/my_collection/lib/my_plugin.jar)

So far, so good. But now how do I refer to the JAR in solrconfig.xml?
The user guide doesn't really say.

I've tried specifying the location of the JAR
with various values of <lib ...> element.

No success at all; I only get a ClassNotFoundException
for the plugin class.

Could someone please tell me what I'm missing, i.e., what
I need to do to use a plugin JAR stored
"in ZooKeeper under a collection’s configset node"?

Richard.


Re: Upload/use a plugin JAR in ZooKeeper

Posted by Noble Paul <no...@gmail.com>.
are you interested in this

SOLR-13534: Dynamic loading to support loading jars from a URL

https://issues.apache.org/jira/browse/SOLR-13534

On Fri, Jul 19, 2019 at 12:18 PM Richard Walker
<ri...@ardc.edu.au> wrote:
>
> On 19 Jul 2019, at 12:02 pm, Chee Yee Lim <ch...@gmail.com> wrote:
> > Not sure if this is the recommended way, but I managed to use plugin JARs
> > with Solr Cloud.
> >
> > Either include the absolute path to JAR in solrconfig.xml, or put the JAR
> > in a "lib" folder relative to your instanceDir. See the following text from
> > solrconfig.xml.
>
> As I already noted in my original message of 16 July:
>
> > I've been able to get this to work the "simple" way,
> > by putting the JAR in the file system, and specifying
> > basic
> >
> >  <lib dir="..." regex="..." />
> >  <queryParser name="..." class="..." />
> >
> > values in solrconfig.xml. No problem doing it this way.
>
> ... and that this is precisely what I do _not_ want to do,
> unless I have to.
>
> I want to use a JAR file uploaded to the collection's znode,
> as the user guide strongly suggests is possible.
> (And also again, no, I don't want to configure/use the Blob Store.)
>


-- 
-----------------------------------------------------
Noble Paul

Re: Upload/use a plugin JAR in ZooKeeper

Posted by Richard Walker <ri...@ardc.edu.au>.
On 19 Jul 2019, at 12:02 pm, Chee Yee Lim <ch...@gmail.com> wrote:
> Not sure if this is the recommended way, but I managed to use plugin JARs
> with Solr Cloud.
> 
> Either include the absolute path to JAR in solrconfig.xml, or put the JAR
> in a "lib" folder relative to your instanceDir. See the following text from
> solrconfig.xml.

As I already noted in my original message of 16 July:

> I've been able to get this to work the "simple" way,
> by putting the JAR in the file system, and specifying
> basic
> 
>  <lib dir="..." regex="..." />
>  <queryParser name="..." class="..." />
> 
> values in solrconfig.xml. No problem doing it this way.

... and that this is precisely what I do _not_ want to do,
unless I have to.

I want to use a JAR file uploaded to the collection's znode,
as the user guide strongly suggests is possible.
(And also again, no, I don't want to configure/use the Blob Store.)


Re: Upload/use a plugin JAR in ZooKeeper

Posted by Chee Yee Lim <ch...@gmail.com>.
Not sure if this is the recommended way, but I managed to use plugin JARs
with Solr Cloud.

Either include the absolute path to JAR in solrconfig.xml, or put the JAR
in a "lib" folder relative to your instanceDir. See the following text from
solrconfig.xml.

If a "./lib" directory exists in your instanceDir, all files found in it
are included as if you had used the following syntax...
<lib dir="./lib" />

If you modified the solrconfig.xml or other config files, remember to
upload it into Solr using the ConfigSet API or via command line tools. And
create a collection that uses the custom configset.

Hope this helps.

On Fri, 19 Jul 2019 at 09:20, Richard Walker <ri...@ardc.edu.au>
wrote:

> On 16 Jul 2019, at 4:14 pm, Richard Walker <ri...@ardc.edu.au>
> wrote:
> > ...
> >
> > To be specific, I'm trying to use this idea:
> >
> > "Resources and plugins may be stored:
> > • in ZooKeeper under a collection’s configset node (SolrCloud only);"
> >
> > ...
> >
> > So far, so good. But now how do I refer to the JAR in solrconfig.xml?
> > The user guide doesn't really say.
> >
> > ...
> >
> > No success at all; I only get a ClassNotFoundException
> > for the plugin class.
> >
> > ...
>
> I've now found this earlier thread:
>
>
> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201701.mbox/%3cCAKHkODQV-y59+7M86oGVf1Feqj6iEiogp8TrhL1MG5fUAjL+MA@mail.gmail.com%3e
>
> in which the second message (from Shawn Heisey) says:
>
> > I actually do not know what the path for lib directives is relative to
> > when running SolrCloud.  Most things in a core config are relative to
> > the location of the config file itself, but in this case, the config
> > file is not on the filesystem at all, it's in zookeeper, and I don't
> > think Solr can use jars in zookeeper.
>
> So is this the definitive answer? As I suggested in my
> earlier message, the documentation in the user guide at
> https://lucene.apache.org/solr/guide/8_1/resource-and-plugin-loading.html
> strongly suggests that you _can_ use plugin JARs uploaded
> to a collection's znode.
>
> Richard.
>
>

Re: Upload/use a plugin JAR in ZooKeeper

Posted by Richard Walker <ri...@ardc.edu.au>.
On 16 Jul 2019, at 4:14 pm, Richard Walker <ri...@ardc.edu.au> wrote:
> ...
> 
> To be specific, I'm trying to use this idea:
> 
> "Resources and plugins may be stored:
> • in ZooKeeper under a collection’s configset node (SolrCloud only);"
> 
> ...
> 
> So far, so good. But now how do I refer to the JAR in solrconfig.xml?
> The user guide doesn't really say.
> 
> ...
> 
> No success at all; I only get a ClassNotFoundException
> for the plugin class.
> 
> ...

I've now found this earlier thread:

http://mail-archives.apache.org/mod_mbox/lucene-solr-user/201701.mbox/%3cCAKHkODQV-y59+7M86oGVf1Feqj6iEiogp8TrhL1MG5fUAjL+MA@mail.gmail.com%3e

in which the second message (from Shawn Heisey) says:

> I actually do not know what the path for lib directives is relative to
> when running SolrCloud.  Most things in a core config are relative to
> the location of the config file itself, but in this case, the config
> file is not on the filesystem at all, it's in zookeeper, and I don't
> think Solr can use jars in zookeeper.  

So is this the definitive answer? As I suggested in my
earlier message, the documentation in the user guide at
https://lucene.apache.org/solr/guide/8_1/resource-and-plugin-loading.html
strongly suggests that you _can_ use plugin JARs uploaded
to a collection's znode.

Richard.