SOLR 数据导入错误“无法执行查询" [英] SOLR DataImport Error "Unable to Execute Query"

查看:37
本文介绍了SOLR 数据导入错误“无法执行查询"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 Amazon EC2 实例上运行的网站,我正在尝试让 Solr 与我正在使用的数据库进行交互和使用.我能够使用管理界面并已将示例 xml 文件编入索引,但是每当我尝试导入我的数据库表之一时,我都会收到错误

I have a website running on an Amazon EC2 Instance, and I'm trying to get Solr to interface and work with the database I'm using. I'm able to use the admin interface and have gotten the example xml files indexed, but whenever I try to import one of my database tables, I get the error

SEVERE: Exception while processing: gamelydb document : SolrInputDocument[{}]:org.apache.solr.handler.dataimport.DataImportHandlerException:
 Unable to execute query: SELECT * FROM league Processing Document # 1

这是我的 data-config.xml 文件.我还在 solrconfig.xml 文件中添加了 dataimporthandler.

Here's my data-config.xml file. I also added the dataimporthandler to the solrconfig.xml file.

<dataConfig>
  <dataSource type="JdbcDataSource"
              driver="com.mysql.jdbc.Driver"
              url="jdbc:mysql://www.mysite.com/mydb"
              user="root"
              password="mypassword"/>
  <document>
    <entity name="mydb"
            query="SELECT * FROM league">
       <field column="id" name="id" />
       <field column="leaguename" name="leaguename" />
    </entity>
  </document>
</dataConfig>

知道为什么会这样吗?如果我需要澄清任何事情,请告诉我.

Any idea why this is happening? And just let me know if I need to clarify anything.

所以我稍微更改了 url 并删除了http://",该错误似乎消失了.但是,似乎无法通过管理员搜索任何信息.现在数据目录中有几个文件(_1.fnm、_1.frq、...).这是 solr 打印到日志的内容.

So I changed the url a bit and removed the 'http://' and that error seemed to go away. However none of the information seems to be searchable through the admin. There are now a few files in the data directory (_1.fnm, _1.frq,...). Here is what solr prints to the log.

Jul 13, 2011 1:19:45 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/dataimport params={} status=0 QTime=4
Jul 13, 2011 1:19:48 PM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/dataimport params={command=full-import} status=0 QTime=4
Jul 13, 2011 1:19:48 PM org.apache.solr.handler.dataimport.DataImporter doFullImport
INFO: Starting Full Import
Jul 13, 2011 1:19:48 PM org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
INFO: Read dataimport.properties
Jul 13, 2011 1:19:48 PM org.apache.solr.update.DirectUpdateHandler2 deleteAll
INFO: [] REMOVING ALL DOCUMENTS FROM INDEX
Jul 13, 2011 1:19:48 PM org.apache.solr.core.SolrDeletionPolicy onInit
INFO: SolrDeletionPolicy.onInit: commits:num=1
        commit{dir=/home/ec2-user/public_html/solr/example/solr/data/index,segFN=segments_2,version=1310405039852,generation=2,filenames=[_0.tis, _0.nrm, _0.fnm, _0.tii, _0.frq, segments_2, _0.fdx, _0.fdt]
Jul 13, 2011 1:19:48 PM org.apache.solr.core.SolrDeletionPolicy updateCommits
INFO: newest commit = 1310405039852
Jul 13, 2011 1:19:48 PM org.apache.solr.handler.dataimport.JdbcDataSource$1 call
INFO: Creating a connection for entity gamelydb with URL: jdbc:mysql://www.gamely.us/gamelydb
Jul 13, 2011 1:19:49 PM org.apache.solr.handler.dataimport.JdbcDataSource$1 call
INFO: Time taken for getConnection(): 667
Jul 13, 2011 1:19:49 PM org.apache.solr.handler.dataimport.DocBuilder finish
INFO: Import completed successfully
Jul 13, 2011 1:19:49 PM org.apache.solr.update.DirectUpdateHandler2 commit
INFO: start commit(optimize=true,waitFlush=false,waitSearcher=true,expungeDeletes=false)
Jul 13, 2011 1:19:49 PM org.apache.solr.core.SolrDeletionPolicy onCommit
INFO: SolrDeletionPolicy.onCommit: commits:num=2
        commit{dir=/home/ec2-user/public_html/solr/example/solr/data/index,segFN=segments_2,version=1310405039852,generation=2,filenames=[_0.tis, _0.nrm, _0.fnm, _0.tii, _0.frq, segments_2, _0.fdx, _0.fdt]
        commit{dir=/home/ec2-user/public_html/solr/example/solr/data/index,segFN=segments_3,version=1310405039855,generation=3,filenames=[_1.fdx, _1.tis, _1.frq, _1.fdt, _1.tii, _1.fnm, _1.nrm, segments_3]
Jul 13, 2011 1:19:49 PM org.apache.solr.core.SolrDeletionPolicy updateCommits
INFO: newest commit = 1310405039855
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher <init>
INFO: Opening Searcher@1c4795e main
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming Searcher@1c4795e main from Searcher@1d38b87 main
        fieldValueCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming result for Searcher@1c4795e main
        fieldValueCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming Searcher@1c4795e main from Searcher@1d38b87 main
        filterCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming result for Searcher@1c4795e main
        filterCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming Searcher@1c4795e main from Searcher@1d38b87 main
        queryResultCache{lookups=0,hits=0,hitratio=0.00,inserts=1,evictions=0,size=1,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming result for Searcher@1c4795e main
        queryResultCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming Searcher@1c4795e main from Searcher@1d38b87 main
        documentCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher warm
INFO: autowarming result for Searcher@1c4795e main
        documentCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener sending requests to Searcher@1c4795e main
Jul 13, 2011 1:19:49 PM org.apache.solr.core.QuerySenderListener newSearcher
INFO: QuerySenderListener done.
Jul 13, 2011 1:19:49 PM org.apache.solr.update.DirectUpdateHandler2 commit
INFO: end_commit_flush
Jul 13, 2011 1:19:49 PM org.apache.solr.core.SolrCore registerSearcher
INFO: [] Registered new searcher Searcher@1c4795e main
Jul 13, 2011 1:19:49 PM org.apache.solr.search.SolrIndexSearcher close
INFO: Closing Searcher@1d38b87 main
        fieldValueCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
        filterCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
        queryResultCache{lookups=0,hits=0,hitratio=0.00,inserts=1,evictions=0,size=1,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
        documentCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
Jul 13, 2011 1:19:49 PM org.apache.solr.handler.dataimport.SolrWriter readIndexerProperties
INFO: Read dataimport.properties
Jul 13, 2011 1:19:49 PM org.apache.solr.handler.dataimport.SolrWriter persist
INFO: Wrote last indexed time to /home/ec2-user/public_html/solr/example/solr/./conf/dataimport.properties
Jul 13, 2011 1:19:49 PM org.apache.solr.update.processor.LogUpdateProcessor finish
INFO: {deleteByQuery=*:*,add=[9, 10, 11, 12, 13, 14],optimize=} 0 4
Jul 13, 2011 1:19:49 PM org.apache.solr.handler.dataimport.DocBuilder execute
INFO: Time taken = 0:0:1.66

如果您发现这里的某些内容无法投票,请告诉我,以便我可以修复它.

If you find something on here that's downvotable, please just let me know so I can fix it.

推荐答案

我认为问题出在 url 参数上.如果 MySQL 数据库在同一台机器上,则使用 url="jdbc:mysql://localhost/mydb"如果它在 www.mysite.com 上,则使用 url="jdbc:mysql://www.mysite.com/mydb"

I think the problem is with the url parameter. If the MySQL database is on the same machine, then use url="jdbc:mysql://localhost/mydb" If its on www.mysite.com, then use url="jdbc:mysql://www.mysite.com/mydb"

此外,您的日志文件可能包含有关错误的更多详细信息 - 请仔细阅读日志并在此处发布相应的条目.

Also, your log files may have more details regarding the error - please go through the logs and post the appropriate entries here.

这篇关于SOLR 数据导入错误“无法执行查询"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆