'ejabberdctl dump' dumps just 7 accounts out of 103

How to solve subj?

ejabbrd version 2.0.2_2

dump executes without errors. Rosters all present and include accounts that are missing now.

May be there is a way to get accounts one by one and move them to new database? That could be a semi-solution

It's a strange problem. You

It's a strange problem.

You have three ways to get your database:

  • dump, and then load
  • backup, and then install_fallback, or restore
  • Copy the Mnesia spool dir (usually somewhere in /var/lib/ejabberd) to the new location

Mnesia spool dir

First two ways are broken. Mnesia spool dir is not in "usual path", how can I find out where it is?
What files should be there? Does any configuration file mentions it?

Check ejabberdctl. Check the Guide

24pm wrote:

Mnesia spool dir is not in "usual path", how can I find out where it is?
Does any configuration file mentions it?

Probably you can see the path with:

$ ejabberdctl
  ...
  --spool dir        Database spool dir: //var/lib/ejabberd
24pm wrote:

What files should be there?

Search in the ejabberd Guide for the words "spool directory".

May be wrong Mnesia DB files?

1) Mnesia database spool files (*.DCD, *.DCL, *.DAT)

I found them in /opt/ejabberd-2.0.2_2/database/ejabberd@localhost and moved it to a new server - the same result: 7 users out of 103. I checked it in browser in old and new servers: old one shows all 103 users, a new one only 7 but all rosters filled by absent accounts. The command ejabberctl dump on new server gives just 7 accounts.

2) I tried to export data from Mnesia: installed mod_ctlextra and exported data with ejabberdctl export2odbc - passwd.txt shows just 7 users.

It seems like ejabberd has two databases in my case: one for work and one for DB managment.
I have only one ejabberd installed and running:

# ps ax | grep jabber
28884 ?        S      0:00 /opt/ejabberd-2.0.2_2/bin/epmd -daemon
29543 pts/4    Sl     0:04 /opt/ejabberd-2.0.2_2/bin/beam.smp -K true -P 250000

Exploring database spool files I found that file passwd.DCD did not change from installation date (at list file's datetime) and has just those 7 accounts! But file sr_user.DCD has recent datetime and holds all users (or so it seems).

Well, as I understand ejabberdctl works with passwd.DCD which is not up-to-date and epmd or beam.smp (or whatever serve as a jabber server) keep their data in another place. So:

How to make ejabberdctl take accounts from the right place, if passwd.DCD is wrong?
Or how to place all accounts into the right place, if passwd.DCD is the one?

Only one program opens the database: the running ejabberd

When "ejabberdctl export2odbc" is called, it connects to the running ejabberd and tells it to export its database.

You can see in ejabberd WebAdmin -> Nodes -> your node -> database, if the passwd Mnesia table of that running server has 7 or 103 users. When you call export2odbc or the other commands, they should produce a dump with exactly that number of accounts.

Some reasons I can think to get a dump with inaccurate information (as you get):

  • You have two different ejabberd servers running, each with a different database. Your ejabberdctl connects to the wrong one
  • Some elements in the database can't be exported correctly, and only some of them are exported
  • One element in the database can't be exported, and the export stops when the exportion attempt of that element crashes

found a DB location

Mea culpa!
Finally I learned that my DB is in MySQL not in Mnesia (sorry for my a-Mnesia :) )
It is strange that the connection from web interface and clients were to MySQL, but all management utilities were connecting to Mnesia.
May be it's because the configuration was not make properly:
{host_config, "chat.coke.com", [{auth_method, [odbc]}]}.
{odbc_server, {mysql, "localhost", "jabber", "jabber", "pass"}}.

Anyway, I've got another problem with migration to a new server.
That's what I did:
1) Dumped MySQL and moved it to the new server.
2) Tried a connection:

# mysql -h localhost -u jabber -ppass jabber
mysql> show tables;
mysql> select * from users;

all accounts are there

3) Stopped end copied ejabberd dir (it was installed from binary, so everything is in one dir /opt/ejabberd-2.0.2_2)
4) started deamon and got an error:

E(<0.273.0>:ejabberd_odbc:314) : MySQL connection failed: connect_failed

5) installed ejabberd 2.1.3 from binary install wizard, configured MySQL connection:

{auth_method, odbc}.
{odbc_server, {mysql, "localhost", "jabber", "jabber", "pass"}}.

6) started a daemon and got an error:

E(<0.3226.0>:ejabberd_odbc:514) : mysql_conn: Failed connecting to "localhost":3306 : {error, "connect failed : {error,
econnrefused}"}

So, it seems like there is a connection to MySQL error, but test connection from command line passed.
What can you suggest?

I am getting the same error.

I am getting the same error. Please, can you post how did you solve it?

Syndicate content