I have an mnesia database dump from an ejabberd server (DCD, DCL, and DAT files), and I'm trying to recover any data I can from this database. It would be ideal to convert it to some kind of SQL database, however I would settle for a simple text dump (from there I could probably rebuild the database).
I'm an erlang/mnesia newbie, but here is what I managed to do from the online docs:
bash$> erl -mnesia dir '"ejabberd_dump_dir"'
...Erlang loads...
1> mnesia:start().
2> mnesia:info().
[snip]
stopped db nodes = [ejabberd_dump_dir]
[snip]
remote = [ list of the tables from ejabberd_dump_dir ]
[snip]
3> tv:start().
When tv starts it simply shows to table names and says they have 0 records. I'm guessing there's some way of loading it into memory again, but I have yet to figure out how based on the docs.
Another thought I had was to attempt to load it using another installation of ejabberd, however it seems the only way to this using ejabberdctl is to load it from a text file.
How do I load this database and either dump it into sql or dump it to a format that can be imported by sql? What am I missing?
UPDATE: I've been attempting to restore this database to a temporary ejabberd server like so:
bash$> ejabberdctl --auth admin ejabberd passwd restore ejabberd /home/user/ejabberddmpdir/
bash$> ejabberdctl --auth admin ejabberd passwd export2odbc ejabberd /home/user/mnesiatosql/
The first command fails and forced me to conclude I'm quickly losing the war between man and machine. I'm not positive, but I think that using ejabberd as the host will use localhost as the node. Any ideas?
UPDATE: I think it might be a permissions issue as trying to export the default ejabberd db will result in {{badmatch,{error,eacces}}
among other errors. This email shows the error I'm getting, but I'm not sure why.
I'm still working out the details as to how the whole mnesia node system works, but I ended up using this to load the database into mnesia:
bash$> erl -name ejabberd@localhost -mnesia dir '"/home/usr/ejabberd@localhost/"'
Thanks to anyone who took a look.