简体   繁体   English

SOLR索引2个数据库

[英]SOLR indexing 2 databases

We are trying to build a SOLR index with data coming from 2 different databases, 我们正在尝试使用来自2个不同数据库的数据构建S​​OLR索引,

Looking at that http://wiki.apache.org/solr/DataImportHandler#Multiple_DataSources , it seems it should be possible but we are having issues. 查看该http://wiki.apache.org/solr/DataImportHandler#Multiple_DataSources ,似乎应该可以,但我们遇到了问题。

 <dataConfig>
  <dataSource 
    name="ds-1"
    type="JdbcDataSource" 
    driver="Driver"
    url="jdbc_url1" 
    user="user1" 
    password="pass1"/>

<dataSource
    name="ds-2"
    type="JdbcDataSource" 
    driver="Driver"
    url="jdbc_url2" 
    user="user2" 
    password="pass2"/>

   <document>

 <entity name="entity1" datasource="ds-1" query="SELECT YYY  FROM TABLE">
      <field column="YYY" name="YYY"/>
    </entity>

 <entity name="entity2" datasource="ds-2" query="SELECT ZZZ FROM TABLE">
      <field column="ZZZ" name="ZZZ"/>
    </entity>

  </document>
</dataConfig>

When trying to run the indexer, it works for the first entity/query/ds and then fail with org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT ZZZ FROM TABLE 尝试运行索引器时,它适用于第一个实体/查询/ ds,然后因org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT ZZZ FROM TABLE而失败org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT ZZZ FROM TABLE

It seems it's trying to execute query2 on the ds-1... 似乎正在尝试在ds-1上执行query2 ...

We also played changing the order of the datasources and/or entity definition, and it seems it can always only index the first one. 我们还改变了数据源和/或实体定义的顺序,似乎它总是只能索引第一个。

Are we doing something wrong? 我们做错什么了吗? do we have wrong expectation of what SOLR can do? 我们对SOLR可以做什么抱有错误的期望?

Thanks for the help 谢谢您的帮助

I believe your problem is just a case issue. 我相信您的问题只是一个案例问题。 datasource should be dataSource , as I recall Solr XML configuration attributes are case-sensitive. datasource应该是dataSource ,我记得Solr XML配置属性区分大小写。 With the current configuration, dataSource would not be actually defined, so the handler will use the first data source that has been defined (single data source mode). 使用当前配置,将不会实际定义dataSource ,因此处理程序将使用已定义的第一个数据源(单一数据源模式)。

You should change it to: 您应该将其更改为:

<entity name="entity1" dataSource="ds-1" query="SELECT YYY FROM TABLE">
  <field column="YYY" name="YYY"/>
</entity>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM