Migrate from jabberd2 to ejabberd with jabberd1.4 intermediate

This tutorial will help you to migrate a jabberd2 database stored in MySQL to ejabberd. Since there is no direct way to migrate from jabberd2 to ejabberd, you first need to migrate from jabberd2 MySQL to jabberd 1.4 XML spool files with a Perl script. Afterwards you can complete the migration process by pointing ejabberd to the directory containing the jabberd 1.4 compatible XML spool files.

  1. Download jd2to1

    jd2to1 is a Perl script by Daniel Henninger that migrates from jabberd2's MySQL to jabberd 1.4's XML. You can download from the page Jabberd2 to 1 migration script. We have a local copy of the file here: j2to1.txt. See also a slightly modified version to work better with PostgreSQL, thanks to Aiko Barz: j2to1-pgsql.txt. Save the file as j2to1.pl and make it executable:

    chmod 700 j2to1.pl
  2. Install Required Perl Modules

    The script jd2to1.pl requires DBI and XML::Simple Perl modules. If you have Perl installed but get error messages at runtime because of these modules missing, you can install them by running:

    cpan DBI XML::Simple
  3. Configure jd2to1.pl

    Edit jd2to1.pl and configure the following variables with the correct values:

    my $dbtype = "mysql";
    my $dbhost = "localhost";
    my $dbdatabase = "jabberd2";
    my $dbusername = "jabberd2";
    my $dbpassword = "password";
  4. Execute jd2to1.pl

    Now you can finally execute the script to export your database to XML files:

    j2to1.pl xml

    This will create a new directory 'xml' that contains the jabberd 1.4 spool directory.

  5. Proceed now to the Instructions for Migrating from jabberd 1.4 to ejabberd

    Now that you have a jabberd 1.4 spool directory, you can use the tutorial to migrate from jabberd 1.4 to ejabberd to complete the migration process.

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

Related Links

Comment viewing options

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

link broken

Where is script perl jd2to1.pl ?

Links updated to new download page

I found another page that has the script, so I've updated the link in the tutorial.

Another way that might work:

Another way that might work: Migrate jabber 2 to ejabberd.

--
sander

From jadmin@

There is serious bug in script that converts contacts from jabberd2 to jabberd1.4 and then to ejabberd
(http://www.ejabberd.im/jabberd2-to-ejabberd).

bug have 2 impacts:
- it converts groups wrong (unpredictable behavior)
- it is very slow (1 contact with 120 roster items ~60sec on 3Ghz machine)

Thanks to Jacek Konieczny (Jajcus) that fix sql query - j2to1.pl works right and much faster (above example took 1sec).

kolargol.

--- j2to1.pl 2005-09-02 09:27:26.000000000 +0200
+++ j2to1_fixed.pl 2005-09-02 09:27:53.000000000 +0200
@@ -67,8 +67,7 @@
$xdb->{query}->[0]->{xmlns} = "jabber:iq:roster";
$xdb->{query}->[0]->{xdbns} = "jabber:iq:roster";

- my $asth = $dbh->prepare("SELECT `roster-items`.jid,`roster-items`.name,`roster-items`.`to`,`roster-items`.`from`,`roster-items`.ask,`roster-groups`.`group` FROM `roster-items` LEFT JOIN `roster-groups` ON `roster-items`.jid = `roster-groups`.jid WHERE `roster-items`.`collection-owner` = '$jid' ORDER BY `group`,jid");
-
+ my $asth = $dbh->prepare("SELECT `roster-items`.jid,`roster-items`.name,`roster-items`.`to`,`roster-items`.`from`,`roster-items`.ask,`roster-groups`.`group` FROM `roster-items` LEFT JOIN `roster-groups` ON (`roster-items`.jid = `roster-groups`.jid and `roster-items`.`collection-owner` = `roster-groups`.`collection-owner`) WHERE `roster-items`.`collection-owner` = '$jid' ORDER BY `group`,jid");

$asth->execute;
my $cnt = 0;

Thanks for the bugreport and the patch

Thanks for the bugreport and the patch. I've applied it to the local copy, and I've reported the author of the script.

Syndicate content