setting up distributed environment

asergey <>
Wed Aug 30 18:44:12 CEST 2006

> It's a bit unclear what do you mean by a 'master' node. Mnesia
> doesn't have a notion of a master or slave. Any node that has a

I mean 'mnesia:set_master_nodes/1'.

In my understanding mnesia:set_master_nodes/1 plays role in the selection of the source of replicated table(s) when you have an abnormal condition (i.e. partitioned network, system startup, etc), when you want to override default behaviour of selecting table sources based on 'extra_db_nodes'.  Yet in "normal" operating conditions 'extra_db_nodes' helps mnesia determine the source nodes of replicated tables containing disk copies.

> In your application you could have two nodes running on two separate
> hosts with tables created using 'disc_copies' option. The mnesia
> application would need to be started with the 'extra_db_nodes' option

Will 'mnesia:add_table_copy/3' make the deal? Should I run each node
with 'extra_db_nodes' option all the time?

mnesia:add_table_copy/3 should be used in cases when you need to add another replica to a node running mnesia.  An example could be that you have two primary nodes 'a' and 'b' with disk_copies of a table 'customer' each started with 'extra_db_nodes' option containing: [, ].  Suppose you want to dynamically add another replica of the 'customer' table in a node  containing a ram copy of the table.  In this case  node should be started with the extra_db_nodes option containing [, ], and mnesia:add_table_copy/3 can be used to add a local replica of the table residing on nodes  and   Note that as the result the disk-based database schema hosted on the [, ] will be updated with the information that the table 'customer' is replicated to the  node as a ram copy.

So, extra_db_nodes option tells the current node:
1. To establish connection at startup with the nodes listed in extra_db_nodes option.
2. Where to find nodes containing database schema.

I am not sure though that this reply addressed your original question.


Post sent from

More information about the erlang-questions mailing list