I'm trying to establish a procedure for restoring my database from a crashed server to a new server. My server is running Ejabberd as an XMPP server, and I configured it to use postgresql instead of mnesia - or so I thought.
My procedure goes something like "dump the contents of the original DB, run the new server, restore the contents of the DBs using psql, then run the system". However, when I try running Ejabberd again I get a crash:
=CRASH REPORT==== 3-Dec-2010::22:05:00 ===
crasher:
pid: <0.36.0>
registered_name: []
exception exit: {bad_return,{{ejabberd_app,start,[normal,[]]},
{'EXIT',"Error reading Mnesia database"}}}
in function application_master:init/4
Here I was thinking that my system is running on PostgreSQL, while it seems I was still using Mnesia. I have several questions:
- How can I make sure mnesia is not being used?
- How can I divert all the ejabberd activities to PGSQL?
This is the modules part in my ejabberd.cfg file:
{modules,
[
{mod_adhoc, []},
{mod_announce, [{access, announce}]}, % requires mod_adhoc
{mod_caps, []},
{mod_configure,[]}, % requires mod_adhoc
{mod_ctlextra, []},
{mod_disco, []},
{mod_irc, []},
{mod_last_odbc, []},
{mod_muc, [
{access, muc},
{access_create, muc},
{access_persistent, muc},
{access_admin, muc_admin},
{max_users, 500}
]},
{mod_offline_odbc, []},
{mod_privacy_odbc, []},
{mod_private_odbc, []},
{mod_pubsub, [ % requires mod_caps
{access_createnode, pubsub_createnode},
{plugins, ["default", "pep"]}
]},
{mod_register, [
{welcome_message, none},
{access, register}
]},
{mod_roster_odbc, []},
{mod_stats, []},
{mod_time, []},
{mod_vcard_odbc, []},
{mod_version, []}
]}.
What am I missing?
I am assuming the crash is due to the mnesia DB being used by Ejabberd, and since it's out of sync with the PGSQL DB, it cannot operate correctly - but maybe I'm totally off track here, and would love some direction.
EDIT: One problem solved. Since I'm using amazon cloud, I needed to hardcode the ERLANG_NODE so it won't be defined by the hostname (which changes on reboot). This got my ejabberd running, but still I wish to stop using mnesia, and I wonder what part of ejabberd is still using it and how can I found it.
I've personally learnt some about ejabberd this last week.
If you are running any DB other than mnesia, then not all modules that you have running will actually communicate with it.
For instance, mod_admin_extra will continue to work with the mnesia db, even after you have configured the server to work with postgress. So if you're doing alot of your adding/removing roster/users via the extra commands that mod_admin_extra provide (and other modules), then you're going to have to find some other way to do it.
Basically, there is no way to have ejabberd stop using the mnesia db at all, it will always use it for some sort of processing.
Looks like you missed one of the modules that need to be renamed with _odbc on them, namely mod_pubsub _> mod_pubsub_odbc
See here
It might also be worth looking through the /var/lib/ejabberd directory and just looking to see what DCD/DCL files there are, for as far as I understand, these files are the db files for mnesia. You can then try and figure out if there are any other modules that need to be configured to point to MySQL.
Depending on your application, there is a great chance that you don't need 90% of the modules listed in your ejabberd.cfg file. The most basic ones:
- mod_roster_odbc
- mod_offline_odbc
- mod_register
For more ejabberd tips see:
来源:https://stackoverflow.com/questions/4350311/how-to-stop-ejabberd-from-using-mnesia