[erlang-questions] Mnesia Replication with local content

Dan Gudmundsson <>
Wed May 16 15:38:06 CEST 2018


If you do mnesia:info() on , it will list the table
'log_count' there as well.
Each node have a "local" 'log_count' table that is not visible on the other
nodes.



On Wed, May 16, 2018 at 2:37 PM Prakash Parmar <>
wrote:

> Hello All,
>
> According to my project requirements, I have Two mnesia nodes namely
> '' and ''. I want to create a Mnesia table with
> local content and same table name on both nodes.
>
> Here are the Steps I'm following :
>
> In One Terminal  -  $ erl -sname node1 -setcookie abc
>
> On another Terminal - $ erl -sname node2 -setcookie abc
>
>
> =====================================================================================
>
> ()1> net_adm:ping('').
> pong
>
> ()2> nodes().
> []
>
> ()3> mnesia:create_schema(['', '
> ']).
> ok
>
> ()4> rpc:multicall(['', ''],
> mnesia, start,[]).
> {[ok,ok],[]}
>
> ()5> mnesia:create_table( log_count,[{attributes, [counter,
> value]},{local_content, true},{disc_copies, ['
> ','']}]).
> {atomic,ok}
>
> ()6>
> mnesia:info().
> ---> Processes holding locks <---
> ---> Processes waiting for locks <---
> ---> Participant transactions <---
> ---> Coordinator transactions <---
> ---> Uncertain transactions <---
> ---> Active tables <---
> log_count      : with 0        records occupying 298      words of mem
> schema         : with 2        records occupying 530      words of mem
> ===> System info in version "4.14.3", debug level = none <===
> opt_disc. Directory "/home/user/svn/mvpn-1.1/" is
> used.
> use fallback at restart = false
> running db nodes   = []
> stopped db nodes   = []
> master node tables = []
> remote             = []
> ram_copies         = []
> disc_copies        = [log_count,schema]
> disc_only_copies   = []
> [{,disc_copies}] = [log_count]
> [{,disc_copies},{,disc_copies}] = [schema]
> 4 transactions committed, 2 aborted, 0 restarted, 5 logged to disc
> 0 held locks, 0 in queue; 0 local transactions, 0 remote
> 0 transactions waits for other nodes: []
> ok
>
> =====================================================================================
>
> Can anyone help me out why Table is not getting created on a 2ndnode?
>
> When I removed option {local_content, true} that table getting created on
> a 2nd node.
>
> Is there another way to achive this?
>
> /Prakash Parmar
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180516/435e9894/attachment.html>


More information about the erlang-questions mailing list