setting up distributed environment

asergey serge@REDACTED
Wed Aug 30 18:44:12 CEST 2006


[quote]
> 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'.
[/quote]

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.

[quote]
> 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?
[/quote]

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: [a@REDACTED, b@REDACTED].  Suppose you want to dynamically add another replica of the 'customer' table in a node c@REDACTED containing a ram copy of the table.  In this case c@REDACTED node should be started with the extra_db_nodes option containing [a@REDACTED, b@REDACTED], and mnesia:add_table_copy/3 can be used to add a local replica of the table residing on nodes a@REDACTED and b@REDACTED  Note that as the result the disk-based database schema hosted on the [a@REDACTED, b@REDACTED] will be updated with the information that the table 'customer' is replicated to the c@REDACTED 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.

Regards,

Serge
_________________________________________________________
Post sent from http://www.trapexit.org



More information about the erlang-questions mailing list