Hi all,
another post about migration :). I found a lot of stuff on internet, so I though.. ok, that would be easy. But I got into some problems and I don't know why.
1) I stop old ejabberd
2) tar all files under /var/lib/ejabberd/spool/
3) move them to new server
4) edit /etc/ejabberd/ejabberdctl.cfg to start with old hostname
5) ejabberd started OK, I did backup thru ejabberdctl backup /path/to/file.bak
6) then I found, I can change node name, so run ejabberdctl mnesia_change_nodename ejabberd@old ejabberd@new /path/to/file.bak /path/to/file_newhostname.bak
7) stop new ejabberd
8) removed all under /var/lib/ejabberd/
9) start clean ejabberd server with new hostname
10) run ejabberd restore /path/to/file_newhostname.bak
And here I got an errror: "Can't restore backup from "/path/to/file_newhostname.bak" at node ejabberd@localhost: Table config does not exist."
Any ideas? :)
Btw. here is a log from mnesia_change_nodename run:
* Checking table: 'roster'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'shaper'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'route_multicast'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'vcard'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
* Checking table: 'pubsub_node'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'muc_online_room'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'irc_custom'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'mod_register_ip'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'session_counter'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 's2s'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'ejabberd_commands'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'muc_registered'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'temporarily_blocked'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'passwd'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'iq_response'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'pubsub_state'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'local_config'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'privacy'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'acl'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'muc_room'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'pubsub_item'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
* Checking table: 'oauth_token'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'sr_group'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'caps_features'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
* Checking table: 'access'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'motd'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'private_storage'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
* Checking table: 'route'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'offline_msg'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
* Checking table: 'pubsub_last_item'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'session'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'roster_version'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'pubsub_subscription'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'schema'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'sr_user'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'reg_users_counter'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'motd_users'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'http_bind'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
* Checking table: 'config'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'vcard_search'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'pubsub_index'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'last_activity'
+ Checking key: 'ram_copies'
+ Checking key: 'disc_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_only_copies'
* Checking table: 'carboncopy'
+ Checking key: 'ram_copies'
- Replacing nodename: 'ejabberd@mail' with: 'ejabberd@localhost'
+ Checking key: 'disc_copies'
+ Checking key: 'disc_only_copies'
PS: any idea what following error means?
ejabberd_1 | 01:58:50.558 [error] transaction return internal error: {aborted,{bad_type,{pubsub_state,{{<<>>,<<"pubsub.domain.net">>,<<>>},13},[],owner,[]}}}
ejabberd_1 | 01:58:50.561 [error] transaction return internal error: {aborted,{bad_type,{pubsub_state,{{<<>>,<<"pubsub.domain.net">>,<<>>},13},[],owner,[]}}}
First of all, you can simply
First of all, you can simply stop at step 5; after all, ejabberd works correctly, and using a forced erlang node name doesn't hurt. But it's good to attempt to know where the problem is, so let's continue.
Second, I guess in step 9 you edit ejabberdctl.cfg again to set the newhostname.
Third, the problem is that the backup file contains a mnesia table called "config", which was used in ejabberd 2. Nowadays that table is stored in ETS, per vhost, so it isn't required at all.
I can think this solution, split 5 in all those small steps:
5.1 Start ejabberd in live mode, so you get an erlang shell
5.2 Check ejabberd starts correctly, converts the old database, etc.
5.3 In that erlang shell, execute this (remember the dot a the end): mnesia:delete_table(config).
5.4 Backup the database as usual: ejabberdctl backup /path/to/file.bak
Now you can proceed with step 6.
Notice you can repeat step 5.3 if it complains about other tables.
Fourth, if you try this solition, please tell me if it really works, so that I update the explanations in https://docs.ejabberd.im/admin/guide/managing/#change-computer-hostname