Search code examples
ejabberd

ejabberd migrate users from one domain to other domain


I have ejabberd 21 working with more than a million users with their chat history. I want to migrate all user to new domain / host name as per new business requirement. What is the appropriate method?


Solution

  • There is no tool in ejabberd for that, and I am not aware of any other external tool to do that. But you can do it manually.

    If you are using a SQL database for authentication and storing rosters, offline messages, etc...

    1. just stop ejabberd,
    2. dump SQL to a text file,
    3. replace one hostname with the new one in that text file,
    4. then create a new database, configure ejabberd to use it
    5. and import the new text file.

    Or maybe you have the skills to perform this replacement in SQL directly.

    If you are using the internal Mnesia database, the method is similar:

    1. Dump the mnesia database to a text file using "ejabberdctl dump", or using the ejabberd WebAdmin
    2. Replace old hostname with new in that text file
    3. Stop ejabberd
    4. Move to a safe place the mnesia spool dir
    5. Start ejabberd. It will generate a new empty mnesia database
    6. Load the new text file with "ejabberdctl load". Or register a new account, grant admin rights in ejabberd.yml so you can use it to login to WebAdmin to load the text file.