Posted 鑰佸彾鑼堕

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了相关的知识,希望对你有一定的参考价值。

涓€銆侀棶棰樻弿杩?/span>

浠婂ぉ鏀跺埌涓讳粠寤惰繜鍛婅锛堝懆鏈潯浜嗕竴鏅氫笂娌$湅鍒板憡璀︼紝鐣ユ樉灏村艾馃槗锛夛紝璧剁揣鐪嬩笅浠庡簱鐘舵€?/p>

[14:50:56 root@mysql3306.sock][(none)]> show slave status\G*************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 10.100.63.10 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000383 Read_Master_Log_Pos: 132069756 Relay_Log_File: mlfslave164-relay-bin.000684 Relay_Log_Pos: 827356702 Relay_Master_Log_File: mysql-bin.000382 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 827356489 Relay_Log_Space: 1205833440 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 50064Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 30429 Master_UUID: d04dc0aa-ca9f-11e8-ba14-d094660e5c57 Master_Info_File: mysql.slave_master_info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Reading event from the relay log Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version:1 row in set (0.00 sec)

浜屻€侀棶棰樿瘖鏂?/span>

2.1 鍒濇鍒ゆ柇

show鍑犳slave status鐨勭粨鏋滅湅鍒癊xec_Master_Log_Pos閮藉浜庝綅缃?27356489锛屾墍浠ュ緢瀹规槗灏卞彲浠ュ垽鏂嚭澶勪簬澶т簨鍔′簡銆?/p>


2.2 瑙f瀽binlog

閫氳繃瑙f瀽涓诲簱鐨刡inlog涓€鎺㈢┒绔燂紝


銆愬伐浣滅瑪璁般€戜竴鍒欎富浠庡悓姝ュ欢杩熷鐞?><br></p> 
<p><br></p> 
<p><span class=2.3 pstack

鍐嶇湅涓媝stack缁撴灉

Thread 217 (Thread 0x7fdf4af5c700 (LWP 180191)):#0 sel_restore_position_for_mysql (same_user_rec=0x7fdf4af5bb48, pcur=0x7fe0546e2718, moves_up=1, mtr=0x7fdf4af5aad0, latch_mode=1) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/storage/innobase/row/row0sel.cc:3760#1 0x00000000011396b6 in row_search_mvcc (buf=0x7fe05451c5b0 "", mode=PAGE_CUR_G, prebuilt=0x7fe0546e2508, match_mode=0, direction=1) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/storage/innobase/row/row0sel.cc:5069#2 0x000000000104af2e in ha_innobase::general_fetch (this=0x7fe054c79c60, buf=0x7fe05451c5b0 "", direction=1, match_mode=0) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/storage/innobase/handler/ha_innodb.cc:9021#3 0x000000000081b9fa in handler::ha_rnd_next (this=<optimized out>, buf=0x7fe05451c5b0 "") at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/sql/handler.cc:2947#4 0x0000000000ecd461 in Rows_log_event::do_table_scan_and_update (this=0x7fe04954d970, rli=0x7fe048085f30) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/sql/log_event.cc:10804#5 0x0000000000edb4f2 in Rows_log_event::do_apply_event (this=0x7fe04954d970, rli=0x7fe048085f30) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/sql/log_event.cc:11270#6 0x0000000000f2dbb5 in slave_worker_exec_job_group (worker=0x7fe048085f30, rli=0x7fe01409f450) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/sql/rpl_rli_pdb.cc:2666#7 0x0000000000f199b3 in handle_slave_worker (arg=0x7fe048085f30) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/sql/rpl_slave.cc:6180#8 0x0000000000fc79a4 in pfs_spawn_thread (arg=0x7fe04800dfa0) at /export/home/pb2/build/sb_0-29016441-1528454776.43/mysql-5.7.23/storage/perfschema/pfs.cc:2190#9 0x00007feddcd23dd5 in start_thread () from /lib64/libpthread.so.0#10 0x00007feddb7dbead in clone () from /lib64/libc.so.6

鐪嬪埌sql_thread澶勪簬row_search_mvcc鐘舵€侊紝鍒拌繖閲屽叾瀹炲熀鏈笂鍙互鍒ゆ柇鍑虹敱浜庤〃娌℃湁涓婚敭鎴栬€呮病鏈夊悎閫傜殑绱㈠紩閫犳垚鐨勪富浠庡欢杩熴€?/p>


2.4 鏍瑰洜纭畾

鎴戜滑鍐嶇湅涓嬪搴旂殑琛ㄧ殑琛ㄧ粨鏋滐紝浠巄inlog鍙互鐪嬪埌鏇存柊鐨勮〃涓篸iwo_mydoc_inc$_temp锛岃〃缁撴瀯濡備笅锛?/p>

[20:29:34 root@mysql3306.sock][trswcmtest]> show create table diwo_mydoc_inc$_temp\G*************************** 1. row *************************** Table: diwo_mydoc_inc$_tempCreate Table: CREATE TABLE `diwo_mydoc_inc$_temp` ( `SEQ_ID` bigint(20) NOT NULL DEFAULT '0', `viewkey` varchar(37) NOT NULL, `SQL_TYPE` tinyint(4) NOT NULL, `TRS_FLAG` tinyint(4) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf81 row in set (0.00 sec)

鏋滅劧锛屽鎴戜滑鎵€鏂欙紝琛ㄤ笂娌℃湁涓婚敭锛屼篃娌℃湁浠讳綍绱㈠紩銆?br>

濂戒簡锛屽埌杩欓噷涓讳粠寤惰繜鐨勫師鍥犲凡缁忔壘鍒帮紝閭d箞璇ュ浣曡В鍐冲憿锛?/p>

涓夈€佽В鍐冲姙娉?/span>

3.1 缁х画绛夊緟

杩欐槸涓€绉嶅緢鏃犲鐨勬柟寮忥紝鍟ラ兘涓嶅仛

[20:32:28 root@mysql3306.sock][trswcmtest]> pager cat - |grep "row lock"PAGER set to 'cat - |grep "row lock"'[20:32:35 root@mysql3306.sock][trswcmtest]> show engine innodb status\G0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)0 lock struct(s), heap size 1136, 0 row lock(s)1 row in set (0.00 sec)

閫氳繃杩欑鏂瑰紡鏌ョ湅琛岄攣鐨勬暟閲忥紝鍙互浼扮畻鍑哄ぇ姒傝繕闇€瑕佸灏戞椂闂村畬鎴恇inlog搴旂敤锛堝綋鏃跺お鍖嗗繖锛屽繕璁版埅鍥句簡锛夛紝鏁呴殰褰撴椂绮楃暐浼扮畻杩橀渶瑕?涓皬鏃舵墠鑳藉簲鐢ㄥ畬锛屾灉鏂娇鐢ㄤ簡绗簩绉嶆柟娉曘€?br>


3.2 閲嶅惎銆佸缓绱㈠紩

姝ゆ椂濡傛灉鎸夋甯竤hutdown鎴栬€卻top slave鐨勬柟寮忔潵鍋滄澶嶅埗闇€瑕佺殑鏃堕棿鍙兘宸茬粡涓嶆涓€鐐瑰崐鐐逛簡锛岃繃娈祂ill -9 `pid of mysqld`锛屽惎鍔ㄦ椂娣诲姞鍙傛暟`鈥?skip-slave-start`淇濊瘉slave鍚姩鏃朵笉寮€鍚鍒躲€?/p>

瑙傚療琛╠iwo_mydoc_inc$_temp鐨勬暟鎹垎甯冿紝鍙戠幇viewkey瀛楁鏉ユ簮浜庡彟澶栦袱寮犺〃鐨勨€濊〃鍚嶁€?鍞竴閿紝SQL_TYPE瀛楁鏍囪瘑浜哠QL鐨勭被鍨嬶紝閭d箞鎴戜滑鍙互瀵箆iewkey寤虹珛绱㈠紩锛屼笖鍖哄垎搴﹁緝楂樸€?span class="mq-19">

set sql_log_bin=0;create index idx_viewkey on diwo_mydoc_inc$_temp(viewkey);

寤虹珛绱㈠紩浠ュ悗锛屽啀寮€鍚鍒讹紝2鍒嗛挓浠ュ悗灏辫拷涓婁簡涓诲簱锛屽彲瑙佸鍒惰繕鏄緢缁欏姏鐨勩€?/p>


3.3 淇敼slave_rows_search_algorithms

slave_rows_search_algorithms榛樿鍊间负TABLE_SCAN,INDEX_SCAN锛屾垜浠彲浠ヨ缃瓾ASH_SCAN鏉ュ姞閫焍inlog event鍦ㄥ簲鐢ㄨ繃绋嬩腑鐨剅ow瀹氫綅銆侶ASH_SCAN鎻愰珮鎬ц兘鐨勪袱涓潯浠跺涓嬶細

  1. 琛ㄤ腑娌℃湁浠讳綍绱㈠紩鎴栬€呮湁绱㈠紩涓旀湰鏉pdate/delete鐨勬暟鎹叧閿瓧閲嶅鍊艰緝澶?/p>

  2. 涓€涓猽pdate/delete璇彞鍒犻櫎浜嗗ぇ閲忕殑鏁版嵁锛屽舰鎴愪簡寰堝涓?K宸﹀彸鐨刄PDATE_ROW_EVENT/DELETE_ROW_EVENT銆倁pdate/delete鍙慨鏀瑰皯閲忕殑鏁版嵁锛堟瘮濡傛瘡涓鍙ヤ慨鏀逛竴琛屾暟鎹級骞朵笉鑳芥彁楂樻€ц兘


鍥涖€佹€濊€?/span>

鍒拌繖閲岋紝闂宸茶В鍐冲ぇ鍗婏紝浣嗘槸缁欐垜浠殑璀︾ず杩樺緱鐗㈣浜庡績

  1. 澶т簨鍔★紝涓讳粠澶嶅埗閫犳垚寤惰繜鐨勭姜榄佺ジ棣?/p>

  2. 鏃犱富閿€佸敮涓€閿紝涓讳粠寤惰繜鐨勫偓鍖栧墏锛屽缓璁瘡涓〃杩樻槸淇濈暀鑷涓婚敭浠ユ彁楂樺鍒舵€ц兘

  3. 鏈枃缁欏嚭浜嗗揩閫熻瘖鏂富浠庡欢杩熺殑鎬濊矾鍙婃柟娉曪紝寤鸿鏂版墜鏈嬪弸浠彲浠ュ涔犱竴涓嬭繖涓璺?nbsp;



鐢卞彾鑰佸笀涓昏鐨勭煡鏁板爞銆孧ySQL浼樺寲璇俱€嶇17鏈熷凡鍙戣溅锛岃绋嬩粠绗?5鏈熷氨鍗囩骇鎴怣ySQL 8.0鐗堟湰浜嗭紝鐜板湪涓婅溅鍒氬垰濂斤紝鎵爜寮€鍚疢ySQL 8.0鐨勪慨琛屼箣鏃呭惂銆?/span>

銆愬伐浣滅瑪璁般€戜竴鍒欎富浠庡悓姝ュ欢杩熷鐞?></p> 
<p class=


鍙﹀锛屽彾鑰佸笀鍦ㄨ吘璁鍫傜殑鐭绋嬨€?span class="mq-34">MySQL鎬ц兘浼樺寲銆嬪凡寮€璇撅紝鏈绋嬭瑙h鍑犱釜MySQL鎬ц兘浼樺寲鐨勬牳蹇冭绱狅細鍚堢悊鍒╃敤绱㈠紩锛岄檷浣庨攣褰卞搷锛屾彁楂樹簨鍔″苟鍙戝害銆?span class="mq-38">

涓嬮潰鏄姤鍚嶅皬绋嬪簭鐮?/p>

銆愬伐浣滅瑪璁般€戜竴鍒欎富浠庡悓姝ュ欢杩熷鐞?></p> 
<section class=


鐐光€滃湪鐪嬧€濈粰鎴戜竴鏈靛皬榛勮姳

以上是关于的主要内容,如果未能解决你的问题,请参考以下文章

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

片段和活动之间的核心区别是啥?哪些代码可以写成片段?

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段6——CSS选择器

VSCode自定义代码片段——声明函数

VSCode自定义代码片段8——声明函数