Sidi_Mohammed
Mnesia Backup traverse does not find :db_nodes field
Hello,
I have mnesia database which I want to change its node name, I have followed erlang official documentation and end up by this code which I run on :firstnode@host:
:mnesia.stop()
:mnesia.start()
Process.sleep(200)
:mnesia.backup('backup.bup')
change_node_name(:mnesia_backup, :firstnode@host, :secondnode@host, 'backup.bup', 'new_backup.bup')
###########
defp change_node_name(mod, from, to, source, target) do
switch =
fn(node) when node == from ->
to
(node) when node == to ->
throw({:error, :already_exists})
(node) -> node
end
convert =
fn({:schema, :db_nodes, nodes}, acc) ->
{[{:schema, :db_nodes, :lists.map(switch, nodes)}], acc}
({:schema, :version, version}, acc) ->
{[{:schema, :version, version}], acc}
({:schema, :cookie, cookie}, acc) ->
{[{:schema, :cookie, cookie}], acc}
({:schema, tab, create_list}, acc) ->
keys = [:ram_copies, :disc_copies, :disc_only_copies]
opt_switch =
fn({key, val}) ->
case :lists.member(key, keys) do
true ->
{key, :lists.map(switch, val)}
false->
{key, val}
end
end
{[{:schema, tab, :lists.map(opt_switch, create_list)}], acc}
(other, acc) ->
{[other], acc}
end
:mnesia.traverse_backup(source, mod, target, mod, convert, :switched)
end
And when trying to restore the new backend from :secondnode@host, the database still remote.
I did a lookup inside this code, the most important part is {:schema, :db_nodes, nodes} however this clause has never been matched, also (other, acc) has not matched, the only matched clause is {:schema, tab, create_list}, so any help please ? thank you.
Popular in Questions
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lists...
New
I am trying to implement my new.html.eex file to create new posts on my website.
new.html.eex:
<h1>Create Post</h1>
<%= ...
New
I have VueJS GUIs with the project generated using Webpack.
I have Elixir modules that will need to be used by the VueJS GUIs.
I forese...
New
Hi all,
Trying to get some more clarity over utc_datetime and naive_datetime for Ecto:
The documentation above suggests that while ...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Other popular topics
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
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
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








