September 2013
Intermediate to advanced
548 pages
12h 25m
English
Before we can do anything, we have to create an Mnesia database. You need to do this only once.
| | $ erl |
| | 1> mnesia:create_schema([node()]). |
| | ok |
| | 2> init:stop(). |
| | ok |
| | $ ls |
| | Mnesia.nonode@nohost |
mnesia:create_schema(NodeList) initiates a new Mnesia
database on all the nodes in NodeList (which must be a
list of valid Erlang nodes). In our case, we gave the node list
as [node()], that is, the current node. Mnesia is
initialized and creates a directory structure called
Mnesia.nonode@nohost to store the
database. Then we exit from the Erlang shell and issue the
operating system’s ls command to
verify this.
If we repeat the exercise with a distributed node called
joe, we get the following:
| | $ erl -name joe ... |
Read now
Unlock full access