简体   繁体   English

有关将SQL Server数据移至NoSQL或ES / Solr的建议

[英]Suggestions on moving SQL Server data to NoSQL or ES/Solr

I support a Webforms application using a SQL server db. 我支持使用SQL server数据库的Webforms应用程序。

We have a Find functionality in the app, which essentially reads from the db, based on the filter criteria selected in the Find page. 我们在应用程序中具有“查找”功能,该功能实际上是根据“查找”页面中选择的过滤条件从数据库读取的。 I would like make this more performant and dynamic, similar to a search engine. 我想使它更高效,更动态,类似于搜索引擎。

I tried moving the data from SQL Server to ES but was not successful. 我尝试将数据从SQL Server移至ES ,但未成功。 I also need the data to be moved to the NoSQL db or search engine in real time. 我还需要将数据实时移至NoSQL数据库或搜索引擎。

Is it possible for ES / Solr or NoSQL to directly read from SQL Server ? ES / SolrNoSQL可以直接从SQL Server读取? Would that cause latency? 那会导致延迟吗?

Apologies if the above description is vague but I am initially trying to get a high-level understanding of the possible options. 如果上面的描述不明确,我们深表歉意,但我最初是想对可能的选择有一个较高的了解。

Thanks in advance. 提前致谢。

So what you want (and correct me if I'm mistaken) is to transport all the data from your SQL server into Solr? 因此,您想要的(如果我弄错了,请纠正我)是将所有数据从SQL Server传输到Solr吗?

If that's the case then you can use a JDBC and a managed schema to do so. 如果是这种情况,那么您可以使用JDBC和托管模式进行操作。 A JDBC essentially lets you connect Solr to a SQL database, do a query and index the results. JDBC本质上使您可以将Solr连接到SQL数据库,进行查询并为结果建立索引。 This can be used with Solr's data import handler, however the DIH is kinda crap and not suitable for production environments (though acceptable for a one off index), see this link . 可以将它与Solr的数据导入处理程序一起使用,但是DIH有点废话,不适合生产环境(尽管可以接受一次性索引),请参阅此链接 I've had issues with it just not working and being a general turd. 我遇到了一些问题,只是无法正常工作而已。

A JDBC isn't Solr specific, it's just a Java program that connects to a database, performs a query and receives the results. JDBC不是Solr特有的,它只是一个连接数据库,执行查询并接收结果的Java程序。 It's not hard to make your own that would take the SQL results, format them into a Solr friendly format and post them to your core/collection. 制作SQL结果并将其格式化为Solr友好格式并将其发布到您的核心/集合并不难。 Here's an intro to JDBC's and there's plenty more out there. 这是 JDBC的简介,并且还有更多内容。

A managed schema is just a flexible schema that infers your field types and creates them as needed, good for a first pass until you need to fine tune the schema. 托管模式只是一种灵活的模式,它可以推断您的字段类型并根据需要创建它们,这对首次使用很有用,直到您需要微调该模式为止。 So as the SQL results are indexed, Solr will just create a field type for each column. 因此,在对SQL结果进行索引时,Solr只会为每列创建一个字段类型。

So with a bit of coding and configuration you can get it like so: 因此,通过一些编码和配置,您可以像这样:

  1. Create Solr core/collection with default schema and config 使用默认架构和配置创建Solr核心/集合
  2. Create JDBC to connect to your DB and perform necessary query 创建JDBC以连接到数据库并执行必要的查询
  3. Have JDBC convert SQL results to Solr friendly fashion (there should be info out there about that too, it's not too hard, Solr accpets many formats) 让JDBC将SQL结果转换为Solr友好的方式(那里也应该有相关的信息,这不太难,Solr支持多种格式)
  4. Make it post said results to your core/collection 将其发布到您的核心/收藏中
  5. Run JDBC 运行JDBC

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

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