Migrate mail users from one ispconfig3 server to another

Discussion in 'General' started by grungy, Jun 14, 2010.

  1. grungy

    grungy Member HowtoForge Supporter

    I want to migrate mail users for a SINGLE domain from one ispconfig3 server to another. I do not want to do it manually by entering all mail users one by one. What is the best way of doing this?

    If I use mysqldump and import mail_users to the new server will ispconfig create the accounts in /var/vmail/ ?

    I used mysqldump like this:

    Code:
    mysqldump -u root -p dbispconfig mail_user
    --where="sys_groupid='30'";
    and I will only use the line that begins with

    Code:
    -- -- Dumping data for table `mail_user` -- -- WHERE:  sys_groupid='30'
    Do I have to manually change the IDs? maybe use some replace option since mysqldump supports it?
     
  2. vogelor

    vogelor ISPConfig Developer ISPConfig Developer

    dont do it!!!!

    NO! this is because of the way, the servers share their data. if you dump the new data to this table, all the other servers didn't know anything about this change and so they WILL NOT do anything.

    You can only add them manually or with the remote-api but NEVER direct. You will destroy your Installation
     
  3. grungy

    grungy Member HowtoForge Supporter

    What if I create the users manually and then import the data?

    I would change the user ids etc....
     
  4. vogelor

    vogelor ISPConfig Developer ISPConfig Developer

    Sorry, i would like to help you, but there is NO WAY.
    This is because of the "ISPConfig 3 multiserver - kernel"
     
  5. grungy

    grungy Member HowtoForge Supporter

    vogelor,

    Why is the multiserver kernel thing relevant to this discussion? My two servers are not linked - they are not in a multiserver environment.
     
  6. vogelor

    vogelor ISPConfig Developer ISPConfig Developer

    not 100% true, but to understand:

    INTERALL we have:
    1) the master -> the interface where you do your setup
    2) n clients -> doing everything, the interface told them

    this means, you have only ONE hardware, but INTERN you have 1 master (interface) and 1 client doing the email setup.

    if you change the tables by your own, you only change the data, the interface displays BUT you do not tell the client to do the setup, this can only be done by the interface! if you edit the interface, the new data is stored in the tables AND the client gets a "command" to do what you change.

    again, this is not 100% the truth, but "real enough" to understand the problem in short...

    Olli
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Additionally to that what Olli (vogelor) said, migrating a complete install is possible when you copy the config files, maildirs, websites, ispconfig users in /etc/passwd, shadow, group and gshadow as well as the ispconfig database to the new server. But copying only the database will not work for the reasons that Olli explained.
     
  8. grungy

    grungy Member HowtoForge Supporter

    Thanks for the info. My plan was to:

    1. Manually add a domain to the second server
    2. Manually open email accounts on the second server
    3. Export only mail_users for that domain from the first server
    4. Change the IDs so that they match the IDs on the second server
    5. Import the mysql dump for the mail_users for that domain on the second server
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    This will not work as vogelor pointed out, ispconfig needs a record in sys_datalog for every chnage that shall be written to disk. To create these records (they can not be copied from another server), you have to use the internal ispconfig database functions or the remoting API.

    What is the benefit in importing the mysql dump after you created the users?

    What you might do is this:

    1) Copy the complete ispconfig database to the new server.
    2) Copy the complete /var/vmail directory to the new server (with preserverd permissions).
    3) Delete all email domains that you dont need from within ispconfig.
     
  10. grungy

    grungy Member HowtoForge Supporter

    I guess this way I will migrate the passwords.
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Then better try what I added to the above post #9.
     
  12. grungy

    grungy Member HowtoForge Supporter

    Ok thanks.

    Can I migrate DNS entries from one server to another? I guess this could work since mydns is purely database driven?
     

Share This Page