简体   繁体   English

来自多个数据库表的Solr数据导入处理程序

[英]Solr data import handler from multiple database tables

I have a problem in importing data using data import handler in Solr from multiple database tables residing on completely different databases. 我在Solr中使用数据导入处理程序从驻留在完全不同的数据库中的多个数据库表导入数据时遇到问题。 One table is from an on premise oracle database and the other is from an Oracle RDS cloud database. 一个表来自内部oracle数据库,另一个表来自Oracle RDS云数据库。

My data import handler query is: 我的数据导入处理程序查询是:

select 
  emp.eid, emp.ename, dept.deptid, dept.dname
from 
  emp inner join dept on emp.deptid = dept.deptid

Now this dept table is moved to another database. 现在,该dept表已移至另一个数据库。

In this scenario how can I index the data from multiple database tables. 在这种情况下,如何索引多个数据库表中的数据。

This is not really a problem that Solr will help you to solve. Solr不会帮助您解决这个问题。 You should tackle this with an Oracle Database Link . 您应该使用Oracle Database Link解决此问题。 You need to create the database link within the database server that wants to connect to the dept table. 您需要在要连接到dept表的数据库服务器内创建数据库链接。 After that create a view or materialized view within the database with the link for Solr to fetch the data from. 之后,在数据库中创建一个视图或实例化视图,并提供链接以供Solr从中获取数据。 That view should use the query that you have shown to us, with small changes due to the natuer of database links. 该视图应使用您显示给我们的查询,并且由于数据库链接的性质而需要进行少量更改。 Then you can create a dataimport handler within Solr to fetch and import your data from that view. 然后,您可以在Solr中创建一个数据导入处理程序,以从该视图中获取和导入数据。 Solr shouldn't need to know that there is more than one database server involved. Solr不需要知道涉及多个数据库服务器。

If you have trouble doing this, head over to 如果您在执行此操作时遇到麻烦,请前往

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

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