I've got an Elixir app that uses a Mnesia database. It works fine and I can store and retrieve data no problem. I'm now looking at how to back up that database and, reading through the documentation, found that there is a :mnesia.backup
function that should do what I want. However, when I call it, I get:
:mnesia.backup("myfile")
{:error, {:EXIT, {:error, :function_clause}}}
And the logs show this:
[error] Mnesia(:nonode@nohost): ** ERROR ** Failed to abort backup. :mnesia_backup::abort_write["myfile"] -> {:badrecord, :backup}
That line in the log is confusing as I wasn't trying to abort the backup at all.
The :function_clause
error suggests that an invalid argument is passed somewhere so I search online to see what I should pass to the backup
function (the Erlang docs are particularly unclear about that) and found this question that suggests it should be the name of the backup file: what is the proper way to backup/restore a mnesia database?
I had a look at the mnesia code to see if I could find anything obvious but no joy there.
Can anybody tell me what I'm doing wrong please?
I am using Elixir 1.4.1 with Erlang/OTP 19 on Ubuntu 16.04 and I have a basic code example that demonstrates the problem if needed.