Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • We will rely on Mysql's Connector properties to achieve Master-Master DB HA
  • We need to have at least 2 nodes which are connected through 2-way replication and should be consecutive in connector's url
  • It is recommended to use semi-replicaiton over asynchronous replication to avoid data inconsistency issues during master server crash(Asynchronous replication will not guarantee the date sync between master and slave before master crashes where as semi-synchronous will guarantee 99% of data sync between master and slave).
  • The following configuration need to be done in my.cnf of each mysql server to clean up bin log files automatically.

    expire_logs_days=10 (Number of days to keep the bin log files)

    max_binlog_size=100M (The max size of each bin log file)

  • To change the bin log files location please use the following property in my.cnf of each mysql server
    log-bin=/var/lib/mysql/binlog/bin-log  (Remember here “bin-log” is the file prefix)
  • To Over come Split Brain situation in case of multiple Management servers are exists, we need to modify the following 2 properties in db.properties.

    auto_increment_increment = 10
    Tells to the mysql node that auto increment values to be incremented by 10 instead of default value 1

    For Example, In a table X the last auto incremented value is 10 and the same will be replicated to Slave so offset on both the mysql nodes is 10 and now split brain occurred and MS1 is talking to DB1 and MS2 is talking to DB2 and both get the request to add entry to the table X. Now in DB1 the auto increment value will return 11 and in DB2 the auto increment value will return 20 and both will get synced with each other and new offset will set to 20 on both DB1 and DB2
    .
    auto_increment_offset = 2
    Tells to the mysql node that the starting point of the auto increment column value to be start with.
    The second property is relevant only when split brain occurs on fresh setup.

my.cnf Configuration Details (Asynchronous)

...