|
@@ -1,55 +1,86 @@
|
|
-MYSQL REPLICATION TEST
|
|
|
|
|
|
+#MYSQL REPLICATION TEST
|
|
|
|
|
|
-BUILD:
|
|
|
|
|
|
+##BUILD:
|
|
|
|
+```
|
|
docker-compose build
|
|
docker-compose build
|
|
|
|
+```
|
|
|
|
|
|
-RUN:
|
|
|
|
|
|
+##RUN:
|
|
|
|
+```
|
|
docker-compose up
|
|
docker-compose up
|
|
|
|
+```
|
|
|
|
|
|
-RUN:
|
|
|
|
|
|
+###RUN:
|
|
|
|
+```
|
|
./status-master.sh
|
|
./status-master.sh
|
|
|
|
+```
|
|
result:
|
|
result:
|
|
|
|
+```
|
|
+------------------+----------+--------------+------------------+-------------------+
|
|
+------------------+----------+--------------+------------------+-------------------+
|
|
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
|
|
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
|
|
+------------------+----------+--------------+------------------+-------------------+
|
|
+------------------+----------+--------------+------------------+-------------------+
|
|
| mysql-bin.000003 | 154 | xbrlgen | | |
|
|
| mysql-bin.000003 | 154 | xbrlgen | | |
|
|
+------------------+----------+--------------+------------------+-------------------+
|
|
+------------------+----------+--------------+------------------+-------------------+
|
|
|
|
+```
|
|
|
|
|
|
- make sure File is "mysql-bin.000003" IF NOT
|
|
|
|
- RUN SQL ON SLAVE:
|
|
|
|
- CHANGE MASTER TO MASTER_HOST='mysql-master', MASTER_USER='replica', MASTER_PASSWORD='duren123', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=0;
|
|
|
|
- RESTART slave
|
|
|
|
|
|
+make sure File is "mysql-bin.000003" IF NOT
|
|
|
|
+RUN SQL ON SLAVE:
|
|
|
|
+```
|
|
|
|
+CHANGE MASTER TO MASTER_HOST='mysql-master', MASTER_USER='replica', MASTER_PASSWORD='duren123', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=0;
|
|
|
|
+```
|
|
|
|
+Then restart slave
|
|
|
|
+```
|
|
|
|
+docker restart mysql-slave
|
|
|
|
+```
|
|
|
|
|
|
-RUN:
|
|
|
|
|
|
+###RUN:
|
|
|
|
+```
|
|
./status-slave.sh
|
|
./status-slave.sh
|
|
- make sure no error (Last_IO_Error and Last_SQL_Error)
|
|
|
|
|
|
+```
|
|
|
|
+make sure no error (Last_IO_Error and Last_SQL_Error)
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-TEST:
|
|
|
|
|
|
+###TEST:
|
|
Check slave data:
|
|
Check slave data:
|
|
|
|
+```
|
|
docker exec -ti mysql-master mysql -u root --password=dodol123 xbrlgen
|
|
docker exec -ti mysql-master mysql -u root --password=dodol123 xbrlgen
|
|
|
|
+```
|
|
run sql:
|
|
run sql:
|
|
|
|
+```
|
|
SHOW TABLES;
|
|
SHOW TABLES;
|
|
- make sure no table exists
|
|
|
|
|
|
+```
|
|
|
|
+make sure no table exists
|
|
|
|
|
|
-Run test sql on master:
|
|
|
|
|
|
+###Run test sql on master:
|
|
|
|
+```
|
|
docker exec -i mysql-master mysql -u root --password=dodol123 xbrlgen < test.sql
|
|
docker exec -i mysql-master mysql -u root --password=dodol123 xbrlgen < test.sql
|
|
|
|
+```
|
|
|
|
|
|
-Check slave data:
|
|
|
|
|
|
+###Check slave data:
|
|
|
|
+```
|
|
docker exec -ti mysql-master mysql -u root --password=dodol123 xbrlgen
|
|
docker exec -ti mysql-master mysql -u root --password=dodol123 xbrlgen
|
|
-run sql:
|
|
|
|
|
|
+```
|
|
|
|
+Run sql:
|
|
|
|
+```
|
|
SHOW TABLES;
|
|
SHOW TABLES;
|
|
- make sure table DATA1 exists
|
|
|
|
|
|
+```
|
|
|
|
+make sure table DATA1 exists
|
|
|
|
+```
|
|
SELECT * FROM DATA1;
|
|
SELECT * FROM DATA1;
|
|
- make sure table DATA1 is not empty
|
|
|
|
|
|
+```
|
|
|
|
+make sure table DATA1 is not empty
|
|
|
|
|
|
-RUN:
|
|
|
|
|
|
+###RUN:
|
|
|
|
+```
|
|
./status-master.sh
|
|
./status-master.sh
|
|
- check the Position
|
|
|
|
|
|
+```
|
|
|
|
+check the Position
|
|
|
|
+```
|
|
./status-slave.sh
|
|
./status-slave.sh
|
|
- check Exec_Master_Log_Pos equal with <master Position>
|
|
|
|
|
|
+```
|
|
|
|
+check Exec_Master_Log_Pos equal with <master Position>
|
|
|
|
|
|
|
|
|
|
-CLEAN-UP:
|
|
|
|
|
|
+###CLEAN-UP:
|
|
|
|
+```
|
|
docker-compose rm -f
|
|
docker-compose rm -f
|
|
|
|
+```
|