How do I import a mySQL database table into Solr 6?

1.2k views Asked by At

I am trying to import a simple mySQL table into Solr and keep failing. Having ploughed through:

and half a dozen other posts that are related to Solr4, I am in desperate need of some community help.

I need specific instructions for Solr 6, it's installed on RedHat to connect to a mySQL DB. Thanks a lot.

1

There are 1 answers

0
Abhijit Bashetti On

Please find the steps below..

  1. Install Java Runtime Environment (JRE) version 1.8 for Solr 6.1

  2. Set Java home "export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_101/"

  3. Download solr 6.1 "solr-6.1.0.tgz" from http://www-eu.apache.org/dist/lucene/solr/6.1.0/

  4. Extract tgz file using "tar zxf solr-6.1.0.tgz".

  5. Open the port 8983 as to communicate with solr.

  6. Go to the path ../solr-6.1.0/ and start the server with "bin/solr start"

  7. Create a config folder named myConfig under configsets directory , move the conf folder into it. Add the data-config.xml into "/myConfig/conf".

Modified the schema.xml under the folder "/myConfig/conf" and add the data-config.xml.

add teh entry in solconfig.xml

data-config.xml

  1. Fire the url to create the core.

http://localhost:8983/solr/admin/cores?action=CREATE&name=mycore&instanceDir=my_instance&configSet=myConfig

  1. Add the jars "solr-dataimporthandler-6.1.0.jar", "solr-dataimporthandler-extras-6.1.0.jar" to path "/home/abhijit/Downloads/solr-6.1.0/server/lib".

  2. Add the "solr-core-6.1.0.jar" jar to the path "/home/abhijit/Downloads/solr-6.1.0/server/lib".

  3. Add the "solr-solrj-6.1.0.jar" jar to the path "/home/abhijit/Downloads/solr-6.1.0/server/lib".

  4. If you do the above steps you will ge the error like :

    "Error Instantiating requestHandler, org.apache.solr.handler.dataimport.DataImportHandler failed to instantiate org.apache.solr.request.SolrRequestHandler" This problem occurred because dataimporthandler and requesthandler are loaded by two different class loaders. To solve it, ensure that solr loads its jars only from the same class loader.

    Option to steps 5,6,7 create a folder lib inside the solr folder at path "/home/abhijit/Downloads/solr-6.1.0/server/solr" and add the entry of the same to solrConfig.xml as "". Comment the other lib entries from solrConfig.xml the jars "solr-dataimporthandler-6.1.0.jar", "solr-dataimporthandler-extras-6.1.0.jar" to path "/home/abhijit/Downloads/solr-6.1.0/server/solr/lib".

  5. Commented the updateRequestProcessorChain in solrConfig.xml.

  6. Command for full import

http://localhost:8983/solr/mycore/dataimport?command=full-import&clean=true&commit=true

if you have any params to pass on then do something like this

http://localhost:8983/solr/mycore/dataimport?command=full-import&clean=true&commit=true&cabinetId=5654174