To turn on multi-threaded replication, the default key parameters are two:
Mysql> Show variables like ' slave_parallel_% ';
+------------------------+---------------+
| variable_name | Value |
+------------------------+---------------+
| Slave_parallel_type | DATABASE |
| Slave_parallel_workers | 0 |
+------------------------+---------------+
2 rows in Set (0.00 sec)
Slave-parallel-type Default value is database
Slave-parallel-workers Default value is 0
Open Online:
mysql> stop slave Sql_thread;
Query OK, 0 rows affected (0.07 sec)
mysql> set global slave_parallel_type= ' Logical_clock ';
Query OK, 0 rows Affected (0.00 sec)
mysql> set global slave_parallel_workers=4;
Query OK, 0 rows Affected (0.00 sec)
mysql> start slave sql_thread;
Query OK, 0 rows affected (0.06 sec)
Optimization options:
The table mode is enabled because if the Master.info file is updated frequently in multithreaded mode, the cost is too high and the value is not very accurate
The table for master_info_repository=table corresponds to Mysql.slave_master_info
Relay_log_recovery=on
The table for relay_log_info_repository=table corresponds to Mysql.slave_relay_log_info
MySQL 5.7 Turn on parallel replication