【问题标题】:Mnesia RPC Call Taking Too longMnesia RPC 调用耗时过长
【发布时间】: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


【解决方案1】:

终于可以解决问题了。问题是我们根据负载在 EC2 上为工作人员遵循自动扩展策略。在一段时间内(1 年以上),我们有许多这样的工人进出,因此主表 extra_db_nodes 急剧膨胀。

重启master解决了问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-16
    • 2013-02-26
    • 2011-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多