Reputation: 9360
I have mnesia installed on a node a
.
I have already defined a schema and a table.
Now i do not know how can i add another node b
so that mnesia now can run distributed.
By distributed i mean :
insert
of a record in mnesia from node a
b
What i have tried:
a
and start mnesiacreate_schema
and create_table
on node a
dirty_insert
in node a
Then
Start node b
connect node b
to node a
from node a
issue : mnesia:change_config(extra_db_nodes,[nodes()]).
// doesnt matter if i issue this command from node a
or node b
i get the following error :
(a@DESKTOP-GOMS8S8)7> mnesia:change_config(extra_db_nodes,[nodes()]). =ERROR REPORT==== 3-Jul-2021::13:33:16.147000 === Error in process <0.138.0> on node 'a@DESKTOP-GOMS8S8' with exit value: {function_clause, [{gen_server,do_abcast, [[['b@DESKTOP-GOMS8S8']], mnesia_controller, {'$gen_cast',{merging_schema,'a@DESKTOP-GOMS8S8'}}], [{file,"gen_server.erl"},{line,263}]}, {mnesia_controller,connect_nodes2,3, [{file,"mnesia_controller.erl"},{line,486}]}]}
** exception exit: function_clause in function gen_server:do_abcast/3 called as gen_server:do_abcast([['b@DESKTOP-GOMS8S8']], mnesia_controller, {'$gen_cast', {merging_schema,'a@DESKTOP-GOMS8S8'}})
in call from mnesia_controller:connect_nodes2/3 (mnesia_controller.erl, line 486)
I just want any operation i do upon mnesia of a given node to be reflected on the others
Upvotes: 2
Views: 176
Reputation: 41528
nodes()
already returns a list, so there is no need to wrap the return value in a list. Try this:
mnesia:change_config(extra_db_nodes,nodes()).
Upvotes: 2