How to know when primary/secondary out of sync?

Discussion in 'General' started by TonyG, Jun 23, 2022.

Tags:
  1. TonyG

    TonyG Active Member

    This other thread tells how to resync servers that are out of sync:
    https://forum.howtoforge.com/threads/force-dns-propagation.85983/
    On checking status at mxtoolbox.com, I saw my secondary DNS had a different serial number.
    I went to Tools > Resync to resync everything, and hundreds of transactions were processed.

    So my question is, can we run a report to know if a resync is warranted between the primary and any secondaries?

    The Tools > Resync page has dropdowns for each feature. But only the primary server is listed for all lists. That makes me think the selector is just for the "sync from" host, and all other servers will be "synced to". Is that correct? Or ... is my secondary just not showing in those lists for some reason?

    Can it hurt to occasionally sync just as a matter of policy, just in case there is a sync issue?

    Can we do the sync with a cron job? Or better stated, is there a CLI command that can be executed to do this sync?

    Thanks!
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    How have you set up sync from primary name server to second? If you have name service by ISPConfig, there are two ways:
    1. secondary server is mirror of first.
    2. you have set up secondary dns zones that live on the secondary server
    Sync is done differently in these two methods, so troubleshooting needs to know which method is used.
    You should start with this:
    https://forum.howtoforge.com/threads/please-read-before-posting.58408/
     
    ahrasis likes this.
  3. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    No such report is provided with ISPConfig, though it probably wouldn't be terribly difficult to script something to pull down dns zones from each server and compare them.
    No, it is the server for which records will be synced to. If you are using server mirroring, when you sync records to the primary server, the same records will also be synced to the the mirrored server.
    Other than performance, there shouldn't be any problem with doing this.
    No.
    No.

    Resync is all done in the user interface code; you could try to automate making the http request which initiates a sync.
     
    TonyG likes this.
  4. TonyG

    TonyG Active Member

    Acknowledgement and thanks. I'm doing other server work and will swing back to this as time permits.
     
  5. TonyG

    TonyG Active Member

    Thanks for your time. I know I need to research before posting. I do. I posted a reference to another old thread that I found in that research. I did not recall that there are two different sync types. I do not use secondary zones, so to my knowledge I posted all info I had. My enquiry wasn't only about DNS. The Tools>Rsync function doesn't say there are different ways to resync - it is one page, everything looks the same, and I was asking how that worked.

    The RTFM wasn't necessary. Jesse responded to the enquiry without jumping in with text or a Like to let everyone know how arrogant he can be when faced with a simple question. C'mon guys, drop the attitude and hostility.
    Let's be productive here ... If we proceed without the personality factor, you'll note an anomaly:

    Tony: The Tools > Resync page has dropdowns for each feature. But only the primary server is listed for all lists. That makes me think the selector is just for the "sync from" host, and all other servers will be "synced to". Is that correct?
    Jesse: No, it is the server for which records will be synced to.

    I have one primary and one secondary. The secondary is one of the servers in the server list. The primary is aware of this server and of what it does. So why does my primary show itself as being the target of a sync in those dropdowns? If, as Jesse says, "it is the server for which records will be synced to", the dropdown should never include the name of the current server.

    From a UX standpoint, I would think that ideally (not there of course) each dropdown would only have the names of hosts that are supporting the related feature. That is, if a system isn't supporting DNS then it's name shouldn't be in that dropdown. And a Sync All Services wouldn't attempt to sync details with servers that don't support the features.

    If those dropdowns are really supposed to be "the server for which records will be synced to", I would be terrified to do a sync if I hadn't already done it. If the dropdown shows my primary controller as being the destination, and the secondaries are out of sync, I sure wouldn't want the primary to get updated with the old secondary data. Now, that did not happen. So either that field is broke in a fortunate way, or there is more to the definition of what that dropdown field is.

    What can I do to determine why it looks like a primary server is going to sync to itself, and why there is no secondary in those dropdowns? Are Your dropdowns correct?
    I can read the code but first I'm hoping someone who knows will volunteer some insight.

    Thanks - everyone - as always.
     
  6. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    This is my understanding, though I may miss some nuances or even entire step here.

    The (re)sync is of records in the master ISPConfig database to the slave servers, so eg. if you sync dns records to ns1.yourdomain.com, the resync tool (part of the UI code) reads all the records from the ispconfig master database dns_rr table where that server's id matches server_id, and creates sys_datalog entries for all those records. The ISPConfig slave (ns1.yourdomain.com) runs it's per-minute cronjob to grab those sys_datalog records from the master, updates it's local ispconfig database, and fires off server events for those, of which the server plugins handle and make changes to the actual dns config files.

    When ns2.yourdomain.com is a mirror of ns1 within ISPConfig, when the sys_datalog records are created for ns1, a duplicate set is created for ns2 (should be the exact same record except for server_id and datalog id, I think). This is similar to adding/changing data for ns1 in the UI, a datalog entry is created for both ns1 and ns2, which is the mechanism by which they are mirrored.

    I could be wrong, but I don't think anything cleans up "abandoned" data in a slave database. Eg. if some records existed in dns_rr in the ispconfig database on ns1, but did not exist in the master ispconfig database, nothing (including a resync) would identify that and clean it up.
     
  7. TonyG

    TonyG Active Member

    Does anyone else here see what I see, where on "server1" you go to resync to "server2" but the dropdown only shows server1?

    I still don't know if my servers are out of sync, or with this anomaly if server1 is just creating sys_datalog entries for itself to consume.

    I don't see anything in ISPConfig to verify if a secondary server is even active. From external testing the world sees the secondary for DNS and mail. But I don't have metrics to verify that the secondary DNS is accurate, or if mail is properly being accepted and passed on to the primary server when it's neccessary.

    Does everyone else rely on external tools for these functions, or am I missing something in ISPConfig?

    Thanks.
     

Share This Page