Hacker News new | past | comments | ask | show | jobs | submit login

I recently had to deal with Elixir for my very first time. All I wanted was to dump a db from the ErlangVMs built-in mnesia, and it was so awful if you only know SQL, Firebase and friends. Took me and a friend over two hours to find out that you can only read and restore a mnesia dump if the user@node is 1:1 the same as the original.

I most likely won’t touch it again except if I get a job at some telecommunication provider. The experience was too awful.




I'm sorry to hear you got frustrated with this task, but to be honest, I don't think it would be representative of how it feels working with Elixir or Erlang. It's like sitting down with zero experience to an IBM mainframe and trying to accomplish some routine administration task, setting up mandatory password rotation policy or whatever. It'd feel frustrating and difficult for sure, but it doesn't tell mutch about the mainframe. Especially since it isn't even a design goal for it to feel similar to the Windows or Mac OS your familiar with.

When it comes to node names in the schema, you have to change them, but there's actually an example just about this piece of task in the docs: https://www.erlang.org/doc/apps/mnesia/mnesia_chap7#backup,-...


Your frustration is understandable, but if you end up in the same spot again...

You're not really expected to copy a mnesia dump to another node that way, the expectation is you would add the other node to the dist cluster, then add that dist connected node to the shared mnesia schema (each node can only be in one mnesia schema, but you can have multiple schemas in your dist cluster), and then add table copies for the tables you want, with the storage you want on that mode. You could probably fiddle with the schema directly before starting mnesia to make it work though.

That aside, the data files are accessible via the underlying storage modules, disc_only_copies tables use dets and have .DAT extensions (you'll likely have schema.DAT), and disc_copies use disk log and you'll have .DCD and probably .DCL, LATEST.LOG and PREVIOUS.LOG may exist as well.

File type informtion is in the documentation with a pretty reasonable chapter title https://www.erlang.org/doc/apps/mnesia/mnesia_chap7#startup-...


Well, it was an old database and we actually just wanted to browse the records to see if there is anything important in them. If I had an old sql backup laying around and want to check whether we will need any of this data in the future the experience is much more straight forward. The path of mnesia was not so easy and intuitive. :X


Who the heck is using mnesia? I've never used an elixir codebase that uses it, and it's (I believe) considered to "not be best practices".. not the least of which is because it's well known that mnesia can lose data irrecoverably.


People say a lot of stuff about mnesia, but it worked pretty well when I was at WhatsApp. We had some patches as mnesia wasn't tuned for the load we gave it, but it was pretty amenable. I don't recall any data loss issues that were mnesia's fault; maybe sometimes we had too much data to properly dump to disk and we chose to truncate files and hope things would work out, and when they didn't data was lost; mnesia may be a contributing factor, but lots of databases do bad things when you write more data than your disk can hold. We did a lot of things that fell outside of 'best practices' though: no transactions, dirty reads and writes, for many years rejoining after netsplits without reconciliation, disabling database dumps sometimes and cowboy operations schemes to try to resume normal operations afterwards despite having insufficient space, etc.

Having data in the same process as the software that manages it is immensely powerful and it would be foolish to give that up when your data fits the model available.


I know nothing about it but just the name itself is warning enough to say away. Amnesia…


you realise that "mnesia" means "memory", hence "amnesia" for "no-memory" ? So Mnesia should be the most reassuring word you could get from a db.

This is a total aside from its technical considerations mind you, i usually do not advise mnesia :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: