简体   繁体   中英

How to load native library(.so) in Apache SOLR Cloud mode?

I have written a SOLR custom query parser (implementation of org.apache.solr.search.QParser). My query parser uses some third-party jars. One of the third-party jar requires a native library(.so file) to work. This plugin is working fine when running solr in non-cloud mode, but when I run it on cloud mode, SOLR throws these errors:

java.lang.UnsatisfiedLinkError: Native Library /opt/solr-6.2.0/lib/xyz.so already loaded in another classloader

I have kept all my third-party and query parser jars and .so file in SOLR_HOME/lib directory and have modified:

  1. Added lib dir= "${solr.install.dir:../../../..}/lib/" to solrconfig.xml

  2. In SOLR_HOME/bin/solr file:

    SOLR_START_OPTS= "-Djava.library.path=$SOLR_TIP/lib/"

Please help. Thanks in advance.

Finally, I found the solution for this(credit goes to my one of my senior). When running in cloud mode, follow these instructions:

  1. Create lib directory inside SOLR_HOME and put native-library(.so) file there.
  2. In SOLR_HOME/bin/solr file, add this line to SOLR_START_OPTS :

    SOLR_START_OPTS= "-Djava.library.path=$SOLR_TIP/lib/"

  3. Create lib folders in each node library (ie SOLR_HOME/example/cloud/node1/lib, SOLR_HOME/example/cloud/node2/lib) and put all your custom plugin jars into these newly created lib folders.

  4. Restart the solr in cloud mode.

Hope, it will help !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM