[erlang-questions] Adding new nodes to a Msenia group?

Tom Samplonius tom@REDACTED
Mon Apr 30 08:17:28 CEST 2007


----- "Chandru" <chandrashekhar.mullaparthi@REDACTED> wrote:
> On 27/04/07, Tom Samplonius <tom@REDACTED> wrote:
> >
> >   I've trying to understand Mnesia to see if it is suitable for my
> project.  It seems that you must define the nodes that contain on-disk
> storage when the schema is created.  And that must be done with Mnesia
> shutdown.  Is is possible to create a schema with on-disk storage when
> Mnesia is active?  Is it possible to create new Mnesia nodes with an
> empty node list (local node), and then use add_table_copy/3 to extend
> the database onto the new node?
> >
> 
> You can't create a disk based mnesia schema with no nodes in it. When
> you start up mnesia without creating a schema, you get a ram based
> mnesia schema which has just that node. You can then convert that
> schema to a disk based one whenver you want to using
> mnesia:change_table_copy_type/3.
> 
> Once you have one node with an mnesia schema, you can add new nodes
> to
> the schema using the function mnesia:add_table_copy/3. Look in the
> user guide - I'm sure you will find it in there.
> 
> Whenever you add a new node to the schema, you first have to create
> the schema as a ram_copies table on the new node and then change it
> to
> a disk based one.

  I still can't see how to do this.  I setup a single Mnesia node, with on-disk schema, and then created a single table.  Then I setup a second node (but did not create an on-disk schema with create_schema/1), and attempted to duplicate the "schema" table to the second node.  It seems to work:

(a@REDACTED)14> mnesia:add_table_copy(schema, b@REDACTED, ram_copies).
{atomic,ok}


and b@REDACTED shows as a stopped node, but b@REDACTED is never updated or connected to (nodex() is empty).  I can use connect_to/1 to force a node connection, but Mnesia still shows b@REDACTED as down.

> Chandru

Tom



More information about the erlang-questions mailing list