[erlang-questions] Mnesia Replication with local content

Dan Gudmundsson dangud@REDACTED
Wed May 16 15:38:06 CEST 2018


If you do mnesia:info() on node2@REDACTED, 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 <prakash.parmar@REDACTED>
wrote:

> Hello All,
>
> According to my project requirements, I have Two mnesia nodes namely
> 'node1@REDACTED' and 'node2@REDACTED'. 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
>
>
> =====================================================================================
>
> (node1@REDACTED)1> net_adm:ping('node2@REDACTED').
> pong
>
> (node1@REDACTED)2> nodes().
> [node2@REDACTED]
>
> (node1@REDACTED)3> mnesia:create_schema(['node1@REDACTED', 'node2@REDACTED
> ']).
> ok
>
> (node1@REDACTED)4> rpc:multicall(['node1@REDACTED', 'node2@REDACTED'],
> mnesia, start,[]).
> {[ok,ok],[]}
>
> (node1@REDACTED)5> mnesia:create_table( log_count,[{attributes, [counter,
> value]},{local_content, true},{disc_copies, ['node1@REDACTED
> ','node2@REDACTED']}]).
> {atomic,ok}
>
> (node1@REDACTED)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/Mnesia.node1@REDACTED" is
> used.
> use fallback at restart = false
> running db nodes   = [node2@REDACTED,node1@REDACTED]
> stopped db nodes   = []
> master node tables = []
> remote             = []
> ram_copies         = []
> disc_copies        = [log_count,schema]
> disc_only_copies   = []
> [{node1@REDACTED,disc_copies}] = [log_count]
> [{node1@REDACTED,disc_copies},{node2@REDACTED,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
> erlang-questions@REDACTED
> 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.htm>


More information about the erlang-questions mailing list