DNS Replication

Discussion in 'Tips/Tricks/Mods' started by Uvigii, Jan 8, 2010.

  1. Uvigii

    Uvigii New Member

    2 (or more) ISPC3. Updates on 1st are propagated to all MyDNS. Need testing and feedback.
    I've change the following (on the slave server):
    /etc/mydns.conf
    Code:
    soa-where = server_id = X
    rr-where =  server_id = X  
    Code:
    soa-where = server_id = [B]1[/B]
    rr-where =  server_id = [B]1[/B]  
    /usr/local/ispconfig/server/server.php
    Code:
     // Check if there is anything to update
            $tmp_rec = $app->dbmaster->queryOneRecord("SELECT count(server_id) as number from sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." OR server_id = 0)");
    Code:
     // Check if there is anything to update
            $tmp_rec = $app->dbmaster->queryOneRecord("SELECT count(server_id) as number from sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." [B]OR server_id=1[/B] OR server_id = 0)");
    /usr/local/ispconfig/server/lib/classes/modules.inc.php
    Code:
    //* If its a multiserver setup
                    if($app->db->dbHost != $app->dbmaster->dbHost) {
    
                            $sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]."  OR server_id = 0) ORDER BY datalog_id";
    
    Code:
    //* If its a multiserver setup
                    if($app->db->dbHost != $app->dbmaster->dbHost) {
    
                            $sql = "SELECT * FROM sys_datalog WHERE datalog_id > ".$conf['last_datalog_id']." AND (server_id = ".$conf["server_id"]." [B]OR server_id = 1[/B] OR server_id = 0) ORDER BY datalog_id";
    about 30 lines below, near "$app->db->query($sql)"
    Code:
    $app->db->query($sql)
    to
    Code:
     [B]if (($d['server_id'] == $conf["server_id"]) OR ($d['server_id'] == 0 ))
      {[/B]
        $app->db->query($sql);
       [B]}  else {
         if (($d['dbtable'] == 'dns_rr')  OR ($d['dbtable'] == 'dns_soa') OR ($d['dbtable'] == 'dns_template'))
            {
               $app->db->query($sql);
             }
    }[/B]
    
    
    It is now possible to 'clone' config from master to that slave, also pick up updates for this slave (but will not serve them, unless you chose your server_id in mydns.conf). It is possible to break other modules configuration with the above, but I do not run other modules on that slave so I'm not digging deeper for now.
     
    Last edited: Jan 8, 2010
  2. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    The above should work and a similar replication mode is already included in SVN and will be released with ISPConfig 3.0.2
     
  3. lucani

    lucani New Member

    What about MyDNS as Master replication to slave Bind ? It still doesnt work, MyDNS reports wrong, older serial of SOA. Even if I change records in zone, serial is changing in MyDNS database but it notifying wrong serial to slaves bind (or maybe it doesnt notify in general)
     
  4. manarak

    manarak New Member

    yes, it still doesn't work with MyDNS, I am waiting on this fix as well.
     
  5. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Then you should write the mydns developers a email or post in their mailinglist. The problem is that mydns is not sending notifies when a record has been chnaged in the mydns database. Notifies are only sent when you restart mydns.

    If you use mydns as master and slave, then replication is working fine as you use mysql replication for this setup. We use this for years without a problem.
     
  6. manarak

    manarak New Member

    are you saying that if mydns is restarted every 5 mins, the problem will go away?

    why doesn't ISPC restart MyDNS whenever changes have been made in DNS configuration and if propagation to slave is requested?
     
  7. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Yes.

    Because the normal ispconfig setup is to use mydns as master and slave and not bind as slave which works flawlessly. Also the restart means that all slaves will get notified for all domains and not just the changed domain, so this can cause load problems on larger systems.
     
  8. manarak

    manarak New Member

  9. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Thats the same, take a look at the release dates. mydns-ng is the latest version of the mydns software. As with every software, you should use the latest released stable version, which is mydns-ng.
     
  10. manarak

    manarak New Member

    thanks.
    I just upgraded ISPC to 3.0.16 and everything looks fine.

    I downloaded v. 1.2.8.27 which was rumored to solve the delegation to bind problem.
    Let's check if this is true.

    I guess the upgrade for myDNS has to be done manually?
    Is there anything I should watch out for or can I just
    ??
    it won't break existing DNS entries, will it?
     
  11. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    I dont think so. But you hould make a backup of the mydns.conf file as it contains the queries and login details for the database and might have to be restores after the mydns update. Also make a backup of the whole ispconfig mysql database, just to be sure.
     
  12. manarak

    manarak New Member

    ok, will do. Thank you.

    I will report back with results.
     
  13. manarak

    manarak New Member

    everything went smoothly, it seems.

    will report back wether transfers are made correctly now
     
  14. manarak

    manarak New Member

  15. manarak

    manarak New Member

    So, I would like to fix myDNS and apply the following change:

    But I have no experience with compiled code, so can someone please post a step-by-step explanation how to do it?

    Currently running MyDNS version 1.2.8.27
     
  16. lucani

    lucani New Member

    I done it before installing, I dont know if this coud be updated without uninstalling anything. Everything you have to do is edit in any text editor described piece. If you will have any problems, write to me.
     
  17. manarak

    manarak New Member

    Well, the change in the text editor is not not the issue.

    The issue is compiling that file and replacing the corresponding binary.

    I think just replacing the one binary with the fixed version would be enough, no need to uninstall anything.

    I just don't know how to compile?
     

Share This Page