Skip to content

Instantly share code, notes, and snippets.

@VeryFatBoy
Forked from robrich/cluster1.sql
Created October 12, 2021 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VeryFatBoy/1c816a02a7555847a79378ac7c4ea7ed to your computer and use it in GitHub Desktop.
Save VeryFatBoy/1c816a02a7555847a79378ac7c4ea7ed 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