[erlang-questions] Mnesia Replication with local content
Prakash Parmar
prakash.parmar@REDACTED
Wed May 16 14:37:21 CEST 2018
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180516/595f211d/attachment.htm>
More information about the erlang-questions
mailing list