Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35788

Test replication from MariaDB to MySQL

    XMLWordPrintable

Details

    • Task
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • N/A
    • Replication
    • None

    Description

      Being able to replicate from MariaDB to MySQL can be useful for migrations from MySQL to MariaDB:
      1. First set up replication from MySQL to MariaDB.
      2. Run with the replication for some time to see things look ok.
      3. Switch over to use MariaDB as the primary database.
      4. Setup replication MariaDB -> MySQL and run with that for some time to have a rollback option in case of problems.

      The replication from MariaDB to MySQL would be used in (4), and mostly there to have recovery options in case of problems in the migration.

      In summary, replication from MariaDB to MySQL seems to work fine.
      I tested from some MariaDB 11.4 to MySQL 8.0.40 running locally.

      I built MySQL like this:

      (cd /kvm/src/my/mysql-server/ && rm -rf build/ && mkdir build/ && cd build/ && cmake -DCMAKE_BUILD_TYPE=Debug -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/kvm/src/my/mysql-server/boost_1_77_downloaded ..)
      

      I started the MariaDB master like this:

      X=data1; rm -Rf $X && mkdir -p $X && sh scripts/mysql_install_db --no-defaults --srcdir=$(pwd) --datadir=$X --auth-root-authentication-method=normal && sql/mysqld --no-defaults --language=$(pwd)/sql/share/english --basedir=$(pwd) --datadir=$X --socket=$(pwd)/$X/mysql.sock --port=3310 --server-id=1 --log-bin
      

      I started the MySQL server like this:

      X=data1; rm -Rf $X && mkdir -p $X && runtime_output_directory/mysqld --no-defaults --initialize-insecure --datadir=$X && runtime_output_directory/mysqld --no-defaults --basedir=$(pwd) --datadir=$X --socket=$(pwd)/$X/mysql.sock --port=3311 --server-id=2 --log-bin=slave-bin
      

      I then set up replication on MySQL like this:

      runtime_output_directory/mysql -uroot --socket=build/data1/mysql.sock
      change master to master_user='root', master_password="", master_host='localhost', master_port=3310;
      start slave;
      

      I was then able to replicate DDL and DML from MariaDB to MySQL without any
      issues:

      create database test2;
      use test2;
      create table t1 (a int primary key, b int);
      insert into t1 values (1,0), (2,0), (3,3), (4,10);
      insert into t1 select 10+a, b*b from t1;
      update t1 set b=b+1000 where a MOD 3 = 0;
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              knielsen Kristian Nielsen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.