Migrate from jabberd 1.4 to ejabberd

This tutorial will help you to migrate a jabberd 1.4 spool directory with XML files to ejabberd.

  1. Importing the jabberd 1.4 Spool Directory

    There are two methods to import the spool directory, by using the command line tool ejabberdctl, or by using a Jabber client with Ad-Hoc Commands support.

    Using the Command Line Tool ejabberdctl

    1. Access the command line on the computer that runs ejabberd.

    2. Use ejabberdctl to import the jabberd 1.4 spool directory:

      ejabberdctl NODE import-dir PATH_TO_SPOOL

      You need to replace:

      • NODE: Erlang node name. For example: ejabberd@localhost

      • PATH_TO_SPOOL: full path to the jabberd 1.4 spool directory containing the XML files. Be aware that the spool directory must be named like the hostname of the Jabber IDs you want to import. For instance, if your users have Jabber IDs of the form "user@example.org", the path must look like: /jabberd14/spool/directory/called/example.org/

    Using a Jabber client with Ad-Hoc Commands support

    1. Create a user account with admin privileges on ejabberd if you do not yet have one. Make sure to not use a username that will be imported from the spool directory.

    2. Login with a supported Jabber client to that account and discover your server.

    3. Look in the 'Discovery' window for 'Running Nodes', 'ejabberd@hostname' (this may differ), 'Import users from jabberd1.4 spool files', 'Import Directory', and finally 'configure service'. Obviously, you might need to look for the translated equivalents of these entries.

    4. A new window will appear. Specify the full path to the jabberd 1.4 spool directory containing the XML files. Be aware that the spool directory must be named like the hostname of the Jabber IDs you want to import. For instance, if your users have Jabber IDs of the form "user@example.org", the path must look like: /jabberd14/spool/directory/called/example.org/

  2. Checking if the Users are Created

    Since ejabberd will not show any message, either success or failure, the only way to know if all went right, is to check if the users are created. You can verify this in ejabberd's web interface. Do not forget to check if the rosters were imported too.

  3. Troubleshooting

    Make sure ejabberd has read access to the XML files.

This guide was written by Stian B. Barmen <stian at barmen dot nu> on April 2005, and edited by Badlop and Sander Devrieze.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How to preserve passwords

Hi everybody.

Can anybody tell me if there is any kind of "magic trick" to import accounts from jabberd14 but in a way in which i can preserve users passwords and individual authorisation settings?
I observed that after importing, each user has to re-authorise each contact from his/her roster.

It should import the rosters.

Importing from jabberd14 should import: user auth, rosters (the contact list), offline messages, vcards, ...

Maybe in your case only the user auth was imported. Try several things:

  • Repeat the import again;
  • check the ejabberd log files in case it shows any error message;
  • verify if all accounts were imported;
  • otherwise, also try to import only three accounts, and check if for those all their information is correctly imported
  • If only some accounts are badly imported, check if their XML files in the jabberd14 spool dir are XML-well formed.

How about passwrods?

But there is no way to import users passwords?

They should

siwuch86 wrote:

But there is no way to import users passwords?

They should be imported like other information (rosters, vcards, ...), and included in the mnesia table 'passwd'.

The problem was in XML files

The problem was in XML files with contacts from Gadu-Gadu transport. I changed each "subscription='to'" to "subscription='both'" and then importing gone well :).

Script to migrate rosterusers and rostergroups in MySQL database

I migrated one french jabber server (jabber-fr.net) (from jabberd1.4 to ejabberd) with the MySQL support and i met a problem with the script to import users account. The script is OK when ejabberd run with mnesia database but with MySQL, the script didn't imported any rosters ! So, i wrote a script in PHP to migrate all rosters of all XML files (form jabberd1.4). The script import only rosterusers and rostergroups because it was only these informations which didn't import in MySQL tables (Username, messages... import well). This script is under GNU GPL v2 licence. You can donwload and use it here: http://bchomel.free.fr/loisirs/info/script_migration_rosters_ejabberd_my...

JID: nanard51@jabber-fr.net

A copy of the script is also available here: script_migration_rosters_ejabberd_mysql.tar.gz

How to run ejabberdctl in windows xp?

Hi to all,

I have jabberd 1.4 running on a linux server. I'm currently testing ejabberd on my windows machine. I've been trying to import some users from jabberd into ejabberd,following the instruction given above, but to no avail.

Would someone kindly advice me how to run the above procedure in a windows environment?
Please help.

thx in advance

cheers,
sylver

p/s: I've tried including 'erl5.4.13\bin' in my PATH variable. It still won't work.

There is a FAQ entry about

There is a FAQ entry about ejabberdctl on Windows.

--
sander

Did you try using a Jabber client?

sylverspyder wrote:

I've been trying to import some users from jabberd into ejabberd,following the instruction given above, but to no avail.

'There are two methods to import the spool directory', did you try the second method: 'Using a Jabber client with Ad-Hoc Commands support'?

I have tried 'Using a Jabber client with Ad-Hoc Commands support

Yes I have.

But all I can find is the latest version of PSI (0.10) and TKABBER (0.9.9), and both didn't have the interfaces shown here --> http://www.ejabberd.im/mod_configure

If you have the download links for the appropriate clients, please post it here.

I'm trying to follow sander's faq link for a while and will post back the result asap.

Thank you for the fast replies.

Tkabber 0.9.9 should work: is the account admin?

sylverspyder wrote:

latest version of PSI (0.10) and TKABBER (0.9.9), and both didn't have the interfaces shown here --> http://www.ejabberd.im/mod_configure

If you have the download links for the appropriate clients, please post it here.

Tkabber 0.9.9 should work. For Psi, try 0.11-beta or nightly builds. Look for them on the Psi Wiki.

If Tkabber doesn't show you the admin options, probably the reason is your Jabber account is not defined as admin on ejabberd.cfg.

Confirmed logged in as admin in tkabber

Hi badlop, thanx for your reply.

I've tried logging in as admin but still there's no "Running Node" in the Service Directory window.

Here's 2 snapshot of my Psi (nightly-20061026-win32) and Tkabber(0.99)'s Service Directory window.

PSI-SD
Tkabber-SD

Should I add any extra codes inside the ejabberd config file?

I'm now trying the FAQ that sander's posted earlier. I've got a hang of using ejabberdctl to accomplish this task, but I realised that it need a VALID xml file to be exported. So now I'm trying to make a sample xml file taken from the jabberd server a valid xml file manually. It is quite tedious :D

Any other suggestion are truly welcome.
Thank you.

give admin rights to the jabber account

sylverspyder wrote:

I've tried logging in as admin but still there's no "Running Node" in the Service Directory window.

You login with a Jabber account called admin@localhost. Does that account have admin rights? No, because ejabberd doesn't show the admin features on Service Discovery.

sylverspyder wrote:

Should I add any extra codes inside the ejabberd config file?

Yes. Check the ejabberd Guide, section '6 Creating an Initial Administrator'. You need to do steps 2 and 3.

admin@localhost already have admin rights

Hi badlop,

Thank you for your fast reply.

I've checked the ejabberd config file and found that admin@localhost already has admin rights, according to the line

Quote:

{acl, admin, {user, "admin","localhost"}}.

which is the exact code found in the ejabberd Guide section '3.3 Creating an Initial Administrator'.

I've successfully accessed the web interface, using admin@localhost which means that admin@localhost does has admin right, correct? :)

I'm sorry i can't find it in section 6 as my guide shows that section 6 is for 'Clustering'.

Hoping to hear more from you.

Thousand thanks.

Check mod_configure is running

Note that I refer to ejabberd 1.1.2, but you seem to be using an older version of ejabberd.

sylverspyder wrote:

I've successfully accessed the web interface, using admin@localhost which means that admin@localhost does has admin right, correct? :)

Ok, then the account has rights.

The problem then is on mod_configure, and mod_adhoc which is required. Check both of them are declared on ejabberd.cfg, and they are listed on web interface -> virtual host -> your host -> nodes -> your node -> modules.

problem with ejabberd-1.1.1

With the command: "./bin/ejabberdctl import-dir /home/karlox/ejabberd-1.1.1/jabberd14/spool/tegra-sc.it/"
I cant import jabber-1.4 accounts with this error:

=ERROR REPORT==== 12-Sep-2006::13:24:01 ===
E(<3891.290.0>:jd2ejd:39): Error while processing file "/home/karlox/ejabberd-1.1.1/jabberd14/spool/jabber.integra-sc.it/ruscello_0346.xml": {undef,
[{ejabberd_auth_undefined,
set_password,
["ruscello_0346",
"tegra-sc.it",
"ruscello_0346"]},
{lists,
foldl,
3},
{jd2ejd,
xdb_data,
3},
{lists,
foreach,
2},
{jd2ejd,
import_file,
1},
{jd2ejd,
'-import_dir/1-fun-1-',
3},
{lists,
foldl,
3},
{ejabberd_ctl,
process,
1}]}

** at node k4m_ejabberd@atena **

I don't undestand the problem!!!

Can you check with xmllint

Can you check with xmllint to see if that file is valid XML?

--
sander

xmllint return 0

i use xmllint like this:
]$ xmllint account.xml
]$ echo $?
]$ 0

if thereisn't other specific option, seem to be all ok!!

I've no experience with

I've no experience with xmllint, maybe xmllint --help can help you?

--
sander

roster doesn't get imported

I'm using ejabberd 1.1.1 with native postgres-backend and everything is working fine. However, as I migrated from jabberd2 to ejabberd, I had to use the given scripts (convert to xml and import afterwards). The users are correctly imported whereas the roster items won't get imported at all.

So it can't be a problem of file permissions. As the roster items which I add to my roster in my jabber client show up in the table, it isn't a problem of misconfiguration neither.

I even tried to import some native xml files of a jabberd1.4 test installation, same behaviour. Users are imported, roster items are not.

Does anyone have an idea on what the problem could be?

Problem to import jabber 1.4 to ejabberd 1.0

Hi,

I have a problem to import xml file xdb (jabber 1.4) to ejabberd 1.0, in version 0.9 of ejabberd this was possible.

I paste the error:

# su ejabberd /usr/local/bin/ejabberdctl ejabberd@vs2 import-dir /home/network/import/*
Can't import jabberd 1.4 spool dir "/home/network/import/jpmattos.xml" at node ejabberd@vs2: 
{'EXIT', {{badmatch, {error, enotdir}},
[{jd2ejd, import_dir, 1}, {rpc, '-handle_call/3-fun-0-', 5}]}}

Thanks

Re: Problem to import jabber 1.4 to ejabberd 1.0

cajardim wrote:

# su ejabberd /usr/local/bin/ejabberdctl ejabberd@vs2 import-dir /home/network/import/*

Try to remove the asterisk and rename the import directory to the name of your Jabber domain. For example, in case the users you want to import have Jabber IDs such as user@example.org, do this:

# su ejabberd /usr/local/bin/ejabberdctl ejabberd@vs2 import-dir /home/network/example.org/

Re: Problem to import jabber 1.4 to ejabberd 1.0

cajardim wrote:

# su ejabberd /usr/local/bin/ejabberdctl ejabberd@vs2 import-dir /home/network/import/*

Try to put the path of the directory where the files are, as explained on the guide: /home/network/import/

Re: Problem to import jabber 1.4 to ejabberd 1.0

Hi badlop,

I executed this I command previously and he did not show no result, however the importation did not function.

I also tried to make the importation of the archive through "import-file" and also he did not function.

Exists a form to activate the DEBUG in ejabberctl to verify the result?

Thanks again.

Re: Problem to import jabber 1.4 to ejabberd 1.0

cajardim wrote:

I executed this I command previously and he did not show no result, however the importation did not function.

Give all privileges on the spool directory and xml files. Maybe that's the problem (and ejabberd doesn't report it).

cajardim wrote:

Exists a form to activate the DEBUG in ejabberctl to verify the result?

You can check the ejabberd log files, maybe they report some error. To enable full debug reports, edit ejabberd.hrl
and make sure it has this line uncommented:

-define(ejabberd_debug, true).

Recompile ejabberd, restart it and look at the logs when you try to import spool.

Re: Problem to import jabber 1.4 to ejabberd 1.0

Thanks badlop, the problem was resolved.

The archive was damaged.

Problem with importing on Debian

There is problem with jabberdctl import-dir on debian. You can get messages that import script could not read find the file. Problem is in permissions.

You have to change all permissions on path to file that you're importing. Ejabberd user must have access permissions. E.g. if you were using Jabber 1.4 default permission belongs only to jabber, so user ejabberd couldn't read the file.

If you're importing by import-file it's also very useful to use full path specification to xml file from j1.4.

Some usernames that weren't imported

I imported a great number of users from a jabberd1.4 installation. Looks like jabberd1.4 created - I don't know why - password tags in XML files in two different formats: one expliciting the namespace, the other one not doing it.

Maybe the ones that don't get imported were created from older jabberd versions.

Ejabberd will import the former, and silently ignore the latter.

For reference, the two tags are:

not working: <password xdbns="jabber:iq:auth">
working: <password xdbns="jabber:iq:auth" xmlns="jabber:iq:auth">

can migrate...?

It can get configuration files without plain text passwords? with only SHA-1 stored passwords from jabber1.4?

thanks.

plain text passwords required

As ejabberd supports only the basic jabberd1.4 format, the import process will probably fail. And ejabberd itself stores passwords in plain text.

ejabberd can not...

ejabberd can not store encripted or digest passwords? there no plugins to do it?

As I said: no

Passwords are stored on the database in plain text as I said, and nobody cared to write a patch. Check this thread on the mailing list, it explains why plain text passwords are required.

Syndicate content