From 0525d4460e49e4e23dc2eff4204bc9b483e62fb6 Mon Sep 17 00:00:00 2001 From: Vojtech Juranek Date: Sun, 2 Feb 2025 23:43:30 +0100 Subject: [PATCH] DBZ-8655 Turn on replication during db initialization --- examples/mysql-replication/master/2.7/inventory.sql | 6 ++++++ examples/mysql-replication/master/3.0/inventory.sql | 6 ++++++ examples/mysql-replication/master/3.1/inventory.sql | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/examples/mysql-replication/master/2.7/inventory.sql b/examples/mysql-replication/master/2.7/inventory.sql index 897e0f1e..32d99337 100644 --- a/examples/mysql-replication/master/2.7/inventory.sql +++ b/examples/mysql-replication/master/2.7/inventory.sql @@ -4,6 +4,12 @@ # However, this grant is equivalent to specifying *any* hosts, which makes this easier since the docker host # is not easily known to the Docker container. But don't do this in production. # + +# Oracle Docker image turn replication off while loading initial files, which breaks our replication setup. +# See https://github.com/mysql/mysql-docker/blob/1.2.20-server/mysql-server/8.4/docker-entrypoint.sh#L109 +# Turn replication on in the init script. +SET @@SESSION.SQL_LOG_BIN=1; + CREATE USER 'replicator' IDENTIFIED BY 'replpass'; CREATE USER 'debezium' IDENTIFIED BY 'dbz'; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'replicator'; diff --git a/examples/mysql-replication/master/3.0/inventory.sql b/examples/mysql-replication/master/3.0/inventory.sql index 897e0f1e..32d99337 100644 --- a/examples/mysql-replication/master/3.0/inventory.sql +++ b/examples/mysql-replication/master/3.0/inventory.sql @@ -4,6 +4,12 @@ # However, this grant is equivalent to specifying *any* hosts, which makes this easier since the docker host # is not easily known to the Docker container. But don't do this in production. # + +# Oracle Docker image turn replication off while loading initial files, which breaks our replication setup. +# See https://github.com/mysql/mysql-docker/blob/1.2.20-server/mysql-server/8.4/docker-entrypoint.sh#L109 +# Turn replication on in the init script. +SET @@SESSION.SQL_LOG_BIN=1; + CREATE USER 'replicator' IDENTIFIED BY 'replpass'; CREATE USER 'debezium' IDENTIFIED BY 'dbz'; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'replicator'; diff --git a/examples/mysql-replication/master/3.1/inventory.sql b/examples/mysql-replication/master/3.1/inventory.sql index 897e0f1e..32d99337 100644 --- a/examples/mysql-replication/master/3.1/inventory.sql +++ b/examples/mysql-replication/master/3.1/inventory.sql @@ -4,6 +4,12 @@ # However, this grant is equivalent to specifying *any* hosts, which makes this easier since the docker host # is not easily known to the Docker container. But don't do this in production. # + +# Oracle Docker image turn replication off while loading initial files, which breaks our replication setup. +# See https://github.com/mysql/mysql-docker/blob/1.2.20-server/mysql-server/8.4/docker-entrypoint.sh#L109 +# Turn replication on in the init script. +SET @@SESSION.SQL_LOG_BIN=1; + CREATE USER 'replicator' IDENTIFIED BY 'replpass'; CREATE USER 'debezium' IDENTIFIED BY 'dbz'; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'replicator';