Search code examples
erlangmnesiaerlang-supervisor

How should I supervise an Erlang mnesia-based web application?


In a web application, what is the best way to supervise Erlang mnesia when more than one user has access to the mnesia tables?

E.g., say I have the following modules:

my_data_sup.erl -- supervisor

my_insert_info.erl -- insertion form

my_get_info.erl -- retrieve form

my_data_store.erl -- mnesia query functions

I don't understand how to restart mnesia if it should abort for any reason.

Many thanks,

LRP


Solution

  • mnesia is an application which already include its own supervision tree. On a single node you have nothing more to do than start the application at the right place, the application will "try" to keep alive until you stop it explicitly. On multiple nodes, you will have to define the schema of your database (where you have ram copy, disk copy)... but still not bother about mnesia supervision.