[erlang-questions] Creating backup of ram based Mnesia on Disc

Arun Muralidharan arun11299@REDACTED
Mon May 21 09:31:02 CEST 2012


Hi,

Currently I am creating the table in following steps:

mnesia:start(),
mnesia:create_schema([node()]),

mnesia:create_table(guiding_data,
                         [
                           {attributes, record_info(fields, guiding_data)},
                           {ram_copies,[node()]}
                         ]),

Now, all the data I load (huge amounts) will reside in RAM as expected.
But what I would like here is to have a backup of all the data residing
in RAM to be also present on disk, so that in case i stop and start Mnesia
again,
it should load the data from the disk to memory, instead of loading the data
again into memory explicitly by me.

What I can do here is :
1) mnesia:change_table_copy_type(schema,node(),disc_copies),
   Now, this would create a disc copy, but all my queries to mnesia would
   access disk. right ? This is what i observed and didnt want.

2) mnesia:add_table_copy(table, node(), disc_copies)
   This didnt have any effect. Didnt create any disc copy.

So, what would be the correct way to
1) Load data to RAM as well as backup in disc.
2) Queries/ Multiple loads should access/update RAM/disc resp.
3) On mnesia restart data should be loaded from Disc automatically.

Is there any Mnesia configuration for above ?

Thanks
Arun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120521/67a4fb7b/attachment.htm>


More information about the erlang-questions mailing list