【发布时间】:2017-10-01 12:17:37
【问题描述】:
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('rtb@ip-10-0-43-240', 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 个表来代替“表集”,而且总体大小为
只有在 join_schema 完成后,worker 才会加入集群。
主节点工作正常,mnesia 启动。
【问题讨论】:
-
尝试同时启动 4 个节点连接到主表
标签: database erlang distributed-computing mnesia