Change from pgsql to internal

Hi folk!

I am using an ejabberd 1.1.4 Server with pgsql-support. But only the useres are stored in de database. So I want to move now from the postgresql do an internatl database. Is there an easy way to do this without loosing all roster contacts etc.?

The roster isn't stored in the PG-Server so I think that's not the problem. Any hints? Thanks.

Regards, Tobias

Only auth?

So you use pgsql only for authentication? Or do you use also mod_roster_odbc, ...?

If you only use for auth, then you only need ejabberd to create an item for each user in the Mnesia table 'passwd', with the info: username, domain, password. There are two possible ways: create the accounts as usual, or manually edit the table. I don't know which one is better, so I'll explain how to make the difficult one :)

  1. Export your pgsql database to text file
  2. Convert the file to the format used by Mnesia text dumps.
  3. For example, to add the users 'tom' with password 'tutu9' and 'bobby' with password 'gj45' to the vhost 'localhost', I create the file /tmp/justusers.dump with this content:
    {tables,[
             {passwd,[{record_name,passwd},{attributes,[us,password]}]}
    ]}.
    {passwd,{"tom","localhost"},"tutu9"}.
    {passwd,{"bobby","localhost"},"gj45"}.
  4. Now go to the ejabberd webadmin, and in Nodes -> your node -> DB Backups, Restore text file backup, put the full path to your file and Accept.

I tested this, and importing that file didn't remove any information: the other accounts and the rosters are intact. But anyway, you may want to make a binary backup before doing all this process.

Hi, yes only auth. Thanks

Hi,

yes only auth. Thanks for your howto! I will try this the next day and post the result :)

Rgds, Tobias

Syndicate content