[英]Decentralized synchronized secure data storage
Introduction 介绍
Hi, I am going to ask a question which seems utopic for me, but I need to know if there is a way to achieve what I need. 嗨,我要问一个对我来说似乎很普遍的问题,但我需要知道是否有一种方法可以实现我所需要的。 And if not, I need to know why not . 如果不是,我需要知道为什么不这样做 。
The idea 这个主意
Suppose I have a database structure, in MySql . 假设我在MySql中有一个数据库结构。
I want to create some solution to allow anyone (no matter who, no matter where) to have a synchronized copy (updated clone) of this database (with its content) 我想创建一些解决方案,以允许任何人(无论谁,无论在哪里)都具有该数据库(及其内容)的同步副本(更新的克隆) 。
Well, and it is not going to be just one synchronized copy, it could (and should) be a multiple replication (supposing the basic, this means, for example, ten copies all over the world) 好吧,它并不仅仅是一个同步副本,它可以(并且应该)是多重复制(假设基本复制,这意味着,例如,全世界有十个副本)
And, the most important thing: It must be secure . 而且,最重要的是:它必须安全 。 By secure I mean only real-accepted transactions will be synchronized with all the others (no matter how many) database copies/clones. 所谓安全,是指只有真正接受的事务才会与所有其他(无论有多少个)数据库副本/克隆进行同步。
Note : Since it would be quite difficult to make the synchronization in real-time, I will design everything to make this feature dispensable. 注意 :由于实时同步非常困难 ,因此,我将设计一切以使此功能不再需要。 So it is not required. 因此它不是必需的。
My auto-suggestion 我的自动建议
This is how I am thinking to manage it: 这就是我正在考虑的管理方式:
Time identifiers and Updates checking : Every action (insert, update, delete...) will be stored as the action instruction itself, associated to the time identifier. 时间标识符和更新检查 :每个动作(插入,更新,删除...)将作为与时间标识符关联的动作指令本身存储。 [I think better than a DATETIME field, it'll be an INT one, with the number of miliseconds passed from 1st january 2013 on, for example] . [例如,我认为比DATETIME字段更好,它将是INT,例如,从2013年1月1日起经过的毫秒数] 。 So each copy is going to ask to the "neighbour copy" for new actions done since last update, and execute them after checking they are allowed. 因此,每个副本将向“邻居副本”询问自上次更新以来执行的新操作,并在检查允许后执行它们。
Problem 1 : the "neighbour copy" could be outdated too. 问题1 : “邻居副本”也可能过时。
Solution 1 : do not ask just one neighbour, create a random list with some of the copies/clones and ask them for news (I could avoid the list and ask ALL the clones for updates, but this will be inefficient if clones number ascends too much) . 解决方案1 :不要问一个邻居,创建一个包含一些副本/克隆的随机列表 ,然后向他们询问消息(我可以避免使用该列表,并向所有克隆询问更新,但是如果克隆数量也上升,这将是无效的很多) 。
Problem 2 : Real-time global synchronization is not active. 问题2 :实时全局同步未激活。 What if... 如果...
Someone at CLONE_ENTERPRISING inserts a row into TABLE.
... this row goes to every clone ...
Someone at CLONE_FIXEMALL deletes this row.
... and at the same time, somewhere in an outdated clone ...
Someone at CLONE_DROPOUT edits this row (now inexistent at the other clones)
Solution 2 : easy stuff, force a GLOBAL synchronization before doing any new " depending-on-third-data action" (edit, for example) . 解决方案2 :简单的操作,在执行任何新的“ 取决于数据的操作” (例如,编辑)之前,强制执行GLOBAL同步。 This global synch. 这种全球同步。 will be unnecessary when making an INSERT, for instance. 例如,在进行INSERT时将不必要。
Note : Well, someone could have some fun, and make the same insert in two clones... since they're not getting updated in real-time, this row will exist twice. 注意 :嗯,某人可能会很有趣,并在两个克隆中进行相同的插入...由于它们没有实时更新,因此该行将存在两次。 But, it's the same as when we have one single database, in some needed cases we check if there is an existing same-row before doing the final action. 但是,这与我们只有一个数据库的情况相同,在某些需要的情况下,我们在执行最终操作之前会检查是否存在相同的行。 Not a problem. 没问题
Problem 3 : It is possible to edit the code and do not filter actions, so someone could spread instructions to delete everything, or just make some trolling activity. 问题3 :可以编辑代码而不过滤动作,因此有人可以散布指令以删除所有内容,或仅进行一些拖钓活动。 This is not a problem, since good clones will always be somewhere. 这不是问题,因为好的克隆总是存在于某个地方。 Those who got bad won't interest anymore. 那些变坏的人将不再感兴趣。
I really appreciate if you read. 如果您阅读,我将不胜感激。 I know this is not the perfect solution, it has possibly hundred of holes, but it is my basic start. 我知道这不是一个完美的解决方案,它可能有数百个漏洞,但这是我的基本出发点。 I will now appreciate anything you can teach me now. 现在,我将感激您现在可以教我的一切。 Thanks a lot. 非常感谢。
PS.: It could be that all this I am trying already exists and has its own name. PS .:可能是我正在尝试的所有操作都已经存在并具有自己的名称。 Sorry for asking then (I'd anyway thank this name, if it exists) 不好意思问(如果有的话,我还是要感谢这个名字)
I would suggest a look at Sync Framework from Microsoft. 我建议您看一下Microsoft的Sync Framework 。 It might be better suited to SQL Server but it should work with MySQL too. 它可能更适合SQL Server,但它也应与MySQL一起使用。 The problem you are tackling is quite a complex one. 您要解决的问题是一个非常复杂的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.