From 08ba5346dbc1cef37ea1b589e6c86f0f70851d98 Mon Sep 17 00:00:00 2001 From: Badlop Date: Fri, 15 May 2009 22:39:30 +0000 Subject: [PATCH] Document how to convert Mnesia node name SVN Revision: 2081 --- doc/guide.html | 41 ++++++++++++++++++++++++--------- doc/guide.tex | 61 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 84 insertions(+), 18 deletions(-) diff --git a/doc/guide.html b/doc/guide.html index 0dc4f0bb8..5bbd6ea72 100644 --- a/doc/guide.html +++ b/doc/guide.html @@ -3306,16 +3306,37 @@ so it stores the name of the Erlang node in it (see section The name of an Erlang node includes the hostname of the computer. So, the name of the Erlang node changes if you change the name of the machine in which ejabberd runs, -or when you move ejabberd to a different machine.

So, if you want to change the computer hostname where ejabberd is installed, -you must follow these instructions: -

  1. - In the old server, backup the Mnesia database using the Web Admin or ejabberdctl. - For example: -
    ejabberdctl backup /tmp/ejabberd-oldhost.backup
    -
  2. In the new server, restore the backup file using the Web Admin or ejabberdctl. - For example: -
    ejabberdctl restore /tmp/ejabberd-oldhost.backup
    -

+or when you move ejabberd to a different machine.

You have two ways to use the old Mnesia database in an ejabberd with new node name: +put the old node name in ejabberdctl.cfg, +or convert the database to the new node name.

Those example steps will backup, convert and load the Mnesia database. +You need to have either the old Mnesia spool dir or a backup of Mnesia. +If you already have a backup file of the old database, you can go directly to step 5. +You also need to know the old node name and the new node name. +If you don’t know them, look for them by executing ejabberdctl +or in the ejabberd log files.

Before starting, setup some variables: +

OLDNODE=ejabberd@oldmachine
+NEWNODE=ejabberd@newmachine
+OLDFILE=/tmp/old.backup
+NEWFILE=/tmp/new.backup
+
  1. +Start ejabberd enforcing the old node name: +
    ejabberdctl --node $OLDNODE start
    +
  2. Generate a backup file: +
    ejabberdctl --node $OLDNODE backup $OLDFILE
    +
  3. Stop the old node: +
    ejabberdctl --node $OLDNODE stop
    +
  4. Make sure there aren’t files in the Mnesia spool dir. For example: +
    mkdir /var/lib/ejabberd/oldfiles
    +mv /var/lib/ejabberd/*.* /var/lib/ejabberd/oldfiles/
    +
  5. Start ejabberd. There isn’t any need to specify the node name anymore: +
    ejabberdctl start
    +
  6. Convert the backup to new node name: +
    ejabberdctl mnesia_change_nodename $OLDNODE $NEWNODE $OLDFILE $NEWFILE
    +
  7. Import the new backup: +
    ejabberdctl restore $NEWFILE
    +
  8. Check that the information of the old database is available: accounts, rosters... +After you finish, remember to delete the temporary backup files from public directories. +

Chapter 5  Securing ejabberd

5.1  Firewall Settings

You need to take the following TCP ports in mind when configuring your firewall: diff --git a/doc/guide.tex b/doc/guide.tex index 83cf15016..d8717f186 100644 --- a/doc/guide.tex +++ b/doc/guide.tex @@ -4250,19 +4250,64 @@ So, the name of the Erlang node changes if you change the name of the machine in which \ejabberd{} runs, or when you move \ejabberd{} to a different machine. -So, if you want to change the computer hostname where \ejabberd{} is installed, -you must follow these instructions: +You have two ways to use the old Mnesia database in an ejabberd with new node name: +put the old node name in \term{ejabberdctl.cfg}, +or convert the database to the new node name. + +Those example steps will backup, convert and load the Mnesia database. +You need to have either the old Mnesia spool dir or a backup of Mnesia. +If you already have a backup file of the old database, you can go directly to step 5. +You also need to know the old node name and the new node name. +If you don't know them, look for them by executing \term{ejabberdctl} +or in the ejabberd log files. + +Before starting, setup some variables: +\begin{verbatim} +OLDNODE=ejabberd@oldmachine +NEWNODE=ejabberd@newmachine +OLDFILE=/tmp/old.backup +NEWFILE=/tmp/new.backup +\end{verbatim} + \begin{enumerate} - \item In the old server, backup the Mnesia database using the Web Admin or \term{ejabberdctl}. - For example: +\item Start ejabberd enforcing the old node name: \begin{verbatim} -ejabberdctl backup /tmp/ejabberd-oldhost.backup +ejabberdctl --node $OLDNODE start \end{verbatim} - \item In the new server, restore the backup file using the Web Admin or \term{ejabberdctl}. - For example: + +\item Generate a backup file: \begin{verbatim} -ejabberdctl restore /tmp/ejabberd-oldhost.backup +ejabberdctl --node $OLDNODE backup $OLDFILE \end{verbatim} + +\item Stop the old node: +\begin{verbatim} +ejabberdctl --node $OLDNODE stop +\end{verbatim} + +\item Make sure there aren't files in the Mnesia spool dir. For example: +\begin{verbatim} +mkdir /var/lib/ejabberd/oldfiles +mv /var/lib/ejabberd/*.* /var/lib/ejabberd/oldfiles/ +\end{verbatim} + +\item Start ejabberd. There isn't any need to specify the node name anymore: +\begin{verbatim} +ejabberdctl start +\end{verbatim} + +\item Convert the backup to new node name: +\begin{verbatim} +ejabberdctl mnesia_change_nodename $OLDNODE $NEWNODE $OLDFILE $NEWFILE +\end{verbatim} + +\item Import the new backup: +\begin{verbatim} +ejabberdctl restore $NEWFILE +\end{verbatim} + +\item Check that the information of the old database is available: accounts, rosters... +After you finish, remember to delete the temporary backup files from public directories. \end{enumerate}