Skip to content

Instantly share code, notes, and snippets.

@AlexRogalskiy
Forked from robrich/cluster1.sql
Created August 10, 2021 07:04
Show Gist options
  • Save AlexRogalskiy/f188dce9623412a520ba387c918b6da9 to your computer and use it in GitHub Desktop.
Save AlexRogalskiy/f188dce9623412a520ba387c918b6da9 to your computer and use it in GitHub Desktop.
-- Step_1: setup
Create database testDB;
use testDB;
Create table t( a int, b varchar(70));
insert into t values (1, now(6));
insert into t select a+(select max(a) from t), now(6) from t;
select count(*) from t;
-- Step_3: updates on primary
insert into t values (-1, now(6));
-- Step_2: replicate from primary
replicate database testDB from root:'rootpass'@172.17.0.3:3306/testDB;
-- Step_4: Verify that new updates are replicated
use testDB;
select * from t where a = -1;
select count(*) from t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment