[erlang-questions] Re: Replicating a distributed database

Adam Duston adam@REDACTED
Fri Dec 11 21:19:35 CET 2009


Håkan, Thank you for your message.

> will create a table with 100 fragments where each fragment will
> have 2 replicas (one on node a and the other on node b) with

We need "master" fragments on nodes a and b, with replicas on c and d.
I believe mnesia:add_table_copy/3 is the only way to go for this
scenario.

You see, we need to do this because we're using disc_only_copies and
we're splitting the fragments across two disks. Plus there are more
than 1,024 fragments, and we don't want to recompile the OS kernel to
allow for a greater number of open file descriptors per process. Nodes
a and b run on machine 1 whereas nodes c and d run on machine 2, hence
the replication.

Thank you again,
Adam


2009/12/11 Håkan Mattsson <hakan@REDACTED>:
> On Fri, Dec 11, 2009 at 6:05 AM, adam <aduston@REDACTED> wrote:
>> Ah, okay, got it. I somehow missed the node_pool option. I can do
>> that, then use add_table_copy with each fragment individually to
>> replicate them.
>
> It is simpler than that. You do not need to use mnesia:add_table_copy/3
> if you want to create a fragmented table where all fragments are
> replicated to 2 given nodes. This command
>
>  mnesia:create_table(f, [{frag_properties, [{n_fragments, 100},
>  {n_disc_copies, 2}, {node_pool, [a@REDACTED, b@REDACTED]}]}]).
>
> will create a table with 100 fragments where each fragment will
> have 2 replicas (one on node a and the other on node b) with
> storage type disc_copies.
>
> /Håkan
>



-- 
Founder, langolab.com
adam@REDACTED
312-375-9879
Skype: aduston


More information about the erlang-questions mailing list