Package download analytics
The primary progress of both the S3 and Package Cloud downloads are tracked in Mnesia. In the case of catastrophic failure in which both nodes are lost, the checkpoint data is also written out to S3 which would allow a manual reconstruction using the steps below.
If manual initialization of Mnesia is required, these steps can be used to recreate the database on both nodes:
#Bring up both nodes as user "ubuntu"
erl -setcookie deploy_track -name deploy_track
%% Run on each node
rr("/opt/deploy_track/include/deploy_track.hrl").
application:set_env(mnesia, dir, "/opt/deploy_track/mnesia").
NodeList = ['[email protected]','[email protected]'].
mnesia:create_schema(NodeList).
%% Expected: {error,{'[email protected]',{already_exists,'[email protected]'}}}
%% Verify both directories have been created, then start
mnesia:start().
%% Once running on both nodes, get info
mnesia:info().
%% On one machine:
mnesia:create_table(checkpoint,[{attributes, record_info(fields, checkpoint)}, {disc_copies, NodeList},{type, set}]).
Add initial values to Mnesia
Tran = fun() ->
ok = mnesia:write(checkpoint,
#checkpoint{key = "s3-debug", value = "log/access_log-2016-04-27-00-20-27-A880247B87E5017E"},
sticky_write)
end,
mnesia:transaction(Tran).
Tran1 = fun() ->
ok = mnesia:write(checkpoint,
#checkpoint{key = "pkgcloud-debug", value = "2016-05-05T01:03:34.000Z riak-ts 1.3.0 54.166.165.133"},
sticky_write)
end,
mnesia:transaction(Tran1).