Public Repository

Last pushed: 2 years ago
Short Description
Easily set up a mysql master / slave replication environment for test / development purposes.
Full Description

Easy MySQL Replicating Cluster for Dev / Test Purposes

Quick way:

  1. Download a lightweight bash script to control the cluster:

    git clone https://github.com/dougjohnson/mysql_replication_demo.git

  2. Start the cluster (eg 1 master with 2 slaves):

    cd mysql_replication_demo && start_cluster -n 2

Slow way:

follow the steps in the README

Docker Pull Command
Owner
doug

Comments (2)
doug
3 years ago

This was caused by old binary logs being purged automatically in the master. Is now fixed in latest version. Thanks for the heads-up!

See the README linked above for the Dockerfiles

a14n
3 years ago

Is there a project available to build the images doug/mysql-master and doug/mysql-slave ?

I faced a problem by using your images (v5.6) because master log file and slave log file are not synchronized (mysql-bin.000002 vs. mysql-bin.000001). And I like to fix it.

On master : show master status

mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000002 |      107 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

And on slave :

mysql> show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: master
                  Master_User: replication
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000001
          Read_Master_Log_Pos: 325
               Relay_Log_File: mysqld-relay-bin.000003
                Relay_Log_Pos: 4
        Relay_Master_Log_File: mysql-bin.000001
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 325
              Relay_Log_Space: 107
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 100
1 row in set (0.00 sec)

A workaround is to manually update de slave replication state on slaves with :

mysql> stop slave;
mysql> change master to MASTER_LOG_FILE='mysql-bin.000002', Master_Log_Pos=107;
mysql> start slave;