Why do slaves contact the master DB directly?

Discussion in 'Developers' Forum' started by Chris_UK, Oct 24, 2017.

  1. Chris_UK

    Chris_UK New Member

    This might seem like a strange question to ask, of course the direct route should be more efficient, but it makes for very complicated setup and prone to errors, in my opinion of course.

    But all opinions aside, wouldn't an API be simpler and less error prone for the administration of servers than directly allowing slaves to access the master database?

    Consider this implementation without direct database access:
    • Admin generates an "enrolment key" for use during initial slave configuration.
    • Slave calls to API using key for configuration data;
    • Master provides appropriate response including a new key for the slave for next/future call(s)
    • Slave now updates itself by API.
    Now that the to me is better than the current system for any number of reasons, Security, Simplified setup/management, Data integrity and, the list could go on. I recently found that an failed install can currently leave the slave in a partially configured state requiring manual recovery, and with data on both the master and the slave to resolve, I would say that alone is a perfect reason to improve The Perfect Server [couldn't resist - its a curse :p].

    Its worth a footnote that the install could be better handled, why is there no dependency checking occurring before changes are applied? What about a "dry run" option with provision to allow commit upon success?

    Anyway I hope to see this in a soon to be coming update, over and out, back to it i must go.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Beside that, the slaves do not access the data directly in the master database, the slaves just poll data from sys_datalog table, this table is a transactional data table that ensures data integrity as data gets always processed in correct order starting from the point when the slave polled data the last time and even when the slave was offline for some time, it will catch up to the master data state automatically (as long as the slave was not offline for more than a month). So even when we use an API, then the procedure will be the same, just that we use another way to poll the data. Such an api has some benefits like I described above, but also some drawbacks performance wise.
     
    Chris_UK likes this.
  4. Chris_UK

    Chris_UK New Member

    Well played @till I think a Rest API is definitely the right direction and to be quite honest with you i think the implementation benefits will far outweigh the impact of a slight performance hit in this case. I probably should have checked the dev forum, thank you for the link, i will follow that thread for updates on the discussion.
     

Share This Page