How to make a term synced on all nodes?

Wiger Ulf ulf.wiger@REDACTED
Sun Apr 6 20:24:36 CEST 2003

You could certainly use mnesia for that. Read the mnesia User's Guide
to get started. Mnesia allows you to create a table that is replicated on 
as many nodes as you want. You can make each table RAM-only,
or persistent, depending on your needs.

If you really want to use ets, and you want a very simple solution,

rpc:multicall(ets, insert, [TableName, Object])

is the easiest way to replicate. Note that it does not cover all
the error cases, so you'd have to complement it with checking 
for errors, and synchronizing the tables at node restarts.

Mnesia is definitely the safest way to go.


----- Original Message ----- 
From: "HP Wei" <hp@REDACTED>
To: <erlang-questions@REDACTED>
Sent: den 6 april 2003 19:01
Subject: How to make a term synced on all nodes?

> Let's say I have an ets table (or some other term (object) in erlang)
> I want to keep a copy of it on all active nodes.
> Each of these nodes will update some part of this table.
> After an update, I want all copies on different nodes to be synced.
> (The purpose of keeping a copy on all nodes is to keep the info
>  in this table alive all the time even when some nodes go down.)
> I figure that this is what people in the Erlang world are doing 
> with ease all the time.  
> However, as a beginner, I want to get some references (or example,
> fragment of codes) as to how to this.
> (1) how to make this table globally visible, (a name refering to 
>     one copy of this table)
> (2) how to keep it synced.
> Thanks,
> HP

More information about the erlang-questions mailing list