.NET应用Mysql远程数据库同步

发布于 2025-01-08 06:20:37 字数 486 浏览 1 评论 0原文

我们一直在开发一个 .NET 桌面应用程序,它将与一个网站集成,两者都使用 MySQL。每个软件的客户都会有一个网站。我们需要将客户的数据库与我们服务器中运行的相应数据库同步。我们将为每个客户在我们的服务器中运行一个数据库。这些信息将显示在客户的网站上。

同步必须在短时间内完成。我们不想拥有一个过时的网站。

我们考虑编写代码来实现同步。实现可靠的同步似乎是一项艰巨的任务。客户的数据库会很大,短时间内发送似乎不太可行。

然后我们找到了数据库复制。伟大的!同步数据库的平滑方法。我们不需要对此解决方案进行硬编码!我们客户的数据库将是主数据库,而我们服务器的数据库将是从数据库。我们需要在同一个 MySQL 服务器上有多个从服务器。 MySQL 不允许。

我们可以运行多个 MySQL 实例,每个客户一个实例。但我们需要为每个实例打开一个端口,这听起来不安全。

最后,我们考虑使用防火墙打开端口并拒绝非客户访问。

你会如何解决这个问题?我们想听听您的意见。 谢谢。

We've been developing a .NET desktop application that will be integrated with a website, both using MySQL. Each software's customer will have a website. We need to sync the customer's database with a correspondent database running in our server. We'll have one database running in our server per customer. These information will be displayed in customer's website.

The sync must be made in short periods. We don't want to have an outdated website.

We've thought to write code to make this sync. It seems to be a hard task to achieve a solid sync. Customer's database will be large, it seems to be impracticable to send in short periods of time.

Then we've found database replication. Great! A smooth way to sync the database. We don't need to hard code this solution! Our customers' database would be the master and our server's ones would be the slaves. We need multiple slaves in the same MySQL server. MySQL doesn't allow it.

We could run multiple MySQL instances, a instance per customer. But we need to open a port per instance, and it sounds insecure.

Finally, we thought to open the ports and deny non-customer access with a firewall.

How would you solve this problem? We would like to listen your opinion.
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的呼吸 2025-01-15 06:20:37

我有一个类似的程序,我使用的是 CQL CE 数据库/MS SQL。我所做的是在主服务器上,我需要将更新发送到客户端数据库的每个表都放置一个更新日期字段。客户端数据库将有一个表,其中保存数据库上次更新的日期。因此,当服务器上发生某些更改时,更新日期将被设置为当前日期,然后客户端程序将根据 Web 服务检查上次更新日期,以查看是否需要进行任何更新。

I have a similar program, I am using a CQL CE database/MS SQL. What I do is on the master server, each of the tables that I need to send updates to the client databases I put an update date field. The client databases will have a table that holds a date that thier database has been updated last. So when something changes on the server the update date gets put to the current date, then the client program will check the last update date against a web service to see if it needs to do any updates.

演出会有结束 2025-01-15 06:20:37

我过去曾思考过这个问题。

我认为最好的选择是通过直接从客户端数据库提供网络上的数据来避免重复太多的数据存储。

我能想到的在不打开端口等的情况下执行此操作的最佳方法是使用长轮询或 html 5 套接字仅提供请求的数据。只要您的用户不希望经常查看所有数据,这将提供一个公平的解决方案。

I have thought about this a little in the past.

I think that the best option would be one that avoided duplicating too many data stores by supplying the data on the web directly from the client database.

The best way I can think of doing this without opening ports etc is to use long polling or html 5 sockets to provide only requested data. This would provide a fair solution as long as your users do not expect to view all the data often.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文