Eiji

Eiji

How to add new nodes after creating amnesia database

Hey, following @jmerriweather Elixir + Phoenix + Amnesia + Multi-node everything works awesome. However I just got one idea and I do not see any way to solve it. I would like to firstly setup amnesia only for n1@127.0.0.1 node (following naming in example code) and later decide to add n2@127.0.0.1 node and sync it with n1@127.0.0.1.

Note: When syncing I expect n2@127.0.0.1 to not have any database even created, so there would be no data conflict. I just want to know how to run synced database copy on newly created node.

I would like to do so for example when I’m working on private project on one device and later decide to buy another one and connect it to first device in order to do more things at same time and sync results of all devices, so I can finally connect my PC, create database, sync it and fetch all results from all devices at once.

Marked As Solved

Also Liked

Eiji

Eiji

@cohawk: Thank you very much!

Looks like amnesia does not implements or simply delegates :mnesia.change_config/2 function, so I did not found it in amnesia documentation. There is coming one small problem which I have already resolved. When doing that only :schema table is saved and it’s saved in memory only! In order to create a mnesia directory we need to:

  1. Amnesia.Table.copying(:schema, node(), :disk) which changes :schema table type and saves it on disc
  2. For each table (except :schema) we need to call Amnesia.Table.add_copy(table, node(), :disk)

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement