Solve the problem of mysql active and standby delay

  According to the principle, there should be no delay between the master and the backup, because the master database is capable of processing, but the backup database is not capable, especially when it is on the same machine  

  The reason is that only one thread is opened for the writing of the standby database. In this way, in versions after 5.7, we can turn on multi-threaded processing

 

slave-parallel-type=LOGICAL_CLOCK
slave-parallel-workers=8
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
binlog_group_commit_sync_delay=1000000
binlog_group_commit_sync_no_delay_count=20

 

reference:

https://blog.csdn.net/xzsfg6825/article/details/73302066?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&dist_request_id=dd2334c3-3d8d-4b12-b324-908ece835c5a&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.control

MySQL Performance Schema

https://cloud.tencent.com/developer/article/1143420

This can adjust the master, in practice

https://www.jianshu.com/p/ed19bb0e748a

UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE 'events_transactions%';

UPDATE performance_schema.setup_instruments SET ENABLED = 'YES', TIMED = 'YES'WHERE NAME = 'transaction';

 

SELECT thread_id,count_star FROM performance_schema.events_transactions_summary_by_thread_by_event_name WHERE thread_id IN (SELECT thread_id FROM performance_schema.replication_applier_status_by_worker);

Guess you like

Origin blog.csdn.net/dualvencsdn/article/details/114094222