0
start(_Type, _Args) ->
case application:get_env(ebid, join_schema) of
undefined ->
mnesia:create_schema([node()]),
mnesia:start(),
initialize_tables(),
mnesia:wait_for_tables([<<set of tables>>], timer:minutes(5));
{ok, Node} ->
pong = net_adm:ping(Node),
join_schema(Node),
mnesia:wait_for_tables([<<set of tables>>], timer:minutes(5))
end,
join_schema(Node) ->
case rpc:call('[email protected]', mnesia, change_config, [extra_db_nodes, [node()]]) of
{ok, _Result} ->
lists:foreach(fun(Tab) -> io:format("~p : ~p ~n",[Tab,timer:tc(mnesia,add_table_copy,[Tab, node(), ram_copies])]) end, mnesia:system_info(tables));
{error, Reason} ->
mnesia:stop(),
mnesia:del_table_copy(schema, node()),
error_logger:error_msg("Failed to join schema: ~p~n", [Reason]),
error(Reason)
end.
有没有一种方法可以调试为什么join_schema需要很长时间? 我们共有10个表格来代替“表格集合”,并且整体大小为< 400 MBMnesia RPC呼叫花费太长时间
只有在join_schema完成后,工作人员才会加入集群。
主节点工作正常,并有mnesia了。
尝试启动4个节点一次连接到主表 –