如何将数据从mysql导入solr [英] How to import data from mysql to solr
问题描述
我正在尝试使用以下 URL 进行完整的数据库导入
I am trying to do the full db import using below URL
`127.0.0.1:8983/solr/dataimport?command=full-import`
我安装了 solr 并尝试配置它.我更改了几个文件并添加了详细信息(文件名和添加的代码如下所述).但是当我尝试将表数据导入 solr json 格式时,它显示以下错误:
I installed solr and trying to configure it. I changed few files and putted details (file names and added code is described below). But when I am trying to import the table data into solr json format it is showing below error:
HTTP ERROR 404
Problem accessing /solr/dataimport. Reason:
Not Found
Powered by Jetty://
谁能告诉我实际问题是什么?还是我错误地配置了 Sorl?
Can anyone let me know what the actual problem is? Or did I misconfigure Sorl?
我的 data-config.xml 文件有以下代码:
My data-config.xml file have below code:
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/sq_dbLoveOffers"
user="pksqueak"
password="passwd"/>
<document>
<entity name="id"
query="select sq_prom_id, sq_prom_name, sq_prom_description, sq_latitude, sq_longitude from sq_offers">
</entity>
</document>
</dataConfig>
<小时>
我在 Solrconfig.xml 中添加了以下代码:
I added below code into Solrconfig.xml:
<lib dir="../../../../contrib/dataimporthandler/lib/" regex=".*.jar" />
<lib dir="../../../dist/" regex="apache-solr-dataimporthandler-d.*.jar" />
和
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
<小时>
我在 schema.xmal FILE 中添加了以下代码:
I added below code in schema.xmal FILE:
<fields>
<field name="sq_prom_id" type="string" indexed="true" stored="true" required="true" />
<field name="sq_prom_name" type="string" indexed="true" stored="true" />
<field name="sq_prom_description" type="string" indexed="true" stored="true" />
<field name="sq_latitude" type="string" indexed="true" stored="true" />
<field name="sq_longitude" type="string" indexed="true" stored="true" />
</fields>
推荐答案
我使用以下命令为 DIH 运行 sorl 服务器.
I used below command to run sorl server for DIH.
java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar
java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar
并且我使用以下 URL 进行了完整导入,它解决了我的问题.
and I did the full import using below URL, it solved my problem.
http://127.0.0.1:8983/solr/db/dataimport?command=full-import
这篇关于如何将数据从mysql导入solr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!