Pushing data from slave to master

Discussion in 'Developers' Forum' started by exynenem, Mar 6, 2019.

  1. exynenem

    exynenem Member


    I'am currently working on a cronjob that is supposed to submit data to the master server.
    I've been digging into other cronjob files that are being shipped with ISPConfig and found that they often use:

    $app->dbmaster->query($query and so on...);
    However, when I use this approach the data is not being inserted into the table of the master server.
    While using $app->db->query the query works just fine. So inserting locally works which also means the query is actually fine.

    What am I missing there that my query can't be inserted into the table of the master server? The table is not a original ISPConfig table but an own/custom.

    Or do I have an understanding problem there.
    Could it be rather more that $app->dbmaster->query will only work when it is executed on the master server itself and not on a slave?
    Last edited: Mar 6, 2019
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    make sure, that slave can insert/update the data for the table when you use $app->dbmaster->query.
    exynenem likes this.
  3. exynenem

    exynenem Member

    Ahh thanks for the hint, I've finally found the issue.
    The ispcsrv<number> user of the slave didn't have the permissions to access the table of the master, but the host was also wrong, after I've moved my VM and changed the ip addresses...

    Will this approach of accessing/modifying data (via $app->dbmaster->query) still exists in ISPConfig 3.2 or is it about to be dropped with 3.2?
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Direct database access will probably be replaced with a more restrictive API which will be HTTPS/REST based.
    Jon M likes this.

Share This Page