Database / Mnesia basics Interview questions
What is a Mnesia node?
In Mnesia's context, a "node" is simply an Erlang node (a running BEAM instance with a name) that participates in a Mnesia database, either holding copies of tables directly or just being schema-aware of the cluster. A single logical Mnesia database can span several such nodes, all coordinating table replication and transactions between them.
mnesia:create_schema([nodea@host1, nodeb@host2]), mnesia:create_table(person, [{disc_copies, [nodea@host1, nodeb@host2]}, {attributes, [id, name, age]}]).
Which nodes hold a copy of a given table is decided per-table via the storage type options
(ram_copies, disc_copies, disc_only_copies), and a node doesn't need to
hold every table in the schema — you can have some nodes replicate only a subset of tables relevant to
their role, while still being part of the same overall Mnesia cluster.
More Related questions...