数据存储在本地并与linux服务器上的数据库同步
我开发了一个Mac应用程序,它不断地与Linux服务器上的数据库进行交互。随着数据的增加,从服务器获取数据的时间成本变得越来越高。所以我计划在本地存储所需的数据,比如在 SQLite 上,并找到一些机制,通过它我可以将其与 Linux 服务器上的数据库同步。
谁能建议我一些方法来实现它?
谢谢,
米拉杰
I have developed a mac application, which is continuously interacting with database on linux server. As data is increasing it has become costlier affair in terms of time to fetch data from server. So I am planning to store required data locally, say on SQLite and find some mechanism through which I can synchronize it with database on linux server.
Can anyone suggest me some way to accomplish it?
Thanks,
Miraaj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您询问如何在一个源与另一个源之间同步数据?祝你好运。多年来,这一直是一个重要的研究领域,直到今天,它仍然主要是针对特定应用的。
像 SalesLogix 这样的软件将有一个带有如下表的中央数据库:
然后每个远程用户将有一个不同的站点代码。当基于last_update字段进行同步时,它将检查站点和密钥以确保两个不同的远程用户可能意外地为记录选择相同的唯一标识符而发生冲突。
如果您的东西不太复杂,您可以塑造数据访问层来跟踪本地数据库的事务,然后在下次连接时重播它们。这里的问题又是一致性。
如果我将 objectA.PropertyB 更改为“test1”,而您将其更改为“test3”?我们谁更正确?如何进行碰撞检测?
恐怕我还没有看到针对这个问题的跨每个数据域的单一开箱即用的解决方案。
If you are asking about synchronizing data between one source and another? Good luck. This has been a significant area of research for years, and to this day, it's mostly still application specific.
Software like SalesLogix would have a central database with a table like so:
and each remote user would then have a different site code. When synchronization would occur based on the last_update fields, it would check the site and key to ensure against conflicts where two different remote users might accidently choose the same unique identifier for a record.
If you have something less complex, you could sculpt your data access layer to track transactions to the local database, and then replay them the next time you are connected. The problem here again is consistency.
If I change objectA.PropertyB to "test1", and you change it to "test3?" which one of us is more correct? How do you do collision detection?
I'm afraid I've yet to see of a single out-of-the-box solution to this problem that works across every data domain.
也许你可以制定一个缓存策略。例如,看看 memcached。在不知道你的工作量的情况下很难说更多。
Perhaps you can formulate a caching strategy instead. Look at for example, memcached. Its difficult to say more without knowing your work load.