I assume that you probably meant the replicated table. Suppose you have a mnesia table on node: nodea@127.0.0.1 with -setcookie mycookie , whether it replicates to another node or not, if I want to access records from another terminal, then I have to use erlang in this other Also By creating a node, connecting this node to our node using a table (you will make sure that they all have the same cookie), you call the method on the remote node.
Suppose you want to use the add_record method in the mydatabase.erl module on node nodea@127.0.0.1 , which has the mnesia table, I open the linux terminal and I enter the following:
$ erl -name remote@127.0.0.1 -setcookie mycookie
Eshell V5.8.4 (abort with ^ G)
1> N = ' nodea@127.0.0.1 '.
' nodea@127.0.0.1 '
2> net_adm: ping (N).
pong
3> rpc: call (N, mydatabase, add_record, [RECORD]).
{atomic, ok}
4>
with this module ( rpc ), you can call any method on the remote node if two nodes are connected using the same cookie. start by calling this method on the remote node device:
rpc: call (' nodea@127.0.0.1 ', mnesia, info, []).
It should display everything on your remote terminal. I guess you might read this lecture first:
Erlang Distributed Programming , and then you can see how mnesia replication tables are managed. Go through this entire tutorial in this domain.
source share