To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/24CFA0E2-6053-471A-86DB-448F83D68C2E%40cloudamqp.com.
We are trying to move Mnesia persistent db from one node to another and perform blue/green switch. For this we copy all the metadata at path “/var/lib/rabbitmq/mnesia/” from node A and move it to node B on same path.
Then we used the “rename_cluster_node” to get all the Q’s, exchange etc. We followed below steps:
Single node Stanalone rabbitmq:
Output: Shutting down RabbitMQ node rabbit@devyashish-mayank running at PID 16735
Waiting for PID 16735 to terminate
RabbitMQ node rabbit@devyashish-mayank running at PID 16735 successfully shut down
Output: Renaming cluster nodes:
rabbit@<<OLD_NODE>> -> rabbit@<<NEW_NODE>>
Impersonating node: rabbit@<<OLD_NODE>>... done
Mnesia directory : /var/lib/rabbitmq/mnesia/rabbit@<<OLD_NODE>>
Impersonating node: rabbit@<<NEW_NODE>>... done
Mnesia directory : /var/lib/rabbitmq/mnesia/rabbit@<<OLD_NODE>>
Output: Error: unable to perform an operation on node 'rabbit@ <<OLD_NODE>> '. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@ <<OLD_NODE>>
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
DIAGNOSTICS
===========
attempted to contact: ['rabbit@ <<OLD_NODE>> ']
rabbit@ <<OLD_NODE>> :
* connected to epmd (port 4369) on <<OLD_NODE>>
* epmd reports: node 'rabbit' not running at all
no other nodes on <<OLD_NODE>>
* suggestion: start the node
Current node details:
* node name: 'rabbitmqcli-8318-rabbit@<<OLD_NODE>> '
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: xkhwV9fuCJ5pw7E3BSr4dw==
Even after executing all these commands successfully we were not able to get the Q’s, exchange or any metadata on new node.
When again we tried executing the “rename_cluster_node” command then we got below error :
Renaming cluster nodes:
rabbit@<<OLD_NODE>> -> rabbit@ <<NEW_NODE>>
Error:
{:rename_failed, {:rename_in_progress, 'Restart node under old name to roll back'}}
Single node Docker Stanalone rabbitmq:
Apart from the above issue we are also facing issue in our docker environment where the container stops when we use execute “rabbitmqctl shutdown” and the automatically gets restarted before we execute the “rename_cluster_node” command. We are getting error for the same as below.
· docker exec -it c0a57e3cd739 rabbitmqctl shutdown
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
Shutting down RabbitMQ node rabbit@ <<NEW_NODE>> running at PID 197
Waiting for PID 197 to terminate
· docker exec -it c0a57e3cd739 rabbitmqctl rename_cluster_node rabbit<<OLD_NODE>> rabbit@<<NEW_NODE>>
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
Renaming cluster nodes:
rabbit@ <<OLD_NODE>> -> rabbit@ <<NEW_NODE>>
* Impersonating node: rabbit@ <<OLD_NODE>> ...Error:
{:rename_failed, {:badmatch, {:error, {{:shutdown, {:failed_to_start_child, :net_kernel, {:EXIT, :nodistribution}}}, {:child, :undefined, :net_sup_dynamic, {:erl_distribution, :start_link, [[:"rabbit@ <<OLD_NODE>> ", :shortnames], false]}, :permanent, 1000, :supervisor, [:erl_distribution]}}}}}
After this on trying to re-execute “rename_cluster_node” command we get error as below:
· docker exec -it c0a57e3cd739 rabbitmqctl rename_cluster_node rabbit@ <<OLD_NODE>> rabbit@<<NEW_NODE>>
warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell)
Renaming cluster nodes:
rabbit@ <<OLD_NODE>> -> rabbit@ <<NEW_NODE>>
Error:
{:rename_failed, {:rename_in_progress, 'Restart node under old name to roll back'}}
We followed link: https://www.rabbitmq.com/backup.html
Since the documentation regarding the Mnesia directory movement from one node to another is not that clear we are not able to understand what went wrong during the blue/green switch.
Please help us in this issue and if available provide us detailed documentation regarding this usecase.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/867A51D3-9CCE-4F4D-A264-A05A9956914C%40cloudamqp.com.
mv \
/var/lib/rabbitmq/mnesia/rabbit\@misshelpful \
/var/lib/rabbitmq/mnesia/rabbit\@cordelia
mv \
/var/lib/rabbitmq/mnesia/rabbit\@misshelpful-rename \
/var/lib/rabbitmq/mnesia/rabbit\@cordelia-rename
mv \
/var/lib/rabbitmq/mnesia/rabbit\@misshelpful-plugins-expand \
/var/lib/rabbitmq/mnesia/rabbit\@cordelia-plugins-expand