I have a datalogging application (c#/.net) that logs data to a SQLite database. This database is written to constantly while the application is running. It is also possible for the database to be archived and a new database created once the size of the SQLite database reaches a predefined size.
我有一个数据记录应用程序(c#/ .net),它将数据记录到SQLite数据库。应用程序运行时,将不断编写此数据库。一旦SQLite数据库的大小达到预定义大小,也可以存档数据库并创建新数据库。
I'm writing a web application for reporting on the data. My web setup is c#/.Net with a SQL Server. Clients will be able to see their own data gathered online from their instance of my application.
我正在编写一个用于报告数据的Web应用程序。我的网站设置是带有SQL Server的c#/ .Net。客户将能够从他们的应用程序实例中看到他们自己在线收集的数据。
For test purposes, to upload the data to test with I've written a rough and dirty application which basically reads from the SQLite DB and then injects the data into the SQL Server using SQL - I run the application once to populate the SQL Server DB online.
出于测试目的,上传数据进行测试我编写了一个粗糙而脏的应用程序,它基本上从SQLite DB中读取,然后使用SQL将数据注入SQL Server - 我运行应用程序一次以填充SQL Server数据库线上。
My application is written in c# and is modular so I could add a process that periodically checks the SQLite DB then transfer new data in batches to my SQL Server.
我的应用程序是用c#编写的,并且是模块化的,所以我可以添加一个定期检查SQLite DB然后将新数据批量传输到我的SQL Server的进程。
My question is, if I wanted to continually synchronise the client side SQLLite database (s) with my server as the application is datalogging what would the best way of going about this be?
我的问题是,如果我想继续将客户端SQLLite数据库与我的服务器同步,因为应用程序正在进行数据记录,最好的解决方法是什么?
Is there any technology/strategy I should be looking into employing here? Any recommended techniques?
我应该在这里采用任何技术/策略吗?任何推荐的技术?
4 个解决方案
#1
You could take a look at the Sync Framework. How complex is the schema that you're looking to sync up & is it only one-way or does data need to come back down?
您可以查看Sync Framework。您希望同步的架构有多复杂?它只是单向还是数据需要重新下载?
As a simply solution I'd look at exporting data in some delimited format and then using bcp/BULK INSERT to pull it in to your central server.
作为一个简单的解决方案,我将着眼于以某种分隔格式导出数据,然后使用bcp / BULK INSERT将其拉入*服务器。
#2
Several options come to mind. You can add a timestamp to each table that you want to copy from and then select rows written after the last update. This is fast and will work if you archive the database and start with an empty one.
我想到了几种选择。您可以为要从中复制的每个表添加时间戳,然后选择上次更新后写入的行。这很快,如果您存档数据库并从空数据库开始,它将起作用。
You can also journal your updates for each table into an XML string that describes the changes and store that into a new table that is treated as a queue.
您还可以将每个表的更新记录到XML字符串中,该字符串描述更改并将其存储到被视为队列的新表中。
#3
Might want to investigate concept of Log Shipping
可能想调查Log Shipping的概念
#4
There exists a open source project on Github also available on Nuget. It is called SyncWinR, it implements the Sync Framework Toolkit to enabled synchronization with WinRT or Windows Phone 8 and SQLite. You can access the project from https://github.com/Mimetis/SyncWinRT.
在Nuget上也有一个Github上的开源项目。它被称为SyncWinR,它实现Sync Framework Toolkit以启用与WinRT或Windows Phone 8和SQLite的同步。您可以从https://github.com/Mimetis/SyncWinRT访问该项目。
#1
You could take a look at the Sync Framework. How complex is the schema that you're looking to sync up & is it only one-way or does data need to come back down?
您可以查看Sync Framework。您希望同步的架构有多复杂?它只是单向还是数据需要重新下载?
As a simply solution I'd look at exporting data in some delimited format and then using bcp/BULK INSERT to pull it in to your central server.
作为一个简单的解决方案,我将着眼于以某种分隔格式导出数据,然后使用bcp / BULK INSERT将其拉入*服务器。
#2
Several options come to mind. You can add a timestamp to each table that you want to copy from and then select rows written after the last update. This is fast and will work if you archive the database and start with an empty one.
我想到了几种选择。您可以为要从中复制的每个表添加时间戳,然后选择上次更新后写入的行。这很快,如果您存档数据库并从空数据库开始,它将起作用。
You can also journal your updates for each table into an XML string that describes the changes and store that into a new table that is treated as a queue.
您还可以将每个表的更新记录到XML字符串中,该字符串描述更改并将其存储到被视为队列的新表中。
#3
Might want to investigate concept of Log Shipping
可能想调查Log Shipping的概念
#4
There exists a open source project on Github also available on Nuget. It is called SyncWinR, it implements the Sync Framework Toolkit to enabled synchronization with WinRT or Windows Phone 8 and SQLite. You can access the project from https://github.com/Mimetis/SyncWinRT.
在Nuget上也有一个Github上的开源项目。它被称为SyncWinR,它实现Sync Framework Toolkit以启用与WinRT或Windows Phone 8和SQLite的同步。您可以从https://github.com/Mimetis/SyncWinRT访问该项目。