MySQL Master-Master-Replication Question

Discussion in 'General' started by ahrasis, Dec 13, 2017.

  1. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    I am using Ubuntu 16.04 and was attempting to build a cluster / mirror server based on the Installing a Web, Email & MySQL Database Cluster on Debian 8 tutorial where all are seemed working but I have a question regarding step 5.5 MySQL Master-Master-Replication.

    After doing step 5.5, I got the answer for both in master server is yes (as prescribed by the tutorial) but then answer for both in cluster / mirror server is no - so is this the correct situation? Or they should both be running i.e. in master server and cluster server?

    Thank you in advance.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess both should be yes when replication is running. Maybe the configuration is different for the mysql version used in Ubuntu 16.04. You might want to find a mysql master/master config tutorial for Ubuntu and compare the config from that with the one from the ispconfig tutorial.
  3. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    FYI replication works both ways but as per your suggestion, I guess I need to find the right tutorial to check and confirm or make necessary adjustments to current settings.

    My build is based on Howtoforge Perfect Server (Ubuntu 16.04 LEMP with MariaDB) and I highly appreciate and welcome any further suggestions with links for relevant tutorials.
  4. ahnabil

    ahnabil New Member

    @ahrasis what do you mean with replication works both ways?

    on 2 test servers with debian 9 LEMP stack with mariadb, i've installed one master and one mirror, both with the web administration interface, when i log into the slave server and edit anything it doesn't get replicated to the master server, edits are only replicated when i edit on the master server, edits gets replicated to the slave server.

    please confirm that you can edit on the slave server and that edits shows on the master server in case you implemented the mirroring
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    @ahnabil You have to copy the file /usr/local/ispconfig/interface/lib/ from master to slave so that the interface connects to the first dbispconfig via localhost on both servers.
  6. ahnabil

    ahnabil New Member

  7. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Yes @ahnabil. The replication should work both ways. In step 5.5, both the first server and the second server are made master servers so that when the first server is down, the second server can run its place. All new data will be kept in second server until first server is up again where data from second server can be replicated back to first server. That's how it should work, continuously, at least from my understanding.

    I am still in the mid reading materials on Ubuntu 16.04 MySQL and MariaDB replication and hopefully I figure out on how to solve my problems soonest.
  8. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    So far I managed to turn replication on in both servers as master-master replication at step 5.5 but my solution is to comment out / disable the following code which are supposed to be added up in server2.
    replicate-same-server-id = 0
    auto-increment-increment = 2
    auto-increment-offset = 2
    relay-log = slave-relay.log
    relay-log-index = slave-relay-log.index
    Adding them is causing server2 to stop working and give no answer as mentioned earlier, so my temporary solution is basically to ditch adding them in server2.

    I hope those who have managed to get this mysql replication work with Ubuntu 16.04 may share their ways too.

Share This Page