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個節點一次連接到主表 –