c# - 如何将 MSSQL 同步到 Elasticsearch?

标签 c# sql-server-2008 dapper nest elasticsearch-net

每次我用谷歌搜索时,我都会发现“河流”方法已被弃用。如果这是有用的信息,我正在使用 Dapper。

那么现在有什么解决方案呢?

最佳答案

您的问题过于宽泛 - 因此这是指向一些选项的指针。

Elastic search用于查询数据库和分析数据。

文章中Deprecating Rivers :

客户端库

For more than a year, we've had official client libraries for Elasticsearch in most programming languages. It means that hooking into your application and getting data through an existing codebase should be relatively simple. This technique also allows to easily munge the data before it gets to Elasticsearch. A common example is an application that already used an ORM to map the domain model to a database, and hooking and indexing the domain model back to Elasticsearch tends to be simple to implement.

有大量关于如何使用 Elasticsearch 的文档:

Elasticsearch.Net .

文档将解决以下问题:

安装 package :

PM> Install-Package Elasticsearch.Net

Connection

var node = new Uri("http://mynode.example.com:8082/apiKey");  
var config = new ConnectionConfiguration(node);  
var client = new ElasticsearchClient(config);`  

Security

Pooling and Failover

Building requests

这就是您需要开发的内容。

Response handling

Error handling

插件

Logstash也可以用来代替 Rivers,从中开发了各种插件。

Also, Logstash, or similar tools, can be used to ship data into Elasticsearch. For example, some of the rivers Elasticsearch came with are now implemented as Logstash plugins (like the CouchDB one) in the forthcoming Logstash 1.5.

额外阅读

尽管这是一种不同的语言和框架-博客Advanced Search for Your Legacy Application通过 David Pilato和信息可能有助于浏览。他建议在应用层进行。

解决评论中的问题。

Data changes can be tracked .

SQL Server 提供了一个内置系统来跟踪数据更改,这是一种自动跟踪数据更改的有效方法,无需实现手动方法来检查更改。

有两种方法可以实现这一点:

使用 Change Data Capture :

数据更改使用时间戳进行跟踪。可以跟踪数据更改的历史。

Change data capture provides historical change information for a user table by capturing both the fact that DML changes were made and the actual data that was changed. Changes are captured by using an asynchronous process that reads the transaction log and has a low impact on the system.

使用 Change Tracking :

这有较少的开销,但不会跟踪历史变化。保留最新的更改,但不会再往前。

Change tracking captures the fact that rows in a table were changed, but does not capture the data that was changed. This enables applications to determine the rows that have changed with the latest row data being obtained directly from the user tables. Therefore, change tracking is more limited in the historical questions it can answer compared to change data capture. .../...

关于c# - 如何将 MSSQL 同步到 Elasticsearch?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45708928/

相关文章:

c# - 访问数据库时应用程序崩溃

oledb - 使用 OleDb 在 Dapper 中传递查询参数

c# - 使用 HtmlAgilityPack 在 C# 中截屏

c# - 向 IElisonBuffer 添加语法突出显示

c# - 纯 C# Silverlight 视频编码库?

xml - SQL Server Xml 命名空间查询问题

c# - 最佳实践 : Adding a CLI to Existing Windows Service in . NET/Core

sql-server-2008 - 动态列名

sql - 在不丢失数据的情况下更改列类型

c# - 如何在返回单个结果的查询中从 DapperRow 获取值