PT-80 Collect replication slave information

This commit is contained in:
Carlos Salguero
2017-03-27 17:30:06 -03:00
parent 61c5ba4faa
commit be971eeee5
8 changed files with 148 additions and 13 deletions

7
sandbox/gtid_on.sql Normal file
View File

@@ -0,0 +1,7 @@
SET GLOBAL master_info_repository = 'TABLE';
SET @@GLOBAL.relay_log_info_repository = 'TABLE';
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY=ON;
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON;

View File

@@ -0,0 +1,15 @@
STOP SLAVE FOR CHANNEL '';
SET GLOBAL master_info_repository = 'TABLE';
SET @@GLOBAL.relay_log_info_repository = 'TABLE';
SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY=ON;
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE;
SET @@GLOBAL.GTID_MODE = ON;
CHANGE MASTER TO master_host='127.0.0.1', master_port=12345, master_user='msandbox', master_password='msandbox', master_auto_position=1 FOR CHANNEL 'masterchan1';
CHANGE MASTER TO master_host='127.0.0.1', master_port=12346, master_user='msandbox', master_password='msandbox', master_auto_position=1 FOR CHANNEL 'masterchan2';
START SLAVE for channel 'masterchan1';
START SLAVE for channel 'masterchan2';

View File

@@ -186,7 +186,7 @@ type=$1 # master, slave or master-master
port=$2 # sandbox port number, e.g. 12345
master_port=$3 # master port if slave or master-master
if [ "$type" != "master" ] && [ "$type" != "slave" ] && [ "$type" != "master-master" ] && [ "$type" != "cluster" ]; then
if [ "$type" != "master" ] && [ "$type" != "slave" ] && [ "$type" != "master-master" ] && [ "$type" != "cluster" ] && [ "$type" != "channels" ]; then
die "Invalid sandbox type: $type. Valid types are master, slave, and master-master."
fi

View File

@@ -293,10 +293,23 @@ case $opt in
exit_status=$((exit_status | $?))
set_mysql_version
if [ $exit_status -eq 0 ]; then
./start-sandbox "${2:-"slave"}" 12346 12345
exit_status=$((exit_status | $?))
./start-sandbox "${2:-"slave"}" 12347 12346
exit_status=$((exit_status | $?))
if [ "${2:-""}" = "channels" ] && [ "$MYSQL_VERSION" '>' "5.6" ]; then
./start-sandbox master 12346
exit_status=$((exit_status | $?))
./start-sandbox master 12347
exit_status=$((exit_status | $?))
/tmp/12345/use < $PERCONA_TOOLKIT_BRANCH/sandbox/gtid_on.sql
exit_status=$?
/tmp/12346/use < $PERCONA_TOOLKIT_BRANCH/sandbox/gtid_on.sql
exit_status=$?
/tmp/12347/use < $PERCONA_TOOLKIT_BRANCH/sandbox/slave_channels.sql
exit_status=$?
else
./start-sandbox "${2:-"slave"}" 12346 12345
exit_status=$((exit_status | $?))
./start-sandbox "${2:-"slave"}" 12347 12346
exit_status=$((exit_status | $?))
fi
if [ "${2:-""}" = "cluster" ]; then
# Bit of magic here. 'start-sandbox cluster new_node old_node'