Select Page

Importing MySQL db into Solr4.











When I restarted Solr, I kept getting the exception ‘DataImportHandler not found’
For some reason, I had no ‘dists’ dir or ‘contrib’ in my /opt/solr. So I copied one accross:

cd /opt
tar -xvf solr-4.3.0-src.tgz

cp -r solr-4.3.0-src/dist /opt/solr
cp -r solr-4.3.0-src/contrib /opt/solr

Then I was missing the ‘com.mysql.jdbc.Driver’

sudo apt-get install libmysql-java

$ sudo cp /usr/share/maven-repo/mysql/mysql-connector-java/5.1.16/mysql-connector-java-5.1.16.jar /opt/solr/contrib/dataimporthandler/lib/mysql-connector-java-5.1.16.jar
Not sure if this was correct, so to make sure
$ sudo cp /usr/share/maven-repo/mysql/mysql-connector-java/5.1.16/mysql-connector-java-5.1.16.jar /opt/solr/dist/mysql-connector-java-5.1.16.jar

sudo chmod 755 mysql-connector-java-5.1.16.jar

open up SolrConfig.xml
$ sudo nano /opt/solr/example/solr/collection1/conf/solrconfig.xml

and add:

%d bloggers like this: