Distributing a Mnesia schema/Discless nodes
Disc-less nodes are useful but require some extra steps.
First of all, we have to have a working Mnesia database with a disc_copy of a schema.
erl -sname alpha > mnesia:create_schema([alpha@localhost]). > mnesia:start(). > % now create some tables
Next we need to tell mnesia that the disc-less node will exist in the future. To do that we use add_table_copy on the schema.
> % still on alpha > mnesia:add_table_copy(schema, kappa@localhost, ram_copies).
If kappa were up and running and received a disk copy of the schema we would be done right now. However, disc-less nodes are a little special and require this extra step. Let's go ahead and start up our kappa node. Obviously we need to leave the alpha node running.
erl -sname kappa > mnesia:start(). > mnesia:info().
Notice that mnesia here is completely unaware that it is supposed to be a disc-less node of the system running on alpha. Here's the money line:
> % still on kappa > mnesia:change_config(extra_db_nodes, [alpha@localhost]). > mnesia:info().
And you should have a working disc-less node running on kappa. Enjoy.
Alternatively you can start up kappa like this:
erl -sname kappa -mnesia extra_db_nodes "[alpha@localhost]"
For more information see http://erlang.org/doc/doc-5.5/lib/mnesia-4.3.1/doc/html/Mnesia_chap5.html#5.5 .