Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Slave-Running-MySQL-5.7
# on master
mysql> SHOW MASTER STATUS\G
*************************** 1. row ***************************
File: mysql1-bin.000001
Position: 154
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)
mysql> CREATE USER repl@`192.168.%` IDENTIFIED BY 'repl';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT REPLICATION SLAVE ON *.* TO `repl`@`192.168.%`;
Query OK, 0 rows affected (0.00 sec)
# ON SLAVE
mysql> CHANGE MASTER TO MASTER_HOST='192.168.54.101', MASTER_LOG_FILE='mysql1-bin.000002', MASTER_LOG_POS=154;
Query OK, 0 rows affected (0.00 sec)
mysql> START SLAVE USER='repl' PASSWORD='repl'; // Doesn't store in master info repository.
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> SHOW GLOBAL STATUS LIKE 'slave_running';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slave_running | ON |
+---------------+-------+
1 row in set (0.00 sec)
mysql> SELECT SERVICE_STATE FROM performance_schema.replication_connection_status;
+---------------+
| SERVICE_STATE |
+---------------+
| ON |
+---------------+
1 row in set (0.00 sec)
mysql> SELECT SERVICE_STATE FROM performance_schema.replication_applier_status;
+---------------+
| SERVICE_STATE |
+---------------+
| ON |
+---------------+
1 row in set (0.01 sec)
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
*snip*
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
*snip*
mysql> SHOW GLOBAL STATUS LIKE 'slave_running';
Empty set (0.00 sec)
mysql> SET GLOBAL show_compatibility_56='ON';
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW GLOBAL STATUS LIKE 'slave_running';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slave_running | ON |
+---------------+-------+
1 row in set (0.00 sec)
mysql> SHOW GLOBAL STATUS LIKE 'slave_running';
Empty set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment