Include a script and documentation for switching to the MAM module shipped with ejabberd 15.06 and newer.
mod_mam_mnesia
Current Status
This module is deprecated.
ejabberd 15.06 and newer ships a mod_mam module which supports Mnesia
and SQL/ODBC storage. It is recommended to use that module, as
mod_mam_mnesia is no longer supported. Existing mod_mam_mnesia
tables can be imported into mod_mam using the import-mam-archives
script, as described below.
Migrating to mod_mam
You might want to log off your users during the migration. However, note that importing the MAM archives might take up to a few hours.
Also note that with mod_mam, the total size of all MAM archives cannot
exceed 2 GB. The delete_old_mam_messages command could be run
periodically to make sure the Mnesia data won't grow beyond that limit.
To support larger archives, SQL/ODBC storage must be used.
-
In your ejabberd.yml file, replace
mod_mam_mnesiawithmod_mam, and adjust the configuration of that module.mod_mamsupports a different set of options, so you should check the documentation. Since ejabberd 16.02,mod_mamsupports therequest_activates_archivingoption, but it's not enabled by default. To mimicmod_mam_mnesia's default behavior, you could configuremod_mamlike this:modules: mod_mam: default: always request_activates_archiving: true -
Check the node name of your server by running
ejabberdctl status. If the name is notejabberd@localhost, you must replace thelocalhostpart of the two node names at the top of the script with the host name part of your ejabberd node. -
The
import-mam-archivesscript removes themod_mam_mnesiatables after importing them intomod_mam. Therefore, you should take a backup of your MAM archives (and the other Mnesia data) by running a command such as:ejabberdctl dump $HOME/ejabberd-backup.dat -
Download and run the import script:
chmod +x import-mam-archives ./import-mam-archivesIf only the messages stored during the last
Ndays should be imported, run./import-mam-archives Ninstead. -
Restart ejabberd.