Rebuild Mysql Replicate
Rebuild Mysql Replicate
Rebuild Mysql Replicate
innodb_buffer_pool_size = 2G
innodb_log_file_size = 512M
innodb_buffer_pool_instances = 8
innodb_page_cleaners = 8
innodb_flush_method = O_DIRECT
At Slave Server:
At Master
mysql> show master status \G
*************************** 1. row ***************************
File: mysql-bin.000009
Position: 612028668
Binlog_Do_DB:
Binlog_Ignore_DB:
sys,information_schema,mysql,performance_schema,sys,information_schema,mysql,perfor
mance_schema,sys,information_schema,mysql,performance_schema,sys,information_schema
,mysql,performance_schema,sys,information_schema,mysql,performance_schema,sys,infor
mation_schema,mysql,performance_schema,sys,information_schema,mysql,performance_sch
ema,sys,information_schema,mysql,performance_schema,sys,information_schema,mysql,pe
rformance_schema,sys,information_schema,mysql,performance_schema
Executed_Gtid_Set: 89c3737f-b410-11e9-a18c-0a58c0aa04c8:1-24371
1 row in set (0.00 sec)
mysql>
2.Scale einvoice to 0
5. Restore on slave
# mysql -uroot -p
mysql> source /tmp/now/now/einvoicebk.sql.now.20190920.00
6. Setup Slave
mysql> RESET SLAVE;
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=1;
mysql> START SLAVE;
mysql> SHOW SLAVE STATUS \G
Master uuid
89c3737f-b410-11e9-a18c-0a58c0aa04c8
Master_UUID: 89c3737f-b410-11e9-a18c-0a58c0aa04c8
Slave uuid
Executed_Gtid_Set: 803fdfb3-b410-11e9-95e0-0a58c0a804e8:1-9479,
89c3737f-b410-11e9-a18c-0a58c0aa04c8:1-7890
EG
MASTER UUID: 4c2ad77f-697e-11e3-b2c3-c80aa9f17dc4
SLAVE UUID: 5b37def1-6189-11e3-bee0-e89a8f22a444
SET GTID_NEXT="5b37def1-6189-11e3-bee0-e89a8f22a444:80437840";
(last_executed_slave_gtid_on_master + 1)
/var/lib/mysql/data/master.info
Executed_Gtid_Set: 89c3737f-b410-11e9-a18c-0a58c0aa04c8:1-349
mysqlbinlog --base64-output=DECODE-ROWS --verbose mysql-relay-bin.000017 > mysql-
relay-bin.000017.decode.sql
### SLAVE
bash-4.2$ cat mysqld-slave
#!/bin/bash
#
# This is an entrypoint that runs the MySQL server in the 'slave' mode.
#
export_setting_variables
log_volume_info $MYSQL_DATADIR
export MYSQL_RUNNING_AS_SLAVE=1
# pre-init files
process_extending_files ${APP_DATA}/mysql-pre-init/ ${CONTAINER_SCRIPTS_PATH}/pre-
init/
if [ ! -e "${MYSQL_DATADIR}/mysql" ]; then
# Initialize MySQL database and wait for the MySQL master to accept
# connections.
initialize_database "$@"
wait_for_mysql_master
# init files
process_extending_files ${APP_DATA}/mysql-init/ ${CONTAINER_SCRIPTS_PATH}/init/
unset_env_vars
log_volume_info $MYSQL_DATADIR
log_info 'Running final exec -- Only MySQL server logs after this point'
exec ${MYSQL_PREFIX}/libexec/mysqld --defaults-file=$MYSQL_DEFAULTS_FILE \
--report-host=$(hostname -I) "$@" 2>&1
bash-4.2$
### MASTER
bash-4.2$ cat /usr/bin/run-mysqld-master
#!/bin/bash
#
# This is an entrypoint that runs the MySQL server in the 'master' mode.
#
export_setting_variables
log_volume_info $MYSQL_DATADIR
export MYSQL_RUNNING_AS_MASTER=1
# pre-init files
process_extending_files ${APP_DATA}/mysql-pre-init/ ${CONTAINER_SCRIPTS_PATH}/pre-
init/
if [ ! -d "$MYSQL_DATADIR/mysql" ]; then
initialize_database "$@"
else
start_local_mysql "$@"
fi
# init files
process_extending_files ${APP_DATA}/mysql-init/ ${CONTAINER_SCRIPTS_PATH}/init/