Multi Server H/A POP boxs

Discussion in 'Installation/Configuration' started by Fr0sty, Jan 30, 2009.

  1. Fr0sty

    Fr0sty New Member

    Ok i want/need a HA setup for pop boxs and apache. so all requests come into a public ip and the router/firewall then passes that to one of x servers in the group, So if a box fails its just a case forwarding the traffic to the lowest load box. The traffic routing isnt a problem the mailboxs are.

    I have setup a vanilla install of ISPConfig 3 RC1 on ubuntu 8.10 base without any real problems and obviously need to setup another (The aim is for 4)

    Now HA with apache is fairly easy just sync the site dbs apache/config and contents (unless im missing something)

    my problem lies in
    A: Syncing the pop user (ISPConfig added) database between all servers in the group

    B: Making all the mailboxs available on all servers and in sync

    now i think i have a way of syncing the mailboxs (once created) using imapsync from a script using a csv for the user passwords (security?)

    I just need a way of only having to enter new users sites etc on one of the ISPConfig servers.

    If you spot a glaring hole in this plan please stop me now :) If there is a way to automate this as much as possible i am more than open to suggestions

    Fr0sty
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Just create one master server in ispconfig 3 and add all other servers as additional servers. The edit the file /usr/local/ispconfig/server/lib/config.inc.php on all slave servers and set the server_id to the same Id then the master server (most likely server_id = 1) so that all other servers replicate the configuration done on the master server. Then delete all entrys in the server database table except of the entry for the master server.
     
  3. Fr0sty

    Fr0sty New Member

    First thx for the reply

    this sounds like the perfect answer to my problem
    i am having a few issues with virtual users in pop3 first i need to iron out but will start a new thread.


    Fr0sty
     
  4. Fr0sty

    Fr0sty New Member

    right i think i have followed your instructions right i have installed master working fine attached a slave

    Then edited /usr/local/ispconfig/server/lib/config.inc.php on the slave and set its server id to 1 (same as the master)

    Removed the entry in the master db for the slave server

    Code:
    mysql> SELECT * FROM `server` LIMIT 0, 30 ;
    +-----------+------------+-------------+---------------+----------------+----------------+---------------------+-------------+------------+------------+-------------+-----------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+
    | server_id | sys_userid | sys_groupid | sys_perm_user | sys_perm_group | sys_perm_other | server_name         | mail_server | web_server | dns_server | file_server | db_server | vserver_server | config                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | updated | active |
    +-----------+------------+-------------+---------------+----------------+----------------+---------------------+-------------+------------+------------+-------------+-----------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+
    |         1 |          1 |           1 | riud          | riud           | r              | master.wkdr3d.co.uk |           1 |          1 |          1 |           1 |         1 |              1 | [global]
    webserver=apache
    mailserver=postfix
    dnsserver=mydns
    
    [server]
    auto_network_configuration=n
    ip_address=192.168.0.105
    netmask=255.255.255.0
    gateway=192.168.0.1
    hostname=server1.domain.tld
    nameservers=192.168.0.1,192.168.0.2
    
    [mail]
    module=postfix_mysql
    maildir_path=/var/vmail/[domain]/[localpart]
    homedir_path=/var/vmail
    mailuser_uid=5000
    mailuser_gid=5000
    mailuser_name=vmail
    mailuser_group=vmail
    relayhost=
    relayhost_user=
    relayhost_password=
    mailbox_size_limit=0
    message_size_limit=0
    
    [getmail]
    getmail_config_dir=/etc/getmail
    
    [web]
    website_path=/var/clients/client[client_id]/web[website_id]
    website_symlinks=/var/www/[website_domain]/:/var/clients/client[client_id]/[website_domain]/
    vhost_conf_dir=/etc/apache2/sites-available
    vhost_conf_enabled_dir=/etc/apache2/sites-enabled
    
    [fastcgi]
    fastcgi_starter_path=/var/www/php-fcgi-scripts/[system_user]/
    fastcgi_starter_script=.php-fcgi-starter
    fastcgi_alias=/php/
    fastcgi_phpini_path=/etc/php5/cgi/
    fastcgi_children=8
    fastcgi_max_requests=5000
    fastcgi_bin=/usr/bin/php-cgi
    
    [jailkit]
    jailkit_chroot_home=/home/[username]
    jailkit_chroot_app_sections=basicshell editors extendedshell netutils ssh sftp scp groups jk_lsh
    jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico
    
     |      24 |      1 | 
    +-----------+------------+-------------+---------------+----------------+----------------+---------------------+-------------+------------+------------+-------------+-----------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+
    1 row in set (0.00 sec)
    
    

    And the same query on the slave

    Code:
    Database changed
    mysql> SELECT * FROM `server` LIMIT 0, 30 ; 
    +-----------+------------+-------------+---------------+----------------+----------------+---------------------+-------------+------------+------------+-------------+-----------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+
    | server_id | sys_userid | sys_groupid | sys_perm_user | sys_perm_group | sys_perm_other | server_name         | mail_server | web_server | dns_server | file_server | db_server | vserver_server | config                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | updated | active |
    +-----------+------------+-------------+---------------+----------------+----------------+---------------------+-------------+------------+------------+-------------+-----------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+
    |         1 |          1 |           1 | riud          | riud           | r              | master.wkdr3d.co.uk |           1 |          1 |          1 |           1 |         1 |              1 | [global]
    webserver=apache
    mailserver=postfix
    dnsserver=mydns
    
    [server]
    auto_network_configuration=n
    ip_address=192.168.0.105
    netmask=255.255.255.0
    gateway=192.168.0.1
    hostname=server1.domain.tld
    nameservers=192.168.0.1,192.168.0.2
    
    [mail]
    module=postfix_mysql
    maildir_path=/var/vmail/[domain]/[localpart]
    homedir_path=/var/vmail
    mailuser_uid=5000
    mailuser_gid=5000
    mailuser_name=vmail
    mailuser_group=vmail
    relayhost=
    relayhost_user=
    relayhost_password=
    mailbox_size_limit=0
    message_size_limit=0
    
    [getmail]
    getmail_config_dir=/etc/getmail
    
    [web]
    website_path=/var/clients/client[client_id]/web[website_id]
    website_symlinks=/var/www/[website_domain]/:/var/clients/client[client_id]/[website_domain]/
    vhost_conf_dir=/etc/apache2/sites-available
    vhost_conf_enabled_dir=/etc/apache2/sites-enabled
    
    [fastcgi]
    fastcgi_starter_path=/var/www/php-fcgi-scripts/[system_user]/
    fastcgi_starter_script=.php-fcgi-starter
    fastcgi_alias=/php/
    fastcgi_phpini_path=/etc/php5/cgi/
    fastcgi_children=8
    fastcgi_max_requests=5000
    fastcgi_bin=/usr/bin/php-cgi
    
    [jailkit]
    jailkit_chroot_home=/home/[username]
    jailkit_chroot_app_sections=basicshell editors extendedshell netutils ssh sftp scp groups jk_lsh
    jailkit_chroot_app_programs=/usr/bin/groups /usr/bin/id /usr/bin/dircolors /usr/bin/lesspipe /usr/bin/basename /usr/bin/dirname /usr/bin/nano /usr/bin/pico
    
     |       0 |      1 | 
    +-----------+------------+-------------+---------------+----------------+----------------+---------------------+-------------+------------+------------+-------------+-----------+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+--------+
    1 row in set (0.00 sec)
    
    
    Added some domains and email accounts on the master then watched them leave the job queue but they dont get replicated

    Any ideas?
     
  5. falko

    falko Super Moderator Howtoforge Staff

    I think you should have deleted the records on the slave, not the master.
     
  6. Fr0sty

    Fr0sty New Member

    The server table in the slave db only contained its own record ? with server id of 2

    The MasterDB has both server records


    I did try to break down how the replication proccess works
    started with the cron then checked server.php (enabled DEBUG) made sure the user/pass in the config file could access the masterdb Yes
    ran php -q server.php to initiate an update and it gives the "No Updated records found, starting only the core"
    from the Else statement in the update check as $tmp_num_records returns no value.

    even though on the masterdb the sys_datalog table contains entrys marked pending with server id of 1

    Need to eat now will take a break for a while, my heads shot .
     
    Last edited: Feb 5, 2009

Share This Page