Two Vservers using identical storage data using mnesia

Hi there,

I have the following problem, which I haven't found a solution for: I am currently running a jabber server on jabber.example.com with LDAP authentication and the internal mnesia database for storage. Now I want my users to be able to use a shorter Jabber ID, which should simply be example.com using SRV records. The problem now is that AFAIK if I use vhosts for that, ejabberd will use the same mnesia database for storage for the new host, but will add information on the vhost the data belongs to. However, I want to have exactly the same data for *both* vhosts, so I doesn't matter if the user logs in with his/her @jabber.example.com or @example.com Jabber ID. This means that ejabberd should *not* differentiate between the vhosts in regard of the storage. Is this possible?

Thanks,

Gollo

gollo wrote: I want to have

gollo wrote:

I want to have exactly the same data for *both* vhosts, so I doesn't matter if the user logs in with his/her @jabber.example.com or @example.com Jabber ID. This means that ejabberd should *not* differentiate between the vhosts in regard of the storage. Is this possible?

What you imagined is what will happen because in ejabberd, mod_roster and the other modules store in Mnesia the information using as key username+vhost. Interestingly, mod_roster_odbc and the other ODBC modules use as key only the username, not the vhost.

I think you have at least two solutions:

1. Forget about jabber.example.com, and use only the new example.com. Dump the mnesia database to text file, and rewrite in it the vhost. Then clean the Mnesia database, and load the modified text file.

2. Migrate the Mnesia content to ODBC storage, and use the ODBC modules. Then configure both vhosts for using the same database. In this way you are taking benefit of a specific feature in ejabberd.

Note: I think in ejabberd 3.0.0 the trick 2. will not work, because both Mnesia and ODBC will use as key username+vhost.

Thank you!

Hi badlop!

badlop wrote:

What you imagined is what will happen because in ejabberd, mod_roster and the other modules store in Mnesia the information using as key username+vhost. Interestingly, mod_roster_odbc and the other ODBC modules use as key only the username, not the vhost.

I think you have at least two solutions:

1. Forget about jabber.example.com, and use only the new example.com. Dump the mnesia database to text file, and rewrite in it the vhost. Then clean the Mnesia database, and load the modified text file.

2. Migrate the Mnesia content to ODBC storage, and use the ODBC modules. Then configure both vhosts for using the same database. In this way you are taking benefit of a specific feature in ejabberd.

Note: I think in ejabberd 3.0.0 the trick 2. will not work, because both Mnesia and ODBC will use as key username+vhost.

Thank you very much for this information and the possible solution you pointed out. I will investigate what option is the best one for this case.

Gollo

Syndicate content