1 (edited by r0den 2018-06-19 20:04:08)

Topic: Migration from old iredmail instances to the new one

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.7 MARIADB edition
- Linux/BSD distribution name and version: CentOS Linux release 7.4.1708 (Core)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello All,

I want to migrate from two old iRedMail instances (0.8.7) to the new one (0.9.7).
How can I migrate from both old instances to the new one?
I found https://docs.iredmail.org/migrate.to.ne … erver.html but it seems shows only migration from one instance.
Also I was not able to import MySQL DB from old instance, do we need to restore whole dump or some tables only?
While db import from old db, get following errors:
ERROR 1048 (23000) at line 24: Column 'active' cannot be null
ERROR 1136 (21S01) at line 34: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 35: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 36: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 37: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 38: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 39: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 40: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 41: Column count doesn't match value count at row 1
.....
ERROR 1136 (21S01) at line 998: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 999: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 1000: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 1001: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 1002: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 1003: Column count doesn't match value count at row 1
ERROR 1136 (21S01) at line 1004: Column count doesn't match value count at row 1

Not sure which approach is suitable for me.
Any suggestions are much appreciated.

Thans,
Roden

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Migration from old iredmail instances to the new one

For migrating mail accounts, you can try this:

- Export "vmail" db on old server
- On NEW server, create a new sql db, for example, 'temp'
- Import "vmail" db you expected on old server to "temp" db on new server.
- Run all SQL related upgrade steps mentioned in iRedMail upgrade tutorials for your old iRedMail release. FYI: https://docs.iredmail.org/iredmail.releases.html
- Run MySQL command like "INSERT INTO vmail.<table> (...) SELECT ... FROM temp.<table>" to migrate every sql tables in "temp" db.
- Repeat above steps for another old iRedMail server.

3

Re: Migration from old iredmail instances to the new one

ZhangHuangbin wrote:

For migrating mail accounts, you can try this:

- Export "vmail" db on old server
- On NEW server, create a new sql db, for example, 'temp'
- Import "vmail" db you expected on old server to "temp" db on new server.
- Run all SQL related upgrade steps mentioned in iRedMail upgrade tutorials for your old iRedMail release. FYI: https://docs.iredmail.org/iredmail.releases.html
- Run MySQL command like "INSERT INTO vmail.<table> (...) SELECT ... FROM temp.<table>" to migrate every sql tables in "temp" db.
- Repeat above steps for another old iRedMail server.

Thanks @ZhangHuangbin
Seems it works.

4

Re: Migration from old iredmail instances to the new one

I also had some difficulties migrating from an old server to a new one. The new server ran without problems until I had imported the old data via SQL dumps and Maildir syncs.

In the end, it was easiest to manually reconfigure the users, copy the calendars and contacts via the Sogo Export function and move the emails via imapsync. Now everything runs flawlessly.

5

Re: Migration from old iredmail instances to the new one

ZhangHuangbin wrote:

For migrating mail accounts, you can try this:

- Export "vmail" db on old server
- On NEW server, create a new sql db, for example, 'temp'
- Import "vmail" db you expected on old server to "temp" db on new server.
- Run all SQL related upgrade steps mentioned in iRedMail upgrade tutorials for your old iRedMail release. FYI: https://docs.iredmail.org/iredmail.releases.html
- Run MySQL command like "INSERT INTO vmail.<table> (...) SELECT ... FROM temp.<table>" to migrate every sql tables in "temp" db.
- Repeat above steps for another old iRedMail server.

Hello @ZhangHuangbin,

I noticed that after migration domain admins list from old db to new iRedMail instance it is not showing in web UI.
Is this expected?

6

Re: Migration from old iredmail instances to the new one

r0den wrote:

I noticed that after migration domain admins list from old db to new iRedMail instance it is not showing in web UI.
Is this expected?

It's not expected. it's very possible that the data in your sql db is not correct.

7

Re: Migration from old iredmail instances to the new one

That's strange.

When I check domain_admins table I get several entries from new instance and from migrated.
But when I open admin lists in UI only one admin there from native instance.
Also I tried to migrate data only for domain_admins table and still the same issue.
Creating admin via UI creates needed entry in DB and it is present in admins tab.

Screenshots attached.

Post's attachments

up1Capture.PNG
up1Capture.PNG 41.11 kb, file has never been downloaded. 

up2Capture.PNG
up2Capture.PNG 56.03 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

8

Re: Migration from old iredmail instances to the new one

Do all addresses in "domain_admins" table also exists in "mailbox" OR "admin" table?

9 (edited by r0den 2018-06-27 22:58:28)

Re: Migration from old iredmail instances to the new one

ZhangHuangbin wrote:

Do all addresses in "domain_admins" table also exists in "mailbox" OR "admin" table?

They exists only in mailbox table and some of them are marked as Gloabal admins (have '1' value for respective column).
I checked in old instance and verified that admin table is also empty as in new instance.

I tried to add imaginary email as admin and it is appeared in admin and domain_admins tables.

Not sure if I missed something. Seems everything was done correctly.
Is there a doc with description of db tables?

10

Re: Migration from old iredmail instances to the new one

You can try to revoke the admin privilege for existing admin first, then enable them as admin again. iRedAdmin-Pro should help fix incorrect sql records this way.

11

Re: Migration from old iredmail instances to the new one

ZhangHuangbin wrote:

You can try to revoke the admin privilege for existing admin first, then enable them as admin again. iRedAdmin-Pro should help fix incorrect sql records this way.

Yes, re-enabling of privileges  fixed issue.
Also is it possible to migrate iredamin-pro panel to new iredmail instance?

12

Re: Migration from old iredmail instances to the new one

r0den wrote:

Also is it possible to migrate iredamin-pro panel to new iredmail instance?

Sure. Copy the whole iRedAdmin-Pro directory to, e.g. /root/, then enter /root/iRedAdmin-Pro-<version>/tools/, run "bash upgrade_iredadmin.sh". Then, remove iRedAdmin-Pro on old server (this is required, otherwise you're running one license on 2 servers, this is not allowed according to our license term - which is accepted by you).

13

Re: Migration from old iredmail instances to the new one

ZhangHuangbin wrote:
r0den wrote:

Also is it possible to migrate iredamin-pro panel to new iredmail instance?

Sure. Copy the whole iRedAdmin-Pro directory to, e.g. /root/, then enter /root/iRedAdmin-Pro-<version>/tools/, run "bash upgrade_iredadmin.sh". Then, remove iRedAdmin-Pro on old server (this is required, otherwise you're running one license on 2 servers, this is not allowed according to our license term - which is accepted by you).

Great. Will do at the end of migration. Thanks.

14

Re: Migration from old iredmail instances to the new one

For now I'm on following step, regarding migration iRedMail (0.8.7) to new iRedMail (0.9.7) in another server:

> Migrate Amavisd, iRedAPD, iRedAdmin databases

And for some reason I don't have mysql root password.
Since this is old version there is no /root/my.cnf file and passwords mentioned in backup_mysql.sh, iRedMail.tips are incorrect.
Is it safe to reset mysql root password? I'm not sure if root password is used in somewhere related to iRedmail.

15

Re: Migration from old iredmail instances to the new one

r0den wrote:

Is it safe to reset mysql root password? I'm not sure if root password is used in somewhere related to iRedmail.

It's safe, just used by the backup script.

16

Re: Migration from old iredmail instances to the new one

Hello ZhangHuangbin,

Is it possible to skip migration of old Amavisd, iRedAPD, iRedAdmin databases from old iRedMail instances to new one?
Since I have two old instances it seems that I have to merge them and import. And I'm wondering, how important these steps. As for me it seems I can skip it without impact since I already have mailboxes and mail accounts, am I right?

17

Re: Migration from old iredmail instances to the new one

r0den wrote:

Is it possible to skip migration of old Amavisd, iRedAPD, iRedAdmin databases from old iRedMail instances to new one?

- For Amavisd database, read this tutorial for more details: https://docs.iredmail.org/amavisd.sql.db.html
it's ok if you don't have any whitelists/blacklists, spam policy (or you don't want to migrate these settings)

- Better migrate iRedAPD database.
- iRedAdmin stores log of admin login/operation activities, paths of deleted mailboxes (LDAP edition).