master-master replication of the mailserver managed by ISPConfig

Discussion in 'General' started by ovredsson, Aug 31, 2009.

  1. ovredsson

    ovredsson New Member

    Hi,
    I have ispconfig 3 running on one machine and want to take a backup.

    How do i do that ?

    I have a new machine with a clean ispconfig 3. I want to restore the backup to this one:confused: .

    Sql, Mail, user data everything needs to be in the backup.

    //Peter
     
    Last edited: Aug 31, 2009
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I have not tested this yet, but the basic steps are as follows:

    1) Mkake a backup of the ispconfig database on the new server.
    2) copy the ispconfig database from the old server to the new server.
    3) copy the lines with the web* users from the /etc/passwd and /etc/shadow file to the new server. Do the same with the cliant* groups in /etc/group file.
    4) Copy the /var/vmail folder to the new server. Make sure that you preserver the permissions e.g. by storing the files and folders with

    tar pcfz vmail_backup.tar.gz /var/vmail

    ond the old server and then unpacking them on the new server.
    5) Do the same with the websites in /var/www (or /srv/www if you use opensuse).
    6) Migrate the website databases to the new server.
     
  3. ovredsson

    ovredsson New Member

    Thank you!

    I will try this !
     
  4. voltron81

    voltron81 New Member

    Hi,
    Do you think that procedure will work also with a script who make an exact copy of the primary one?
    As I wrote in another post (but at the moment I haven't receive yet answer), I need to replicate the mail server, so that the primary test crash, I can use the backup one...
    I tried the expert mode installation of ISPConfig, but in that way I can just connect the secondary server to the ISPConfig database of the primary server... and it's not what I need, because if the primary server crash, the second one is not working at all.

    So, reading this post, I was thinking to create a kind of script who just copy the important configuration files of ISPConfig to the secondary server (let's say every 5 seconds), so I will have exatly the copy of the primary server.
    Do you think it's a good idea?

    I can imagine that there are at least 2 problems:
    1)find the way to skip automaticaly to the second server if the first one is not working properly.
    2)if for example the first server crash after an error in the database, I don't want to have a copy of that error in the second server... (I don't know if this point is really important).

    Any idea?
    Thanks

    Michele
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

  6. voltron81

    voltron81 New Member

    Hi Till,
    thank you very much for your suggestion.
    I'll try to solve the problem in the way that you told me.
    Just another question: what about this point?
    Thanks
    Michele
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    This is only nescessary for servers which host websites too and not for mail servers.
     
  8. voltron81

    voltron81 New Member

    Great!

    So I have to mount this new distributed storage in /var/vmail(I've to create a server-client side in each server), install ISPConfigin in both servers and after use mysql replication and it should work, right?

    Sorry, but I don't have a lot of experience... I'm just discovering a new world... :)

    Regards
    Michele
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, that should work. But please do not use the ispconfig interface on the second server as it will cause conflicts with the data replication.
     
  10. voltron81

    voltron81 New Member

    Last edited: Sep 2, 2009
  11. voltron81

    voltron81 New Member

    At the moment I'm quite confusing...
    First of all the documentation for Distributed Replicated Storage said that I've to create a file names: /etc/glusterfs/glusterfs-server.vol on the server side and one names: /etc/glusterfs/glusterfs-client.vol on the client side.
    But if I'm doing like that, Gluster is not working.
    He miss the file: /etc/glusterfs/glusterfs.vol that is exatly the file that the howtoguide(http://www.howtoforge.com/high-avai...c-file-replication-across-two-storage-servers) edit.
    So I'm going through this howto and I install without problem Gluster (I'm using Centos 5 minimal).

    to be honest, now the major problem is understand in which way I've to edit that files.
    I think that the 2 servers must have server and client side both, but I'm not so sure.
    And even if I'm right, I'm not so sure of how to modify this configuration files.

    Suggestions?
    Really thanks

    Michele
     
  12. voltron81

    voltron81 New Member

    Ok a fast upgrade.
    At the moment I've realized a client-server configuration and it's working fine (I'm trying just editing some files, no ISPConfig yet).
    Basically server1 is the server and server2 is the client and when are both up, I've a syncronized folder (/var/vmail). So if one of them write something, the other is syncronized.
    But if server1 crash, on the server2 the folder /var/vmail is dismounted and there are no files anymore. Server2 have to wait server1 to be operative again.
    This is the GlusterFS configuration that I have used:
    Code:
    # SERVER FILE
    volume posix
            type storage/posix
            option directory /var/vmail
    end-volume
    
    volume locks
            type features/locks
            subvolumes posix
    end-volume
    
    volume brick
            type performance/io-threads
            option thread-count 8
            subvolumes locks
    end-volume
    
    volume server
            type protocol/server
            option transport-type tcp
            option auth.addr.brick.allow *
            subvolumes brick
    end-volume
    
    Code:
    # CLIENT FILE
    volume remote1
            type protocol/client
            option transport-type tcp
            option remote-host ***.***.***.***
            option remote-subvolume brick
    end-volume
    
    So I'm thinking now to just invert server1 and server2, so that I will have both directions:

    • server1=server
      server2=client

      server1=client
      server2=server

    Do you think it's a good idea?
    Suggestions?

    thanks

    Michele
     
  13. voltron81

    voltron81 New Member

    Ok I think I've got it!

    I've replicated the mysql database and the folder /var/vmail and seems to work fine.

    Now I'll test a bit... let's see what's happen...
    :)
     
  14. voltron81

    voltron81 New Member

    An update of the tests (hoping that somebody give me some suggestions...)

    When the 2 servers are online, they work just fine:

    -I can create email and domains from both without problem.
    -I check the webmail with roundcube in both.

    If the primary server is down, I have a problem with Glusterfs: I can't mount /var/vmail.
    That is really strange, because I tried the Glusterfs configuration sharing a /tmp/test directory and it was working even with the main server was down!
    To configure Glusterfs, I've used this how-to: http://www.howtoforge.com/high-availability-storage-cluster-with-glusterfs-on-ubuntu

    Somebody could tell me what is wrong?
    Thanks
    Michele

    PS: I'm trying to test this configuration now with a real server and a vmware server, because the other server that I've at home is unaccessible...thanks virgin!!!
     
    Last edited: Sep 8, 2009
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    But does glusterfs work if the share is already mounted and you turn off the primary server then?
     
  16. voltron81

    voltron81 New Member

    I've added glusterfs client in fstab and glusterfsd server in /rc2.d, so they start when you switch on the 2 servers.

    It's working fine, but if, after that the 2 servers are working for a bit, you shutdow the primary server, the second server is not more able to enter in /var/vmail.

    Before installed ISPconfig, I was trying the glusterfs configuration sharing another folder and just writing some files from both servers, and it was working just fine. Even if one of the 2 servers was down, was not a problem for the other one at all.
    So I could imagine that there is a problem with permissions or something like that.

    What do you think about that?
    Thanks
    Michele
     
  17. voltron81

    voltron81 New Member

    Well now I'm at the point that ISPConfig doesn't write nothing to /var/vmail.
    This are the permissions for that folder:
    drwxr-xr-x 11 vmail root 4096 Sep 14 10:09 vmail

    Anyway, now that ISPConfig is not able to write into /var/vmail (I create a new email, and I can't find the folder releated with that email), glusterfs is working fine... primary server is down, and I still can enter in /var/vmail.

    Which are the right permissions for that folder?
    Thanks
    MiK
     
    Last edited: Sep 14, 2009
  18. voltron81

    voltron81 New Member

    No suggestions? :D
     
  19. giftsnake

    giftsnake New Member

    permissions on my box:

    Code:
    # ls -la /var | grep vmail
    drwxr-xr-x  5 vmail vmail 4.0K 2009-09-13 05:58 vmail
     
  20. voltron81

    voltron81 New Member

    So the only difference is the "group name", that in your configuration is vmail and in mine is root.
    I don't think I can change if with the command:

    chown -R root:root /var/vmail

    because it's not a normal folder, but a mount folder.

    I think I have to write this permission at the time that i mount that folder (in my case into fstab).
    What do you think?

    Anyway at the moment this is my situation:
    When SERVER1 and SERVER2 are up, the mail services are working; the /var/vmail folder is consistent and ISPConfig and Postfix are able to write in that folder. The mysql replication work just fine.
    When SERVER1 crash (i switch off it) happens that:
    • now /var/vmail is accessible from SERVER2, I can see that there are all the files of the emails. But when I try to check an email from Roundcube of SERVER2, I can enter into the email but it's look like there are no email stored.
    • If I try to send an email it's sent, but roundcube webpage is blocked in "sending message" mode. I can see that in "sent folder" there is no trace of this sent. The same happens even when SERVER1 is on. I guess it's because Postfix can't have a permission to write in /var/vmail
    • If I send an email to one mail managed by the mailserver and I try to check the email from Roundcube, I can't find it. But if I switch on now the SERVER1 and check that email from Roundcube webpage of SERVER1, I can see all the emails, even the one that was received when SERVER1 was off. Even with SERVER1 on, from Roundcube webpage from SERVER2, I can't find any email

    So any suggestions?
    Thanks
    Michele
     
    Last edited: Sep 15, 2009

Share This Page