Replicating a distributed database
Tue Dec 8 00:09:47 CET 2009
It's interesting: I can't find an answer to this question anywhere. We
have a table that has fragments evenly distributed between nodes A and
B. We want to replicate these fragments to nodes C and D, which are on
separate machines. I believe that the Mnesia API provides no way of
accomplishing this without unseemly workarounds. Am I wrong?
If I start an Mnesia cluster on nodes A, B, C, and D, then as soon as
I create a fragmented table, Mnesia distributes the fragments evenly
between nodes A, B, C, and D, so there's a lot of work required with
add_table_copy to get the fragments in the right place. It appears
that mnesia ignores the disc_only_copies option when creating a
fragmented table, only paying attention to n_disc_only_copies in the
frag_properties option, so I believe there's no nice way to order
mnesia to put fragments on nodes A and B only.
I can start an Mnesia cluster on nodes A and B, create the fragmented
tables, then add nodes C and D and use add_table_copy. This appears to
give correct results but is kind of an ugly solution.
Am I missing some obvious way to accomplish this?
More information about the erlang-questions