Created on 08-18-2016 05:43 AM - edited 08-17-2019 10:49 AM
Solr indexing the MySQL database table on HDP 2.5 Tech Preview:
Solr version used: solr 4.9.0
Step1: Downloaded the solr 4.9.0.zip from
https://archive.apache.org/dist/lucene/solr/4.9.0/
Step2: Extract the file:
Step3: modify the solrconfig.xml, schema.xml and add the db-data-config.xml at
Step4: add the jar at this location
<lib dir="../../../contrib/dataimporthandler/lib/" regex=".*\.jar" />
<lib dir="../../../dist/" regex="solr-dataimporthandler-\d.*\.jar" />
<lib dir="../../../lib/" regex="mysql-connector-java-5.0.8-bin.jar" />
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">db-data-config.xml</str>
</lst>
</requestHandler>
<dynamicField name="*_name" type="text_general" multiValued="false" indexed="true" stored="true" />
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/employees"
user="root"
password="hadoop" />
<document>
<entity name="id" query="select emp_no as 'id', first_name, last_name from employees limit 1000;" />
</document>
</dataConfig>
After this is complete run the below command (d) to start solr and check if solr is up and running at url below: 8983 is the default port of solr
d.java –jar start.jar
http://localhost:8983/solr/#/
Step5:
Setting up database:
Import an already available database into Mysql:
Step6: With this our indexing is complete using Solr.
To do:
I will try indexing the tables in Mysql using latest version of Solr.
Reference: http://blog.comperiosearch.com/blog/2014/08/28/indexing-database-using-solr/
Hope this helps….
Thanks,
Sujitha