Mysql复制问题
目前我有这种情况,
- 多个桌面客户端在其 Windows 计算机上安装了 mysql db。
- 需要同步到网络上托管的一台服务器以用于报告目的。
- 只需要进行一种方式同步(客户端到网络)。
- 客户端 IP 总是在变化,因为他们使用标准的 adsl,没有固定的 IP。
- 每个客户端数据库将同步到服务器上的一个独立数据库(托管在网络上)。
- 这个同步可以在调度程序上运行吗?自从有一次以来,每 3 小时一次。
我正在考虑使用 mysql 复制,但我有一些关于如何设置它的问题?我应该将其设置为主从吗?还是大师对大师? 我假设客户端将是主服务器,服务器将是从服务器,因为服务器仅用于报告目的,但检查大量mysql复制,看起来复制是从从服务器开始的? (我看到从服务器设置上有类似 master-host=ip 的设置)这违背了目的,因为服务器不确定客户端 IP...
currently I have this scenario,
- multiple desktop client with mysql db installed on their windows machine.
- need to sync over to one server hosted on web for reporting purpose.
- just need to do one way sync ( client to web ).
- client ip is always changing since they use standard adsl with no fix ip.
- each client db will sync to one stand alone db on server ( hosted on web).
- can this syncing run on scheduler ? like every 3 hour since once.
I m thinking of using mysql replication, but I have some of the question on how to setup this? shall I setup this as master to slave ? or master to master ?
I assume that the client will be master and the server will be slave , since the server is only use for reporting purpose, but checking on lots of mysql replication , it seem like the replication is initial from slave ? ( i see there are setting like master-host=ip on slave server setting ) this defeat the purpose since the server not sure about the client ip...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
考虑到您提到的某些项目(从属/主控/等),也许这完全不合时宜,但在我正在开发的应用程序中,我有一个类似的架构,其中单个源为未知/动态 IP 的多个客户端提供服务。我的解决方案是包含另一个字段,其中包含该行上次更新时间的时间戳,然后进行同步,客户端在本地数据库中搜索该列中的 MAX,并将其作为变量发送到 Web 服务,然后返回所有行更新的时间戳。然后,客户端解析响应数据,并替换到本地数据库中,以便覆盖旧数据。
我没有解决的一个细节(因为我的场景不需要它)是如何传达一个项目已被删除...也许当删除一行时,会在另一个表中使用行主 ID 和时间戳记创建一个条目删除,然后 Web 服务可以包含具有该表的更新时间戳的所有行的数组。
Perhaps this is totally off the mark given some of the items you're mentioning (slave/master/etc), but in an app I am developing, I have a similar architecture with the single source feeding multiple clients of unknown/dynamic IP. My solution was to include another field with a timestamp of when that row was last updated, then to sync, the clients search their local db for the MAX in that column, and send that as a variable to a webservice that then returns all rows with a more recent timestamp. The client then parses through the response data, and REPLACES INTO their local db, so that old data is over-written.
One detail I did not address (as my scenario does not need it) is how to communicate that an item has been deleted...perhaps when a row is deleted, an entry is made in another table with the row primary id, and timestamp of deletion, and then the web service could include an array of all rows with a more recent timestamp of that table.