开发者

How to replicate data across a node.js cluster?

I want to synchronize changes to a certain Javascript object such that several node.js instances have a consistent representation of that object.

Each instance can freely change its local copy of the object (add properties, remove properties, change values) and these changes must be re开发者_如何学Cplicated to the other instances. Instances are all connected by socket communication.

What are some methods I can use for data replication?

(Don't worry about detecting changes to the synced object. It is placed behind a proxy with getters/setters that can capture and handle any changes).


I would say that replication is very dependent on a single node architecture. However probably one of the best solution to deal with data replication (if your node data can be stored/serialized elsewhere) is to use tool/database which have this functionality built-in (for example Redis) so that you won't spend time creating something that others have already proven and tested (unless you want some hard-code action).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜