站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > MySQL 5.1参考手册中文版

Chapter聽17.聽MySQL Cluster - MySQL 5.1参考手册中文版

绗17绔狅細MySQL绨

MySQL绨囨槸MySQL閫傚悎浜庡垎甯冨紡璁$畻鐜鐨勯珮瀹炵敤銆侀珮鍐椾綑鐗堟湰銆傚畠閲囩敤浜NDB绨囧瓨鍌ㄥ紩鎿庯紝鍏佽鍦1涓皣涓繍琛屽涓MySQL鏈嶅姟鍣ㄣ傚湪MySQL 5.1浜岃繘鍒剁増鏈腑銆佷互鍙婁笌鏈鏂扮殑Linux鐗堟湰鍏煎鐨RPM涓彁渚涗簡璇ュ瓨鍌ㄥ紩鎿庛傦紙娉ㄦ剰锛岃鎯宠幏寰MySQL绨囩殑鍔熻兘锛屽繀椤诲畨瑁mysql-servermysql-max RPM锛夈

鐩墠鑳藉杩愯MySQL绨囩殑鎿嶄綔绯荤粺鏈LinuxMac OS XSolaris銆傦紙涓浜涚敤鎴烽氭姤鎴愬姛鍦板湪FreeBSD涓婅繍琛屼簡MySQL绨囷紝浣MySQL AB鍏徃灏氭湭姝e紡鏀寔璇ョ壒鎬э級銆傛垜浠鍦ㄥ姫鍔涳紝浠ヤ究浣MySQL绨囪兘杩愯鍦MySQL鏀寔鐨勬墍鏈夋搷浣滅郴缁熶笂锛屽寘鎷Windows锛岃屼笖褰撴敮鎸佹柊鐨勫钩鍙版椂锛屽皢鏇存柊璇ラ〉闈€

鏈珷浠嬬粛浜嗘鍦ㄨ繘琛岀殑宸ヤ綔锛屽叾鍐呭灏嗛殢鐫MySQL绨囩殑涓嶆柇婕斿寲鑰屽彉鍖栥傚叧浜MySQL绨囩殑鏇村淇℃伅锛岃璁块棶MySQL AB鍏徃鐨勭綉绔http://www.mysql.com/products/cluster/

鎴栬浣犱篃甯屾湜浣跨敤MySQL AB鎻愪緵鐨勪袱绉嶉澶栬祫婧愶細

         MySQL閭欢鍒楄〃

         MySQL鐢ㄦ埛璁哄潧涓婄殑绨囦富棰樺尯

鍏充簬绨囩殑涓浜涘父瑙侀棶棰橈紝璇峰弬瑙17.10鑺傦紝鈥淢ySQL绨囧父瑙侀棶棰樿В绛斺銆傚鏋滀綘鏄MySQL绨囩殑鏂版墜锛岃闃呰鎴戞柟寮鍙戜汉鍛樺尯鐨勬枃绔濡備綍涓轰袱涓湇鍔″櫒璁剧疆MySQL锛岃繖浼氭湁鎵甯姪銆

17.1. MySQL绨囨杩

MySQL鏄竴绉嶆妧鏈紝璇ユ妧鏈厑璁稿湪鏃犲叡浜殑绯荤粺涓儴缃测滃唴瀛樹腑鈥濇暟鎹簱鐨勭皣銆傞氳繃鏃犲叡浜綋绯荤粨鏋勶紝绯荤粺鑳藉浣跨敤寤変环鐨勭‖浠讹紝鑰屼笖瀵硅蒋纭欢鏃犵壒娈婅姹傘傛澶栵紝鐢变簬姣忎釜缁勪欢鏈夎嚜宸辩殑鍐呭瓨鍜岀鐩橈紝涓嶅瓨鍦ㄥ崟鐐规晠闅溿

MySQL绨囧皢鏍囧噯鐨MySQL鏈嶅姟鍣ㄤ笌鍚嶄负NDB鐨勨滃唴瀛樹腑鈥濈皣寮忓瓨鍌ㄥ紩鎿庨泦鎴愪簡璧锋潵銆傚湪鎴戜滑鐨勬枃妗d腑锛屾湳璇NDB鎸囩殑鏄笌瀛樺偍寮曟搸鐩稿叧鐨勮缃儴鍒嗭紝鑰屾湳璇MySQL鈥濇寚鐨勬槸MySQLNDB瀛樺偍寮曟搸鐨勭粍鍚堛

MySQL绨囩敱涓缁勮绠楁満鏋勬垚锛屾瘡鍙拌绠楁満涓婂潎杩愯鐫澶氱杩涚▼锛屽寘鎷MySQL鏈嶅姟鍣紝NDB绨囩殑鏁版嵁鑺傜偣锛岀鐞嗘湇鍔″櫒锛屼互鍙婏紙鍙兘锛変笓闂ㄧ殑鏁版嵁璁块棶绋嬪簭銆傚叧浜庣皣涓繖浜涚粍浠剁殑鍏崇郴锛岃鍙傝涓嬪浘锛

MySQL Cluster Components

鎵鏈夎繖浜涚▼搴忎竴璧锋瀯鎴愪簡MySQL绨囥傚皢鏁版嵁淇濆瓨鍒NDB绨囧瓨鍌ㄥ紩鎿庝腑鏃讹紝琛ㄥ皢淇濆瓨鍦ㄦ暟鎹妭鐐瑰唴銆傝兘澶熶粠绨囦腑鎵鏈夊叾浠MySQL鏈嶅姟鍣ㄧ洿鎺ヨ闂繖浜涜〃銆傚洜姝わ紝鍦ㄥ皢鏁版嵁淇濆瓨鍦ㄧ皣鍐呯殑宸ヨ祫琛ㄥ簲鐢ㄧ▼搴忎腑锛屽鏋滄煇涓搴旂敤绋嬪簭鏇存柊浜1浣嶉泧鍛樼殑宸ヨ祫锛屾墍鏈夋煡璇㈣鏁版嵁鐨勫叾浠MySQL鏈嶅姟鍣ㄨ兘绔嬪埢鍙戠幇杩欑鍙樺寲銆

瀵逛簬MySQL绨囷紝淇濆瓨鍦ㄦ暟鎹妭鐐瑰唴鐨勬暟鎹彲琚槧灏勶紝绨囪兘澶熷鐞嗗崟鐙暟鎹妭鐐圭殑鏁呴殰锛岄櫎浜嗗皯鏁颁簨鍔″皢鍥犱簨鍔$姸鎬佷涪澶辫岃鏀惧純澶栵紝涓嶄細浜х敓鍏朵粬褰卞搷銆傜敱浜庝簨鍔℃у簲鐢ㄧ▼搴忚兘澶熷鐞嗕簨鍔″け璐ヤ簨瀹滐紝鍥犺屽畠涓嶆槸闂婧愩

閫氳繃灏MySQL绨囧紩鍏ュ紑鏀炬簮鐮佷笘鐣岋紝MySQL涓烘墍鏈夐渶瑕佸畠鐨勪汉鍛樻彁渚涗簡鍏锋湁楂樺彲鐢ㄦс侀珮鎬ц兘鍜屽彲缂╂斁鎬х殑绨囨暟鎹鐞嗐

17.2. MySQL绨囩殑鍩烘湰姒傚康

NDB鏄竴绉嶁滃唴瀛樹腑鈥濆瓨鍌ㄥ紩鎿庯紝瀹冨叿鏈夊彲鐢ㄦч珮鍜屾暟鎹竴鑷存уソ鐨勭壒鐐广

鑳藉浣跨敤澶氱鏁呴殰鍒囨崲鍜岃礋杞藉钩琛¢夐」閰嶇疆NDB瀛樺偍寮曟搸锛屼絾浠ョ皣灞傞潰涓婄殑瀛樺偍寮曟搸寮濮嬫渶绠鍗曘MySQL绨囩殑NDB瀛樺偍寮曟搸鍖呭惈瀹屾暣鐨勬暟鎹泦锛屼粎鍙栧喅浜庣皣鏈韩鍐呯殑鍏朵粬鏁版嵁銆

涓嬮潰锛屾垜浠粙缁嶄簡璁剧疆鐢NDB瀛樺偍寮曟搸鍜屼竴浜MySQL鏈嶅姟鍣ㄦ瀯鎴愮殑MySQL绨囩殑璁剧疆鏂规硶銆

鐩墠锛MySQL绨囩殑绨囬儴鍒嗗彲鐙珛浜MySQL鏈嶅姟鍣ㄨ繘琛岄厤缃傚湪MySQL绨囦腑锛岀皣鐨勬瘡涓儴鍒嗚瑙嗕负1涓妭鐐广

娉ㄩ噴锛鍦ㄥ緢澶氭儏鍐典笅锛屾湳璇滆妭鐐光濈敤浜庢寚璁$畻鏈猴紝浣嗗湪璁ㄨMySQL绨囨椂锛屽畠琛ㄧず鐨勬槸杩涚▼銆傚湪鍗曞彴璁$畻鏈轰笂鍙互鏈変换鎰忔暟鐩殑鑺傜偣锛屼负姝わ紝鎴戜滑閲囩敤鏈绨囦富鏈

鏈変笁绫荤皣鑺傜偣锛屽湪鏈浣庣殑MySQL绨囬厤缃腑锛岃嚦灏戞湁涓変釜鑺傜偣锛岃繖涓夌被鑺傜偣鍒嗗埆鏄細

         绠$悊(MGM)鑺傜偣锛氳繖绫昏妭鐐圭殑浣滅敤鏄鐞MySQL绨囧唴鐨勫叾浠栬妭鐐癸紝濡傛彁渚涢厤缃暟鎹佸惎鍔ㄥ苟鍋滄鑺傜偣銆佽繍琛屽浠界瓑銆傜敱浜庤繖绫昏妭鐐硅礋璐g鐞嗗叾浠栬妭鐐圭殑閰嶇疆锛屽簲鍦ㄥ惎鍔ㄥ叾浠栬妭鐐逛箣鍓嶉鍏堝惎鍔ㄨ繖绫昏妭鐐广MGM鑺傜偣鏄敤鍛戒护ndb_mgmd鍚姩鐨勩

         鏁版嵁鑺傜偣锛杩欑被鑺傜偣鐢ㄤ簬淇濆瓨绨囩殑鏁版嵁銆傛暟鎹妭鐐圭殑鏁扮洰涓庡壇鏈殑鏁扮洰鐩稿叧锛屾槸鐗囨鐨勫嶆暟銆備緥濡傦紝瀵逛簬涓や釜鍓湰锛屾瘡涓壇鏈湁涓や釜鐗囨锛岄偅涔堝氨鏈4涓暟鎹妭鐐广傛病鏈夊繀瑕佹湁涓涓互涓婄殑鍓湰銆傛暟鎹妭鐐规槸鐢ㄥ懡浠ndbd鍚姩鐨勩

         SQL鑺傜偣锛杩欐槸鐢ㄦ潵璁块棶绨囨暟鎹殑鑺傜偣銆傚浜MySQL绨囷紝瀹㈡埛绔妭鐐规槸浣跨敤NDB绨囧瓨鍌ㄥ紩鎿庣殑浼犵粺MySQL鏈嶅姟鍣ㄣ傚吀鍨嬫儏鍐典笅锛SQL鑺傜偣鏄娇鐢ㄥ懡浠mysqld ndbcluster鍚姩鐨勶紝鎴栧皢ndbcluster娣诲姞鍒my.cnf鍚庝娇鐢mysqld鍚姩銆

绨囬厤缃寘鎷绨囦腑鍗曠嫭鑺傜偣鐨勯厤缃紝浠ュ強璁剧疆鑺傜偣涔嬮棿鐨勫崟鐙氫俊閾捐矾銆傚浜庣洰鍓嶈璁$殑MySQL绨囷紝鍏舵剰鍥惧湪浜庯紝浠庡鐞嗗櫒鐨勮兘鍔涖佸唴瀛樼┖闂村拰甯﹀鏉ヨ锛屽瓨鍌ㄨ妭鐐规槸鍚岃川鐨勶紝姝ゅ锛屼负浜嗘彁渚涘崟涓鐨勯厤缃偣锛屼綔涓烘暣浣擄紝绨囩殑鎵鏈夐厤缃暟鎹潎浣嶄簬1涓厤缃枃浠朵腑銆

绠$悊鏈嶅姟鍣(MGM鑺傜偣)璐熻矗绠$悊绨囬厤缃枃浠跺拰绨囨棩蹇椼傜皣涓殑姣忎釜鑺傜偣浠庣鐞嗘湇鍔″櫒妫绱㈤厤缃暟鎹紝骞惰姹傜‘瀹氱鐞嗘湇鍔″櫒鎵鍦ㄤ綅缃殑鏂瑰紡銆傚綋鏁版嵁鑺傜偣鍐呭嚭鐜版湁瓒g殑浜嬩欢鏃讹紝鑺傜偣灏嗗叧浜庤繖绫讳簨浠剁殑淇℃伅浼犺緭鍒扮鐞嗘湇鍔″櫒锛岀劧鍚庯紝灏嗚繖绫讳俊鎭啓鍏ョ皣鏃ュ織銆

姝ゅ锛屽彲浠ユ湁浠绘剰鏁扮洰鐨勭皣瀹㈡埛绔繘绋嬫垨搴旂敤绋嬪簭銆傚畠浠垎涓轰袱绉嶇被鍨嬶細

         鏍囧噯MySQL瀹㈡埛绔細瀵逛簬MySQL绨囷紝瀹冧滑涓庢爣鍑嗙殑锛堥潪绨囩被锛MySQL娌℃湁鍖哄埆銆傛崲鍙ヨ瘽璁诧紝鑳藉浠庣敤PHPPerlCC++JavaPythonRuby绛夌紪鍐欑殑鐜版湁MySQL搴旂敤绋嬪簭璁块棶MySQL绨囥

         绠$悊瀹㈡埛绔锛氳繖绫诲鎴风涓庣鐞嗘湇鍔″櫒鐩歌繛锛屽苟鎻愪緵浜嗕紭闆呭湴鍚姩鍜屽仠姝㈣妭鐐广佸惎鍔ㄥ拰鍋滄娑堟伅璺熻釜锛堜粎瀵硅皟璇曠増鏈級銆佹樉绀鸿妭鐐圭増鏈拰鐘舵併佸惎鍔ㄥ拰鍋滄澶囦唤绛夌殑鍛戒护銆

17.3. 澶氳绠楁満鐨勭畝鍗曞熀纭鐭ヨ瘑

鏈妭浠嬬粛浜嗗浣曡鍒掋佸畨瑁呫侀厤缃拰杩愯MySQL绨囩殑鍩烘湰鐭ヨ瘑銆備笌17.4鑺傦紝鈥淢ySQL绨囩殑閰嶇疆鈥涓粰鍑虹殑绀轰緥涓嶅悓锛屾寜鐓т笅闈粙缁嶇殑姝ラ鍜屾寚鍗楋紝鎵寰楃殑缁撴灉搴旀槸鏈夌敤鐨MySQL绨囷紝瀹冩弧瓒冲鏁版嵁鍙敤鎬у拰瀹夊叏闃叉姢鐨勬渶浣庤姹傘

鍦ㄦ湰鑺備腑锛屾垜浠粙缁嶄簡涓嬭堪鍐呭锛氱‖浠跺拰杞欢瑕佹眰锛岃仈缃戜簨瀹滐紝MySQL绨囩殑瀹夎锛岄厤缃簨瀹滐紝绨囩殑鍚姩銆佸仠姝㈠拰閲嶅惎锛屽姞杞芥牱鏈暟鎹簱锛屼互鍙婃墽琛屾煡璇㈢殑鏂规硶銆

鍩烘湰鍋囧畾

鏈妭浣滀簡濡備笅鍋囧畾锛

1.    鎴戜滑灏嗗缓绔嬪叿鏈4涓妭鐐圭殑绨囷紝姣忎釜鑺傜偣浣嶄簬涓嶅悓鐨勪富鏈轰笂锛岃屼笖鍦ㄥ吀鍨嬬殑浠ュお缃戜腑鍏锋湁鍥哄畾鐨勭綉缁滃湴鍧锛屽涓嬫墍杩帮細

鑺傜偣

IP鍦板潃

绠$悊(MGM)鑺傜偣

192.168.0.10

MySQL鏈嶅姟鍣(SQL)鑺傜偣

192.168.0.20

鏁版嵁(NDBD)鑺傜偣"A"

192.168.0.30

鏁版嵁(NDBD)鑺傜偣"B"

192.168.0.40

2.    閫氳繃涓嬪浘鍙洿娓呮鐨勮〃鏄庤繖鐐癸細

  1. MySQL Cluster Multi-Computer
            Setup

4.    娉ㄩ噴锛鍑轰簬绠鍗曟э紙浠ュ強鍙潬鎬э級鏂归潰鐨勮冭檻锛屽湪鏈熀鏈煡璇嗕粙缁嶄腑鎴戜滑浠呬娇鐢ㄦ暟鍊IP鍦板潃銆備絾鏄紝濡傛灉鍦ㄤ綘鐨勭綉缁滀腑鍏峰DNS瑙f瀽鍔熻兘锛屽湪閰嶇疆绨囩殑杩囩▼涓紝鍙娇鐢ㄤ富鏈哄悕浠f浛IP鍦板潃銆備綔涓哄彲閫夋柟寮忥紝涔熻兘浣跨敤/etc/hosts鏂囦欢锛屾垨鑳芥彁渚涗富鏈烘煡璇㈢殑鎿嶄綔绯荤粺鐨勭瓑鏁堢墿锛堝鏋滃彲鐢ㄧ殑璇濓級銆

5.    鍦ㄦ垜浠殑鍦烘櫙涓紝姣忓彴涓绘満鍧囨槸鍩轰簬Intel鐨勬闈PCPC涓婅繍琛岀殑鏄父瑙佺殑涓鑸Linux鐗堟湰锛屾搷浣滅郴缁熶互鏍囧噯閰嶇疆瀹夎鍦ㄧ鐩樹笂锛屾湭杩愯浠讳綍涓嶅繀瑕佺殑鏈嶅姟銆傚叿澶囨爣鍑TCP/IP鑱旂綉瀹㈡埛绔殑鏍稿績鎿嶄綔绯荤粺搴旇冻浠ョ鍚堟垜浠殑瑕佹眰銆傛澶栵紝涓轰簡绠鍗曟э紝鎴戜滑杩樺亣瀹氭墍鏈変富鏈轰笂鐨勬枃浠剁郴缁熸槸绛夊悓鐨勩傚鏋滆繖浜涗富鏈轰笂鐨勬枃浠剁郴缁熶笉鍚岋紝灏遍渶瀵硅繖浜涜鏄庝綔鐩稿簲鐨勮皟鏁淬

6.    鍦ㄦ瘡鍙版満鍣ㄤ笂瀹夎浜嗘爣鍑嗙殑100 Mbps1鍚夋瘮鐗逛互澶綉鍗★紝涓烘瘡鍧楃綉鍗″畨瑁呬簡鎭板綋鐨勯┍鍔ㄧ▼搴忥紝骞剁敤鏍囧噯鐨勪互澶綉鑱旂綉瑁呯疆锛堝浜ゆ崲鍣ㄧ瓑锛夊皢4鍙颁富鏈鸿繛鎺ヨ捣鏉ワ紙鎵鏈夋満鍣ㄥ簲浣跨敤鍏锋湁鐩稿悓瀹归噺鐨勭綉鍗★紝涔熷氨鏄锛岀皣涓殑鎵鏈4鍙版満鍣ㄥ簲鍏ㄩ儴浣跨敤100M缃戝崱锛屾垨鍏ㄩ儴浣跨敤1G缃戝崱锛夈MySQL绨囧皢宸ヤ綔鍦100 Mbps缃戠粶涓紝浣嗗悏姣旂壒浠ュお缃戣兘鎻愪緵鏇村ソ鐨勬ц兘銆

娉ㄦ剰锛MySQL绨囦笉閫傚悎浜庤繛閫氭т綆浜100 Mbps鐨勭綉缁溿傚嚭浜庤鍘熷洜锛堝挨鍏舵槸锛夛紝鍦ㄥ叕鍏辩綉缁滃Internet涓婅繍琛MySQL绨囧緢闅炬垚鍔燂紝涔熶笉鎺ㄨ崘杩欐牱鍋氥

7.    瀵逛簬鏍锋湰鏁版嵁锛屾垜浠皢浣跨敤涓栫晫鏁版嵁搴擄紝璇ユ暟鎹簱鍙粠MySQL AB鍏徃鐨勭綉绔欎笂涓嬭浇銆傜敱浜庤鏁版嵁搴撳崰鐢ㄧ殑绌洪棿鐩稿杈冨皬锛屾垜浠亣瀹氭瘡鍙版満鍣ㄦ湁256 MB RAM锛岃繖瓒充互杩愯鎿嶄綔绯荤粺銆佷富鏈NDB杩涚▼銆佷互鍙婂瓨鍌ㄦ暟鎹簱锛堝浜庢暟鎹妭鐐癸級銆

灏界鍦ㄦ湰鍩烘湰浠嬬粛涓噰鐢ㄧ殑鏄Linux鎿嶄綔绯荤粺锛屼絾瀵硅繖閲岀粰鍑虹殑璇存槑鍜屾楠ゆ潵璇达紝浠呰繃绠鍗曠殑淇敼锛屼篃鑳介傜敤浜SolarisMac OS X銆傛澶栵紝鎴戜滑杩樺亣瀹氫綘宸叉帉鎻′簡瀹夎鍜岄厤缃叿澶囪仈缃戝姛鑳界殑鎿嶄綔绯荤粺鐨勫熀鏈煡璇嗭紝鎴栬兘澶熷湪闇瑕佺殑鏃跺欒幏寰楀府鍔┿

涓嬩竴鑺傦紝鎴戜滑鏇磋缁嗗湴璁ㄨ浜MySQL绨囩殑纭欢銆佽蒋浠跺拰鑱旂綉瑕佹眰銆傦紙璇峰弬瑙17.3.1鑺傦紝鈥滅‖浠躲佽蒋浠跺拰鑱旂綉鈥锛夈

17.3.1. 纭欢銆佽蒋浠跺拰鑱旂綉

MySQL绨囩殑涓涓己澶т紭鐐瑰湪浜庯紝瀹冭兘杩愯鍦ㄦ櫘閫氱‖浠朵笂锛岄櫎浜嗛渶瑕佽緝澶х殑RAM澶栧湪杩欑偣涓婃病鏈夌壒娈婅姹傦紝杩欐槸鍥犱负瀹為檯鐨勬暟鎹瓨鍌ㄥ潎鏄湪鍐呭瓨涓繘琛岀殑銆傦紙娉ㄦ剰锛屾湭鏉ヨ繖鐐逛細鏀瑰彉锛屾垜浠墦绠楀湪鏈潵鐨MySQL绨囩増鏈腑瀹炵幇鍩轰簬纾佺洏鐨勫瓨鍌級銆傛樉鐒讹紝澶氫釜CPU鍜屾洿蹇殑CPU鑳藉寮烘ц兘銆傚浜庣皣杩涚▼鏉ヨ锛屽鍐呭瓨鐨勮姹傜浉瀵硅緝灏戙

绨囩殑杞欢瑕佹眰绋嬪害閫備腑銆備富鏈烘搷浣滅郴缁熶笉闇瑕佷换浣曠壒娈婃ā鍧椼佹湇鍔°佸簲鐢ㄧ▼搴忋佹垨閰嶇疆灏辫兘鏀寔MySQL绨囥傚浜Mac OS XSolaris锛屾爣鍑嗗畨瑁呭氨宸茶冻澶熴傚浜Linux锛屾爣鍑嗙殑鈥鍗冲紑鍗崇敤鈥濆畨瑁呭簲鏄墍闇鐨勫叏閮ㄣMySQL杞欢瑕佹眰寰堢畝鍗曪細MySQL-max 5.1鐨勭敓浜х増灏辨槸鎵闇鐨勫叏閮紝瑕佹兂鑾峰緱绨囨敮鎸侊紝蹇呴』浣跨敤MySQL-max鐗堟湰銆傛棤闇鑷繁缂栬瘧MySQL灏辫兘浣跨敤绨囥傚湪鏈妭涓紝鎴戜滑鍋囧畾浣犱娇鐢ㄤ簡涓Linux鐩搁傚簲鐨-max浜岃繘鍒剁増鏈傚浜SolarisMac OS X鎿嶄綔绯荤粺锛岀浉搴旂殑閮ㄥ垎鍙氳繃MySQL杞欢涓嬭浇椤甸潰鑾峰緱锛http://dev.mysql.com/downloads/

瀵逛簬鑺傜偣涔嬮棿鐨勯氫俊锛岀皣鏀寔閲囩敤鏍囧噯鎷撴墤鏂规鐨TCP/IP鑱旂綉锛屽浜庢瘡鍙颁富鏈虹殑棰勬湡鏈浣庤姹傛槸1鍧楁爣鍑嗙殑100 Mbps浠ュお缃戝崱锛屽浜庝綔涓烘暣浣撶殑绨囷紝杩橀渶鍔犱笂浜ゆ崲鍣ㄣ佺綉缁滈泦绾垮櫒鎴栬矾鐢卞櫒浠ユ彁渚涚綉缁滆繛閫氭с傛垜浠己鐑堝缓璁紝搴斿湪鍏惰嚜宸辩殑瀛愮綉鍐呰繍琛MySQL绨囷紝涓嶄笌闈炵皣鏈哄櫒鍏变韩璇ュ瓙缃戯紝鍘熷洜濡備笅锛

         瀹夊叏鎬э細绨囪妭鐐逛箣闂寸殑閫氫俊鏈噰鐢ㄤ换浣曠壒娈婂姞瀵嗘垨闃叉姢銆傚MySQL绨囧唴浼犺緭鐨勫敮涓淇濇姢鏂规硶鏄紝鍦ㄥ彈淇濇姢鐨勭綉缁滀笂杩愯绨囥傚鏋滄墦绠楀皢MySQL绨囩敤浜Web搴旂敤锛岀皣搴旀槑纭湴浣嶄簬闃茬伀澧欏悗闈紝鑰屼笖涓嶅簲浣嶄簬缃戠粶鐨勯潪鍐涗簨鍖猴紙DMZ锛夋垨鍏朵粬鍦版柟銆

         鏁堢巼锛鍦ㄤ笓鏈夌殑鎴栧彈淇濇姢鐨勭綉缁滀笂璁剧疆MySQL绨囷紝杩欐牱锛岀皣灏辫兘鐙韩绨囦富鏈轰箣闂寸殑甯﹀銆備负MySQL绨囦娇鐢ㄥ崟鐙殑浜ゆ崲鍣ㄤ笉浠呰兘闃叉瀵圭皣鏁版嵁鐨勯潪娉曡闂紝鑰屼笖杩樿兘纭繚绨囪妭鐐逛笉鍙楃綉缁滀笂鍏朵粬璁$畻鏈轰箣闂翠俊鎭紶杈撶殑骞叉壈銆備负浜嗗寮哄彲闈犳э紝鍙互浣跨敤鍙屼氦鎹㈠櫒鍜屽弻鍗★紝浠ラ槻姝㈢綉缁滃嚭鐜板崟鐐规晠闅滐紝瀵逛簬杩欑被閫氫俊閾捐矾锛屽緢澶氳澶囬┍鍔ㄥ潎鏀寔鏁呴殰鍒囨崲鍔熻兘銆

涔熻兘涓MySQL绨囦竴璧蜂娇鐢ㄩ珮閫SCI锛堣妯″彲鎵╁睍鐨勮绠楁満鎺ュ彛锛夛紝浣嗚繖涓嶆槸瑕佹眰鐨勩傚叧浜庤鍗忚鐨勬洿澶氫俊鎭紝浠ュ強瀹冧笌MySQL绨囩殑鐢ㄦ硶锛岃鍙傝17.7鑺傦紝鈥滀娇鐢ㄤ笌MySQL绨囩殑楂橀熶簰杩炩

17.3.2. 瀹夎

瀵逛簬姣忓彴杩愯瀛樺偍鎴SQL鑺傜偣鐨MySQL绨囦富鏈鸿绠楁満锛屽繀椤诲湪鍏朵笂瀹夎MySQL-max浜岃繘鍒剁増鏈傚浜庣鐞嗚妭鐐癸紝娌℃湁蹇呰瀹夎MySQL鏈嶅姟鍣ㄤ簩杩涘埗鐗堟湰锛屼絾搴斿畨瑁MGM鏈嶅姟鍣ㄧ鍙g洃鐫g▼搴忓拰瀹㈡埛绔簩杩涘埗鐗堟湰锛堝垎鍒槸ndb_mgmdndb_mgm锛夈傚湪鏈妭涓紝鎴戜滑浠嬬粛浜嗕负姣忕绨囪妭鐐瑰畨瑁呮纭殑浜岃繘鍒剁増鏈墍闇鐨勬楠ゃ

MySQL AB鎻愪緵浜嗛缂栬瘧鐨勪簩杩涘埗鏂囦欢锛屽畠浠敮鎸佺皣锛屼綘涓嶉渶瑕佽嚜宸辩紪璇戣繖浜涙枃浠讹紙濡傛灉浣犵‘瀹為渶瑕佸畾鍒剁殑浜岃繘鍒舵枃浠讹紝璇峰弬瑙2.8.3鑺傦紝鈥滀粠寮鍙戞簮鐮佹爲瀹夎鈥锛夈傚洜姝わ紝瀵逛簬姣忓彴绨囦富鏈猴紝瀹夎杩涚▼鐨勭涓姝ユ槸浠MySQL涓嬭浇鍖涓嬭浇鏂囦欢mysql-max-5.1.2-alpha-pc-linux-gnu-i686.tar.gz銆傛垜浠亣瀹氫綘灏嗚鏂囦欢鏀惧湪鍚勬満鍣ㄧ殑/var/tmp鐩綍涓嬨

瀵逛簬32浣嶅拰64Linux骞冲彴锛屽潎鏈夌浉搴旂殑RPMRPM瀹夎鐨-max浜岃繘鍒舵枃浠舵敮鎸NDB绨囧瓨鍌ㄥ紩鎿庛傚鏋滀綘閫夋嫨浣跨敤瀹冧滑鑰屼笉鏄簩杩涘埗鏂囦欢锛屽姟蹇呭湪杩愯绨囪妭鐐圭殑鎵鏈夋満鍣ㄤ笂瀹夎-server-max杞欢鍖锛堝叧浜庝娇鐢RPM瀹夎MySQL鐨勬洿澶氫俊鎭紝璇峰弬瑙2.4鑺傦紝鈥滃湪Linux涓嬪畨瑁匨ySQL鈥锛夈備娇鐢RPM瀹屾垚瀹夎鍚庯紝浠嶉渶瀵圭皣杩涜閰嶇疆锛岃鍙傝17.3.3鑺傦紝鈥滈厤缃

娉ㄩ噴锛瀹屾垚瀹夎鍚庯紝涓嶅惎鍔ㄤ换浣曚簩杩涘埗鏂囦欢銆傞厤缃畬鎵鏈夎妭鐐瑰悗锛屾垜浠皢鍚戜綘浠嬬粛鎵ц杩欑被鎿嶄綔鐨勬柟娉曘

瀛樺偍鑺傜偣鍜SQL鑺傜偣瀹夎

鍦ㄨ璁′负杩愯瀛樺偍鑺傜偣鎴SQL鑺傜偣鐨勪笁鍙版満鍣ㄧ殑姣忎竴鍙颁笂锛屼互绯荤粺鏍圭敤鎴疯韩浠芥墽琛屼笅杩版楠わ細

1.    妫鏌ヤ綘鐨/etc/passwd/etc/group鏂囦欢锛堟垨浣跨敤鎿嶄綔绯荤粺鎻愪緵鐨勭敤浜庣鐞嗙敤鎴峰拰缁勭殑宸ュ叿锛夛紝鏌ョ湅鍦ㄧ郴缁熶笂鏄惁宸插瓨鍦mysqlmysql鐢ㄦ埛锛岃繖鏄洜涓烘煇浜涙搷浣滅郴缁熶細灏嗗叾浣滀负瀹夎杩涚▼鐨勪竴閮ㄥ垎浜堜互鍒涘缓銆傚鏋滃畠浠笉瀛樺湪锛屽垱寤烘柊鐨mysql鐢ㄦ埛缁锛岀劧鍚庝负璇ョ粍娣诲姞1mysql鐢ㄦ埛銆

2.           groupadd mysql
3.           useradd -g mysql mysql

4.    杩涘叆鍖呭惈涓嬭浇鏂囦欢鐨勭洰褰曪紝瑙e寘妗f鏂囦欢锛屽苟鍒涘缓涓mysql-max鍙墽琛屾枃浠剁殑symlink銆傛敞鎰忥紝鏍规嵁MySQL鐨勭増鏈彿锛屽疄闄呯殑鏂囦欢鍚嶅拰鐩綍鍚嶄細鏈夋墍涓嶅悓銆

5.           cd /var/tmp
6.           tar -xzvf -C /usr/local/bin mysql-max-5.1.2-alpha-pc-linux-gnu-i686.tar.gz
7.           ln -s /usr/local/bin/mysql-max-5.1.2-alpha-pc-linux-gnu-i686 mysql

8.    杩涘叆mysql鐩綍锛杩愯鎵鎻愪緵鐨勭敤浜庡垱寤虹郴缁熸暟鎹簱鐨勮剼鏈細

9.           cd mysql
10.       scripts/mysql_install_db --user=mysql

11.MySQL鏈嶅姟鍣ㄥ拰鏁版嵁鐩綍璁剧疆蹇呰鐨勬潈闄愶細

12.       chown -R root .
13.       chown -R mysql data
14.       chgrp -R mysql .

娉ㄦ剰锛屽湪姣忓彴杩愯鏁版嵁鑺傜偣鐨勬満鍣ㄤ笂锛屾暟鎹洰褰曟槸/usr/local/mysql/data銆傞厤缃鐞嗚妭鐐规椂灏嗙敤鍒拌繖绫讳俊鎭锛堣鍙傝17.3.3鑺傦紝鈥滈厤缃锛夈

15.MySQL鍚姩鑴氭湰鎷疯礉鍒版伆褰撶殑鐩綍涓嬶紝浣夸箣鎴愪负鍙墽琛岀殑鑴氭湰锛屽苟璁剧疆瀹冧互渚垮湪鍚姩鎿嶄綔绯荤粺鏃跺惎鍔細

16.       cp support-files/mysql.server /etc/rc.d/init.d/
17.       chmod +x /etc/rc.d/init.d/mysql.server
18.       chkconfig --add mysql.server

鍦ㄦ锛屾垜浠娇鐢Red Hatchkconfig鏉ュ垱寤轰笌鍚姩鑴氭湰鐨勯摼鎺ワ紝璇峰湪浣犵殑鎿嶄綔绯荤粺涓婁娇鐢ㄦ伆褰撶殑鐢ㄤ簬璇ョ洰鐨勭殑鏂瑰紡锛屽Debian涓婄殑update-rc.d

璇疯浣忥紝瀵逛簬瀛樺偍鑺傜偣鎴SQL鑺傜偣鎵鍦ㄧ殑姣忓彴鏈哄櫒锛屽繀椤诲垎鍒寚鍚戜笂杩版楠ゃ

绠$悊鑺傜偣瀹夎

瀵逛簬MGM锛堢鐞嗭級鑺傜偣锛屼笉闇瑕佸畨瑁mysqld鍙墽琛屾枃浠讹紝浠呴渶瀹夎鐢ㄤ簬MGM鏈嶅姟鍣ㄥ拰瀹㈡埛绔殑浜岃繘鍒舵枃浠讹紝杩欑被鏂囦欢鍙湪涓嬭浇鐨-max妗f涓壘鍒般傚啀娆″亣瀹氫綘灏嗚鏂囦欢鏀惧湪浜/var/tmp鐩綍涓嬶紝寮曞绯荤粺鏃锛堜篃灏辨槸璇翠娇鐢sudo, su root鎴栫郴缁熺殑绛夋晥鍛戒护鍚庯紝鍋囧畾鍏锋湁绯荤粺绠$悊鍛樿处鎴风殑鏉冮檺锛夛紝鎵ц涓嬭堪姝ラ锛屽湪绨囩鐞嗚妭鐐逛富鏈轰笂瀹夎ndb_mgmdndb_mgm

1.    鍗冲/var/tmp鐩綍锛屼粠妗f鏂囦欢涓皢ndb_mgmndb_mgmd鎻愬彇鍒版伆褰撶殑鐩綍涓嬶紝濡/usr/local/bin

2.           cd /var/tmp
3.           tar -zxvf mysql-max-5.1.2-alpha-pc-linux-gnu-i686.tar.gz /usr/local/bin '*/bin/ndb_mgm*'

4.    杩涘叆瑙e寘鏂囦欢鎵鍦ㄧ殑鐩綍锛岀劧鍚庝娇杩欎袱涓枃浠舵垚涓哄彲鎵ц鐨勶細

5.           cd /usr/local/bin
6.           chmod +x ndb_mgm*

17.3.3鑺傦紝鈥滈厤缃涓紝鎴戜滑灏嗕负绀轰緥绨囦腑鐨勬墍鏈夎妭鐐瑰垱寤哄拰缂栧啓閰嶇疆鏂囦欢銆

17.3.3. 閰嶇疆

瀵逛簬鎴戜滑鐨4鑺傜偣銆4涓绘満MySQL绨囷紝闇瑕佺紪鍐4涓厤缃枃浠讹紝姣忎釜鑺傜偣/涓绘満1涓

         姣忎釜鏁版嵁鑺傜偣鎴SQl鑺傜偣闇瑕1my.cnf鏂囦欢锛岃鏂囦欢鎻愪緵浜嗕袱绫讳俊鎭connectstring锛堣繛鎺ュ瓧绗︿覆锛夛紝鐢ㄤ簬閫氱煡鑺傜偣鍒板摢閲屾壘鍒MGM鑺傜偣锛涗互鍙婁竴琛岋紝鐢ㄤ簬閫氱煡璇ヤ富鏈猴紙瀹圭撼鏁版嵁鑺傜偣鐨勬満鍣級涓婄殑MySQL鏈嶅姟鍣ㄨ繍琛屽湪NDB妯″紡涓嬨

鍏充簬杩炴帴瀛楃涓茬殑鏇村淇℃伅锛岃鍙傝17.4.4.2鑺傦紝鈥淢ySQL绨囪繛鎺ュ瓧绗︿覆

         绠$悊鑺傜偣闇瑕config.ini鏂囦欢锛璇ユ枃浠堕氱煡鑺傜偣鏈夊灏戦渶瑕佺淮鎶ょ殑鍓湰锛岄渶瑕佸湪姣忎釜鏁版嵁鑺傜偣涓婁负鏁版嵁鍜岀储寮曞垎閰嶅灏戝唴瀛橈紝鏁版嵁鑺傜偣鐨勪綅缃紝鍦ㄦ瘡涓暟鎹妭鐐逛笂淇濆瓨鏁版嵁鐨勭鐩樹綅缃紝浠ュ強SQL鑺傜偣鐨勪綅缃

閰嶇疆瀛樺偍鑺傜偣鍜SQL鑺傜偣

鏁版嵁鑺傜偣鎵闇鐨my.cnf鏂囦欢鐩稿綋绠鍗曘傞厤缃枃浠跺簲浣嶄簬/etc鐩綍涓嬶紝骞惰兘鐢ㄤ换浣曟枃鏈紪杈戝櫒杩涜缂栬緫锛堝鏈夊繀瑕侊紝鍒涘缓璇ユ枃浠讹級锛屼緥濡傦細

vi /etc/my.cnf

瀵逛簬鏈ず渚嬩腑鐨勬瘡涓暟鎹妭鐐瑰拰SQL鑺傜偣锛my.cnf鏂囦欢绫讳技浜庯細

# Options for mysqld process:
[MYSQLD]                        
ndbcluster                      # run NDB engine
ndb-connectstring=192.168.0.10  # location of MGM node
 
# Options for ndbd process:
[MYSQL_CLUSTER]                 
ndb-connectstring=192.168.0.10  # location of MGM node

杈撳叆涓婅堪鍐呭鍚庯紝淇濆瓨鏂囦欢骞堕鍑烘枃鏈紪杈戝櫒銆傚湪瀹圭撼鏁版嵁鑺傜偣鈥A鈥濄佹暟鎹妭鐐光B鈥濆拰SQL鑺傜偣鐨勬満鍣ㄤ笂鍒嗗埆鎵ц涓婅堪鎿嶄綔銆

閰嶇疆绠$悊鑺傜偣

閰嶇疆MGM鑺傜偣鐨勭涓姝ユ槸鍒涘缓鐩綍锛岃鐩綍鐢ㄤ簬瀛樻斁閰嶇疆鏂囦欢锛岀劧鍚庡垱寤洪厤缃枃浠舵湰韬備緥濡傦紙浠ユ牴鐢ㄦ埛韬唤杩愯锛夛細

mkdir /var/lib/mysql-cluster
cd /var/lib/mysql-cluster
vi config.ini

鍦ㄦ浣跨敤浜vi鏉ュ垱寤烘枃浠讹紝涓嶈繃锛屼换浣曟枃鏈紪杈戝櫒鍧囧簲鑳借儨浠汇

瀵逛簬鎴戜滑鐨勫吀鍨嬭缃紝config.ini鏂囦欢搴旂被浼间簬锛

# Options affecting ndbd processes on all data nodes:
[NDBD DEFAULT]    
NoOfReplicas=2    # Number of replicas
DataMemory=80M    # How much memory to allocate for data storage
IndexMemory=18M   # How much memory to allocate for index storage
                  # For DataMemory and IndexMemory, we have used the
                  # default values. Since the "world" database takes up
                  # only about 500KB, this should be more than enough for
                  # this example Cluster setup.
 
# TCP/IP options:
[TCP DEFAULT]     
portnumber=2202   # This the default; however, you can use any
                  # port that is free for all the hosts in cluster
                  # Note: It is recommended beginning with MySQL 5.0 that
                  # you do not specify the portnumber at all and simply allow
                  # the default value to be used instead
 
# Management process options:
[NDB_MGMD]                      
hostname=192.168.0.10           # Hostname or IP address of MGM node
datadir=/var/lib/mysql-cluster  # Directory for MGM node logfiles
 
# Options for data node "A":
[NDBD]                          
                                # (one [NDBD] section per data node)
hostname=192.168.0.30           # Hostname or IP address
datadir=/usr/local/mysql/data   # Directory for this data node's datafiles
 
# Options for data node "B":
[NDBD]                          
hostname=192.168.0.40           # Hostname or IP address
datadir=/usr/local/mysql/data   # Directory for this data node's datafiles
 
# SQL node options:
[MYSQLD]                        
hostname=192.168.0.20           # Hostname or IP address
                                # (additional mysqld connections can be
                                # specified for this node for various
                                # purposes such as running ndb_restore)

娉ㄩ噴锛"world"鏁版嵁搴撳彲浠庣珯鐐http://dev.mysql.com/doc/涓嬭浇锛屽畠鍒楀湪鈥滅ず渚嬧濇爮鐩笅锛夈

涓鏃﹀垱寤轰簡鎵鏈夌殑閰嶇疆鏂囦欢骞舵寚瀹氫簡杩欎簺鏈浣庨夐」锛屽彲鍚姩绨囷紝骞堕獙璇佹墍鏈夎繘绋嬪潎鑳芥甯歌繍琛屻傚叧浜庤繖鏂归潰鐨勮璁猴紝璇峰弬瑙17.3.4鑺傦紝鈥滈娆″惎鍔ㄢ

鍏充簬鍙敤MySQL绨囬厤缃弬鏁颁互鍙婂叾鐢ㄦ硶鐨勬洿澶氫俊鎭紝璇峰弬瑙17.4.4鑺傦紝鈥滈厤缃枃浠垛17.4鑺傦紝鈥淢ySQL绨囩殑閰嶇疆鈥銆傚叧浜庝笌杩涜澶囦唤鏈夊叧鐨MySQL绨囬厤缃紝璇峰弬瑙17.6.5.4鑺傦紝鈥滅皣澶囦唤鐨勯厤缃

娉ㄩ噴锛绨囩鐞嗚妭鐐圭殑榛樿绔彛鏄1186锛屾暟鎹妭鐐圭殑榛樿绔彛2202銆備粠MySQL 5.0.3寮濮嬶紝璇ラ檺鍒跺凡琚斁瀹斤紝绨囪兘澶熸牴鎹┖闂茬殑绔彛鑷姩鍦颁负鏁版嵁鑺傜偣鍒嗛厤绔彛銆

17.3.4. 棣栨鍚姩

瀹屾垚閰嶇疆鍚庯紝鍚姩绨囧苟涓嶅緢鍥伴毦銆傚繀椤诲湪鏁版嵁鑺傜偣鎵鍦ㄧ殑涓绘満涓婂垎鍒惎鍔ㄦ瘡涓皣鑺傜偣杩涚▼銆傚敖绠¤兘澶熸寜浠讳綍椤哄簭鍚姩鑺傜偣锛屼絾鎴戜滑寤鸿锛屽簲棣栧厛鍚姩绠$悊鑺傜偣锛岀劧鍚庡惎鍔ㄥ瓨鍌ㄨ妭鐐癸紝鏈鍚庡惎鍔SQL鑺傜偣锛

1.    鍦ㄧ鐞嗕富鏈轰笂锛屼粠绯荤粺shell鍙戝嚭涓嬭堪鍛戒护浠ュ惎鍔MGM鑺傜偣杩涚▼锛

2.           shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini

娉ㄦ剰锛屽繀椤荤敤鈥-f鈥--config-file鈥閫夐」锛鍛婅瘔ndb_mgmd鍒板摢閲屾壘鍒伴厤缃枃浠讹紙璇︽儏璇峰弬瑙17.5.3鑺傦紝鈥ndb_mgmd锛屸滅鐞嗘湇鍔″櫒鈥濊繘绋嬧锛夈

3.    鍦ㄦ瘡鍙版暟鎹妭鐐逛富鏈轰笂锛屽浜庨娆″惎鍔紝杩愯涓嬭堪鍛戒护鍚姩NDBD杩涚▼锛

4.           shell> ndbd --initial

娉ㄦ剰锛屼粎搴斿湪棣栨鍚姩ndbd鏃讹紝鎴栧湪澶囦唤锛忔仮澶嶆垨閰嶇疆鍙樺寲鍚庨噸鍚ndbd鏃朵娇鐢ㄢ--initial鈥濆弬鏁帮紝杩欏緢閲嶈銆傚師鍥犲湪浜庯紝璇ュ弬鏁颁細浣胯妭鐐瑰垹闄ょ敱鏃╂湡ndbd瀹炰緥鍒涘缓鐨勩佺敤浜庢仮澶嶇殑浠讳綍鏂囦欢锛屽寘鎷仮澶嶇敤鏃ュ織鏂囦欢銆

5.    濡傛灉浣跨敤RPMSQL鑺傜偣鎵鍦ㄧ殑绨囦富鏈轰笂瀹夎浜MySQL锛岃兘澶燂紙涔熷簲褰擄級浣跨敤瀹夎鍦/etc/init.d涓嬬殑鍚姩鑴氭湰鍦SQL鑺傜偣涓婂惎鍔MySQL鏈嶅姟鍣ㄨ繘绋嬨傛敞鎰忥紝瑕佹兂杩愯鈥-max鈥濇湇鍔″櫒浜岃繘鍒舵枃浠讹紝闄や簡鏍囧噯鐨RPM澶栵紝杩橀渶瑕佸畨瑁-max鏈嶅姟鍣RPM

濡傛灉涓鍒囬『鍒╋紝骞跺凡姝g‘璁剧疆浜嗙皣锛岄偅涔堢皣鐜板湪搴旇兘杩愯銆傞氳繃璋冪敤ndb_mgm绠$悊鑺傜偣瀹㈡埛绔紝鍙鍏惰繘琛屾祴璇曘傚叾杈撳嚭搴旂被浼间簬锛

shell> ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> SHOW
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=2    @192.168.0.30  (Version: 5.1.2-alpha, Nodegroup: 0, Master)
id=3    @192.168.0.40  (Version: 5.1.2-alpha, Nodegroup: 0)
 
[ndb_mgmd(MGM)] 1 node(s)
id=1    @192.168.0.10  (Version: 5.1.2-alpha)
 
[mysqld(SQL)]   1 node(s)
id=4   (Version: 5.1.2-alpha)

鍏蜂綋鐨勮緭鍑哄唴瀹瑰彲鑳戒細鐣ユ湁涓嶅悓锛岃繖鍙栧喅浜庝綘鎵浣跨敤鐨MySQL鐗堟湰銆

娉ㄩ噴锛濡傛灉浣犳鍦ㄤ娇鐢ㄨ緝鏃╃殑MySQL鐗堟湰锛屼綘鎴栬浼氱湅鍒板紩鐢ㄤ负鈥[mysqld(API)]鈥欑殑SQL鑺傜偣銆傝繖鏄竴绉嶆棭鏈熺殑鐢ㄦ硶锛岀幇宸叉斁寮冦

鐜板湪锛屽簲鑳藉湪MySQL绨囦腑澶勭悊鏁版嵁搴擄紝琛ㄥ拰鏁版嵁銆傚叧浜庤繖鏂归潰鐨勭畝瑕佽璁猴紝璇峰弬瑙17.3.5鑺傦紝鈥滃姞杞界ず渚嬫暟鎹苟鎵ц鏌ヨ鈥

17.3.5. 鍔犺浇绀轰緥鏁版嵁骞舵墽琛屾煡璇

涓庢病鏈変娇鐢ㄧ皣鐨MySQL鐩告瘮锛屽湪MySQL绨囧唴鎿嶄綔鏁版嵁鐨勬柟寮忔病鏈夊お澶х殑鍖哄埆銆傛墽琛岃繖绫绘搷浣滄椂搴旇浣忎袱鐐癸細

         琛ㄥ繀椤荤敤ENGINE=NDBENGINE=NDBCLUSTER閫夐」鍒涘缓锛屾垨鐢ALTER TABLE閫夐」鏇存敼锛屼互浣跨敤NDB绨囧瓨鍌ㄥ紩鎿庡湪绨囧唴澶嶅埗瀹冧滑銆傚鏋滀娇鐢mysqldump鐨勮緭鍑轰粠宸叉湁鏁版嵁搴撳鍏ヨ〃锛屽彲鍦ㄦ枃鏈紪杈戝櫒涓墦寮SQL鑴氭湰锛屽苟灏嗚閫夐」娣诲姞鍒颁换浣曡〃鍒涘缓璇彞锛屾垨鐢ㄨ繖绫婚夐」涔嬩竴鏇挎崲浠讳綍宸叉湁鐨ENGINE锛堟垨TYPE锛夐夐」銆渚嬪锛屽亣瀹氬湪鍙︿竴涓MySQL鏈嶅姟鍣紙涓嶆敮鎸MySQL绨囷級涓婃湁鏍锋湰涓栫晫鏁版嵁搴擄紝鑰屼笖浣犳墦绠楀鍑哄煄甯傝〃鐨勫畾涔夛細

                shell> mysqldump --add-drop-table world City > city_table.sql

鍦ㄦ墍寰楃殑city_table.sql鏂囦欢涓紝灏嗗寘鍚繖鏉¤〃鍒涘缓璇彞锛堜互鍙婂鍏ヨ〃鏁版嵁鎵闇鐨INSERT璇彞锛夛細

DROP TABLE IF EXISTS City;
CREATE TABLE City (
ID int(11) NOT NULL auto_increment,
Name char(35) NOT NULL default '',
CountryCode char(3) NOT NULL default '',
District char(20) NOT NULL default '',
Population int(11) NOT NULL default '0',
PRIMARY KEY  (ID)
) ENGINE=MyISAM;
 
INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
# (remaining INSERT statements omitted)

闇瑕佺‘璁MySQL涓鸿琛ㄤ娇鐢ㄤ簡NDB瀛樺偍寮曟搸銆傛湁涓ょ瀹屾垚璇ヤ换鍔$殑鏂规硶銆傚叾涓竴绉嶆柟娉曟槸锛屽湪灏嗚〃瀵煎叆绨囨暟鎹簱涔嬪墠鏇存敼鍏跺畾涔夛紝浣垮叾绫讳技浜庯紙浠嶄娇鐢ㄢ滃煄甯傗濅綔涓虹ず渚嬶級锛

DROP TABLE IF EXISTS City;
CREATE TABLE City (
ID int(11) NOT NULL auto_increment,
Name char(35) NOT NULL default '',
CountryCode char(3) NOT NULL default '',
District char(20) NOT NULL default '',
Population int(11) NOT NULL default '0',
PRIMARY KEY  (ID)
) ENGINE=NDBCLUSTER;
 
INSERT INTO City VALUES (1,'Kabul','AFG','Kabol',1780000);
INSERT INTO City VALUES (2,'Qandahar','AFG','Qandahar',237500);
INSERT INTO City VALUES (3,'Herat','AFG','Herat',186800);
# (etc.)

瀵逛簬灏嗘垚涓虹皣鏁版嵁搴撶粍鎴愰儴浠界殑姣忎釜琛紝鍧囬渶瑕佷负鍏跺畾涔夋墽琛屼笂杩版搷浣溿傚畬鎴愯浠诲姟鐨勬渶绠鍗曟柟娉曟槸锛岀畝鍗曞湴鍦world.sql鏂囦欢涓婃墽琛鏌ユ壘-鏇挎崲锛屽苟鐢ENGINE=NDBCLUSTER鏇挎崲鎵鏈夌殑TYPE=MyISAM瀹炰緥銆傚鏋滀綘涓嶆墦绠楁洿鏀硅鏂囦欢锛屼篃鍙娇鐢ALTER TABLE銆傝鎯呰鍙傝涓嬮潰鐨勪粙缁嶃

鍋囧畾浣犲凡鍦ㄧ皣鐨SQL鑺傜偣涓婂垱寤轰簡鍚嶄负鈥world鈥濈殑鏁版嵁搴擄紝闅忓悗鍙娇鐢mysql鍛戒护琛屽鎴风璇诲彇city_table.sql锛屽苟鎸夐氬父鏂瑰紡鍒涘缓鍜屽~鍏呭搴旂殑琛細

shell> mysql world < city_table.sql

璇疯浣忥紝涓婅堪鍛戒护蹇呴』鍦ㄨ繍琛SQL鑺傜偣鐨勪富鏈轰笂鎵ц锛岃繖鐐瑰崄鍒嗛噸瑕併傚浜庢湰渚嬶紝搴斿湪IP鍦板潃涓192.168.0.20鐨勬満鍣ㄤ笂鎵ц銆

瑕佹兂鍦SQL鑺傜偣涓婂垱寤轰笘鐣屾暟鎹簱鐨勫壇鏈紝璇峰皢鏂囦欢淇濆瓨鍒/usr/local/mysql/data锛岀劧鍚庤繍琛岋細

shell> cd /usr/local/mysql/data
shell> mysql world < world.sql

褰撶劧锛SQL鑴氭湰蹇呴』鑳借mysql绯荤粺鐢ㄦ埛璇诲彇銆濡傛灉灏嗘枃浠朵繚瀛樺埌浜嗕笉鍚岀殑鐩綍涓嬶紝璇蜂綔鐩稿簲鐨勮皟鏁淬

娉ㄦ剰锛屽湪MySQL 5.1涓紝NDB绨囦笉鏀寔鑷姩鍙戠幇鏁版嵁搴撶殑鍔熻兘锛岃繖鐐瑰緢閲嶈锛堣鍙傝17.8鑺傦紝鈥淢ySQL绨囩殑宸茬煡闄愬埗鈥锛夈傝繖鎰忓懗鐫锛屼竴鏃﹀湪涓涓暟鎹妭鐐逛笂鍒涘缓浜嗕笘鐣岋紙world锛夋暟鎹簱鍜屽畠鐨勮〃锛屽湪绨囦腑鐨勬瘡涓SQL鑺傜偣涓婅繕闇瑕佸彂鍑哄懡浠CREATE DATABASE world锛堜粠MySQL 5.0.2寮濮嬶紝鍙互浣跨敤CREATE SCHEMA world鍙栬屼唬涔嬶級锛鍚庤窡FLUSH TABLES銆傝繖鏍凤紝鑺傜偣灏辫兘璇嗗埆鏁版嵁搴撳苟璇诲彇鍏惰〃瀹氫箟銆

SQL鑺傜偣涓婅繍琛SELECT鏌ヨ涓庡湪MySQL鏈嶅姟鍣ㄧ殑浠讳綍鍏朵粬瀹炰緥涓婅繍琛屾煡璇㈡病鏈夊尯鍒傝鎯充粠鍛戒护琛岃繍琛屾煡璇紝棣栧厛搴旀寜鐓ч氬父鏂瑰紡鐧诲綍鍒MySQL鐩戣鍣細

shell> mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.1.2-alpha
 
閿叆鈥help;鈥欐垨鈥\h鈥欒幏鍙栧府鍔┿傞敭鍏モ\c鈥欐竻绌虹紦鍐插尯銆
 
mysql>

濡傛灉鍦ㄥ鍏MySQL鑴氭湰涔嬪墠鏈洿鏀硅〃瀹氫箟涓殑ENGINE=瀛愬彞锛屽簲鍦ㄦ鏃惰繍琛涓嬭堪鍛戒护锛

mysql> USE world;
mysql> ALTER TABLE City ENGINE=NDBCLUSTER;
mysql> ALTER TABLE Country ENGINE=NDBCLUSTER;
mysql> ALTER TABLE CountryLanguage ENGINE=NDBCLUSTER;

娉ㄦ剰锛屽湪杩欓噷鎴戜滑绠鍗曞湴浣跨敤浜MySQL鏈嶅姟鍣ㄥ瘑鐮佷负绌虹殑榛樿鏍圭敤鎴疯处鎴枫傚綋鐒讹紝鍦ㄧ敓浜ц缃笅锛屽畨瑁MySQL鏈嶅姟鍣ㄦ椂锛屾诲簲閬靛畧鏍囧噯鐨勫畨鍏ㄦ柟娉曟帾鏂斤紝鍖呮嫭璁剧疆鐗㈤潬鐨勬牴鐢ㄦ埛瀵嗙爜锛屽苟涓虹敤鎴峰垱寤哄叿鏈夊畬鎴愪换鍔℃墍闇鐨勬潈闄愮殑鐢ㄦ埛璐︽埛銆傚叧浜庤繖鏂归潰鐨勬洿澶氫俊鎭紝璇峰弬瑙5.7鑺傦紝鈥淢ySQL璁块棶鏉冮檺绯荤粺鈥

闇瑕佸叧娉ㄧ殑鏄紝褰撶皣鑺傜偣褰兼璁块棶鏃朵笉浣跨敤MySQL鐨勬潈闄愮郴缁燂紝璁剧疆鎴栨洿鏀MySQL鐢ㄦ埛璐︽埛锛堝寘鎷牴鐢ㄦ埛璐︽埛锛変笉褰卞搷鑺傜偣涔嬮棿鐨勪氦浜掞紝瀹冧滑浠呭璁块棶SQL鑺傜偣鐨勫簲鐢ㄧ▼搴忔湁鏁堛

鑳藉浠ラ氬父鐨勬柟寮忛夋嫨鏁版嵁搴擄紝骞跺琛ㄦ墽琛SELECT鏌ヨ锛屽氨鍍忛鍑MySQL鐩戣鍣ㄤ竴鏍凤細

mysql> USE world;
mysql> SELECT Name, Population FROM City ORDER BY Population DESC LIMIT 5;
+-----------+------------+
| 鍚嶇О      | 浜哄彛 |
+-----------+------------+
| 瀛熶拱      |   10500000 |
| 姹夊煄      |    9981619 |
| 鍦d繚缃    |    9968485 |
| 涓婃捣      |    9696300 |
| 闆呭姞杈    |    9604900 |
+-----------+------------+
5 rows in set (0.34 sec)
 
mysql> \q
Bye
 
shell>

浣跨敤MySQL鐨勫簲鐢ㄧ▼搴忚兘澶熶娇鐢ㄦ爣鍑嗙殑API銆傞噸瑕佺殑鏄簲璁颁綇锛屼綘鐨勫簲鐢ㄧ▼搴忓繀椤昏闂SQL鑺傜偣锛岃屼笉鏄MGM鎴栧瓨鍌ㄨ妭鐐广傚湪涓嬮潰鐨勭畝鍗曠ず渚嬩腑锛屼粙缁嶄簡浣跨敤PHP 5mysqli鎵╁睍锛堣繍琛屽湪浣嶄簬缃戠粶涓叾浠栦綅缃殑Web鏈嶅姟鍣ㄤ笂锛夋墽琛岀浉鍚屾煡璇㈢殑鏂规硶锛

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Type"
        content="text/html; charset=iso-8859-1">
  <title>SIMPLE mysqli SELECT</title>
</head>
<body>
<?php
  # connect to SQL node:
  $link = new mysqli('192.168.0.20', 'root', '', 'world');
  # parameters for mysqli constructor are:
  #   host, user, password, database
 
  if( mysqli_connect_errno() )
    die("Connect failed: " . mysqli_connect_error());
 
  $query = "SELECT Name, Population
            FROM City
            ORDER BY Population DESC
            LIMIT 5";
 
  # if no errors...
  if( $result = $link->query($query) )
  {
?>
<table border="1" width="40%" cellpadding="4" cellspacing ="1">
  <tbody>
  <tr>
    <th width="10%">City</th>
    <th>Population</th>
  </tr>
<?
    # then display the results...
    while($row = $result->fetch_object())
      printf(<tr>\n  <td align=\"center\">%s</td><td>%d</td>\n</tr>\n",
              $row->Name, $row->Population);
?>
  </tbody
</table>
<?
  # ...and verify the number of rows that were retrieved
    printf("<p>Affected rows: %d</p>\n", $link->affected_rows);
  }
  else
    # otherwise, tell us what went wrong
    echo mysqli_error();
 
  # free the result set and the mysqli connection object
  $result->close();
  $link->close();
?>
</body>
</html>

鎴戜滑鍋囧畾杩愯鍦Web鏈嶅姟鍣ㄤ笂鐨勮繘绋嬭兘澶熻闂SQL鑺傜偣鐨IP鍦板潃銆

閲囩敤绫讳技鐨勯鏍硷紝鍙互浣跨敤MySQL C APIPerl-DBIPython-mysql銆佹垨MySQL AB鑷繁鐨勮繛鎺ュ櫒鏉ユ墽琛屾暟鎹畾涔夊拰鎿嶆帶浠诲姟锛屽氨鍍忔甯镐娇鐢MySQL閭f牱銆

         鍙﹀杩樿璁颁綇锛姣忎釜NDB蹇呴』鏈変竴涓富閿銆傚鏋滃湪鍒涘缓琛ㄦ椂鐢ㄦ埛鏈畾涔変富閿紝NDB绨囧瓨鍌ㄥ紩鎿庡皢鑷姩鐢熸垚闅愬惈鐨勪富閿傦紙娉ㄩ噴锛璇ラ殣鍚 閿篃灏嗗崰鐢ㄧ┖闂达紝灏卞儚浠讳綍鍏朵粬鐨勮〃绱㈠紩涓鏍枫傜敱浜庢病鏈夎冻澶熺殑鍐呭瓨鏉ュ绾宠繖浜涜嚜鍔ㄥ垱寤虹殑閿紝鍑虹幇闂骞朵笉缃曡锛夈

17.3.6. 瀹夊叏鍏抽棴鍜岄噸鍚

瑕佹兂鍏抽棴绨囷紝鍙湪MGM鑺傜偣鎵鍦ㄧ殑鏈哄櫒涓婏紝鍦Shell涓畝鍗曞湴杈撳叆涓嬭堪鍛戒护锛

shell> ndb_mgm -e shutdown

璇ュ懡浠ゅ皢鎭板綋鍦颁腑姝ndb_mgmndb_mgmd浠ュ強浠讳綍ndbd杩涚▼銆備娇鐢mysqladmin shutdown鎴栧叾浠栨柟娉曪紝鍙腑姝SQL鑺傜偣銆傛敞鎰忥紝杩欓噷鐨勨-e鈥閫夐」鐢ㄤ簬灏嗗懡浠や粠shell浼犻掑埌ndb_mgm瀹㈡埛绔傝鍙傝4.3.1鑺傦紝鈥滃湪鍛戒护琛屼笂浣跨敤閫夐」鈥

瑕佹兂閲嶅惎绨囷紝鍙畝鍗曞湴杩愯涓嬭堪鍛戒护锛

         鍦ㄧ鐞嗕富鏈轰笂锛堟湰璁剧疆涓负192.168.0.10锛夛細

                shell> ndb_mgmd -f /var/lib/mysql-cluster/config.ini

         鍦ㄦ瘡鍙版暟鎹妭鐐逛富鏈轰笂锛192.168.0.30192.168.0.40锛夛細

                shell> ndbd

璇疯浣忥紝姝e父閲嶅惎NDBD鑺傜偣鏃讹紝涓嶈鐢ㄢ--initial鈥濋夐」璋冪敤璇ュ懡浠ゃ

         SQL涓绘満涓婏紙192.168.0.20锛夛細

                shell> mysqld &

鍏充簬鍒涘缓绨囧浠界殑鏇村淇℃伅锛岃鍙傝17.6.5.2鑺傦紝鈥滀娇鐢ㄧ鐞嗘湇鍔″櫒鍒涘缓澶囦唤鈥

瑕佹兂浠庡浠戒腑鎭㈠绨囷紝闇瑕佷娇鐢ndb_restore鍛戒护銆傝鍙傝17.6.5.3鑺傦紝鈥滃浣曟仮澶嶇皣澶囦唤鈥

鍏充簬閰嶇疆MySQL绨囩殑鏇村淇℃伅锛岃鍙傝17.4鑺傦紝鈥淢ySQL绨囩殑閰嶇疆鈥

17.4.聽MySQL绨囩殑閰嶇疆

浣滀负MySQL绨囩粍鎴愰儴浠界殑MySQL鏈嶅姟鍣ㄤ粎鍦ㄤ竴涓柟闈笂涓庢甯哥殑锛堥潪绨囧紡锛MySQL鏈嶅姟鍣ㄤ笉鍚岋紝瀹冮噰鐢ㄤ簡NDB绨囧瓨鍌ㄥ紩鎿庛傝寮曟搸涔熺畝鍗曞湴绉颁负NDB锛岃繖涓や釜鏈鏄悓涔夎瘝銆

涓轰簡閬垮厤涓嶅繀瑕佺殑璧勬簮鍒嗛厤锛岄粯璁ゆ儏鍐典笅锛屽湪鏈嶅姟鍣ㄧ殑閰嶇疆涓皢绂佹NDB瀛樺偍寮曟搸銆傝鎯冲惎鐢NDB锛岄渶瑕佹洿鏀鏈嶅姟鍣ㄧ殑my.cnf閰嶇疆鏂囦欢锛屾垨浣跨敤鈥溾攏dbcluster鈥閫夐」鍚姩鏈嶅姟鍣ㄣ

鐢变簬MySQL鏈嶅姟鍣ㄦ槸绨囩殑涓閮ㄥ垎锛屽畠涔熼渶瑕佺煡閬撳浣曡闂MGM鑺傜偣锛屼互渚胯幏寰楃皣閰嶇疆鏁版嵁銆傞粯璁よ涓烘槸鏌ユ壘鏈湴涓绘満涓MGM鑺傜偣銆備絾鏄紝濡傛灉闇瑕佸彟澶栨寚瀹氬畠鐨勪綅缃紝鍙湪my.cnf鏂囦欢鎴MySQL鏈嶅姟鍣ㄥ懡浠よ涓婅繘琛屻傝兘澶熶娇鐢NDB瀛樺偍寮曟搸涔嬪墠锛岃嚦灏戝簲鏈変竴涓MGM鑺傜偣鏄彲鎿嶄綔鐨勶紝鑰屼笖杩樺簲鏈鎵闇鐨勬暟鎹妭鐐广

17.4.1. 浠庢簮鐮佸垱寤篗ySQL绨

瀵逛簬LinuxMac OS XSolaris锛屽湪鍏朵簩杩涘埗鍒嗗彂鐗堜腑鍧囨彁渚涗簡NDB绨囧瓨鍌ㄥ紩鎿庛傚湪Windows骞冲彴涓婂皻涓嶆敮鎸佸畠锛屼絾鎴戜滑鎵撶畻鍦ㄤ笉杩滅殑灏嗘潵浣垮叾鑳界敤浜win32鍜屽叾浠栧钩鍙般

濡傛灉閫夋嫨浠庢簮鐮tarballMySQL 5.1 BitKeeper鏍戝垱寤哄畠锛岃繍琛configure鏃讹紝鍔″繀浣跨敤鈥--with-ndbcluster鈥閫夐」銆備篃鍙互浣跨敤BUILD/compile-pentium-max鍒涘缓鑴氭湰銆傛敞鎰忥紝璇ヨ剼鏈寘鍚OpenSSL锛屽洜姝わ紝瑕佹兂鎴愬姛鍒涘缓锛屽繀椤绘湁鎴栬幏寰OpenSSL锛屽涓嶇劧锛岄渶瑕佹洿鏀光compile-pentium-max鈥濅互渚垮皢璇ヨ姹傛帓闄ゅ湪澶栵紝褰撶劧锛屼篃鑳介噰鐢ㄦ爣鍑嗘楠ゆ潵缂栬瘧浣犺嚜宸辩殑浜岃繘鍒舵枃浠讹紝鐒跺悗鎵ц甯歌娴嬭瘯鍜屽畨瑁呮楠ゃ傝鍙傝2.8.3鑺傦紝鈥滀粠寮鍙戞簮鐮佹爲瀹夎鈥

17.4.2. 瀹夎杞欢

鍦ㄤ笅闈㈢殑鏁拌妭鍐咃紝鍋囧畾浣犲凡鐔熸倝浜MySQL鐨勫畨瑁呮柟娉曪紝鍦ㄦ锛屾垜浠粎浠嬬粛浜MySQL绨囬厤缃笌涓嶅叿澶囩皣鍔熻兘鐨MySQL閰嶇疆涔嬮棿鐨勫樊鍒傚鏋滃笇鏈涗簡瑙e叧浜庡悗鑰呯殑鏇村淇℃伅锛岃鍙傝绗2绔狅細瀹夎MySQL

濡傛灉棣栧厛杩愯浜嗘墍鏈夌殑绠$悊鍜屾暟鎹妭鐐癸紝浣犲皢鍙戠幇绨囬厤缃渶绠鍗曪紝杩欐垨璁告槸鏈鑺辨椂闂寸殑閰嶇疆閮ㄥ垎銆傜紪杈my.cnf鏂囦欢鐩稿鐩存帴锛屽湪鏈妭涓紝浠呰璁轰笌涓嶅叿澶囩皣鍔熻兘鐨MySQL閰嶇疆涓嶅悓鐨勯儴鍒嗐

17.4.3. MySQL绨囩殑蹇熸祴璇曡缃

涓轰簡甯姪浣犵啛鎮夊熀鏈蹇碉紝鎴戜滑灏嗕粙缁嶅姛鑳芥MySQL绨囩殑鏈绠鍗曠殑鍙兘閰嶇疆銆傜劧鍚庯紝鎸夌収鏈珷鐩稿叧閮ㄥ垎鎻愪緵鐨勪俊鎭紝浣犲簲鑳借璁¤嚜宸辨墍闇鐨勯厤缃

棣栧厛锛屽簲浠ョ郴缁熸牴鐢ㄦ埛韬唤閫氳繃鎵ц涓嬭堪鍛戒护鍒涘缓閰嶇疆鐩綍锛屽/var/lib/mysql-cluster

shell> mkdir /var/lib/mysql-cluster

鍦ㄨ鐩綍涓嬶紝浣跨敤涓嬭堪淇℃伅鍒涘缓鍚嶄负config.ini鐨勬枃浠锛岄拡瀵圭郴缁熺殑鎯呭喌锛岀敤鎭板綋鐨勫兼浛鎹HostNameDataDir

# file "config.ini" - showing minimal setup consisting of 1 data node,
# 1 management server, and 3 MySQL servers.
# The empty default sections are not required, and are shown only for
# the sake of completeness.
# Data nodes must provide a hostname but MySQL Servers are not required
# to do so.
# If you don't know the hostname for your machine, use localhost.
# The DataDir parameter also has a default value, but it is recommended to
# set it explicitly.
# Note: DB, API, and MGM are aliases for NDBD, MYSQLD, and NDB_MGMD
# respectively. DB and API are deprecated and should not be used in new
# installations.
[NDBD DEFAULT]
NoOfReplicas= 1
 
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
 
[NDB_MGMD]
HostName= myhost.example.com
 
[NDBD]
HostName= myhost.example.com
DataDir= /var/lib/mysql-cluster
 
[MYSQLD]
[MYSQLD]
[MYSQLD]

鐜板湪锛岃兘澶熸寜涓嬭堪鏂瑰紡鍚姩绠$悊鏈嶅姟鍣細

shell> cd /var/lib/mysql-cluster
shell> ndb_mgmd

鎺ヤ笅鏉ワ紝閫氳繃杩愯ndbd鍚姩鍗曚釜DB鑺傜偣銆傞娆′负缁欏畾鐨DB鑺傜偣鍚姩ndbd鏃讹紝搴斾娇鐢ㄢ鈥攊nitial鈥閫夐」锛屽涓嬫墍绀猴細

shell> ndbd --initial

瀵逛簬鍚庣画鐨ndbd鍚姩锛岄氬父涓嶉渶瑕佷娇鐢ㄨ閫夐」锛

shell> ndbd

杩欐槸鍥犱负锛--initial閫夐」灏嗗垹闄よ鏁版嵁鑺傜偣鐨鎵鏈夊凡鏈夋暟鎹拰鏃ュ織鏂囦欢锛堜互鍙婃墍鏈夌殑琛ㄥ厓鏁版嵁锛夛紝骞跺垱寤烘柊鐨勬暟鎹拰鏃ュ織鏂囦欢銆傝瑙勫垯鐨勪竴椤逛緥澶栨槸锛氭坊鍔犱簡鏂版暟鎹妭鐐瑰悗閲嶅惎绨囧苟浠庡浠借繘琛屾仮澶嶄箣鏃躲

榛樿鎯呭喌涓嬶紝ndbd灏嗗湪绔彛1186涓婃煡鎵炬湰鍦颁富鏈轰笂鐨勭鐞嗘湇鍔″櫒銆

娉ㄩ噴锛濡傛灉浠庝簩杩涘埗tarball瀹夎浜MySQL锛岄渶瑕佹槑纭寚瀹ndb_mgmdndbd鏈嶅姟鍣ㄧ殑璺緞銆傦紙姝e父鎯呭喌涓嬶紝瀹冧滑浣嶄簬/usr/local/mysql/bin鐩綍涓嬶級銆

鏈鍚庯紝杩涘叆MySQL鏁版嵁鐩綍锛堥氬父鏄/var/lib/mysql/usr/local/mysql/data锛夛紝骞剁‘淇my.cnf鏂囦欢鍖呭惈鍚敤NDB瀛樺偍寮曟搸鎵闇鐨勯夐」锛

[mysqld]
ndbcluster

鐜板湪锛屼綘鑳芥寜閫氬父鏂瑰紡鍚姩MySQL鏈嶅姟鍣細

shell> mysqld_safe --user=mysql &

绛夊緟涓娈垫椂闂达紝纭MySQL鏈嶅姟鍣ㄦ鍦ㄦ伆褰撹繍琛屻傚鏋滃彂鐜伴氱煡鐢mysql鍋滄锛岃妫鏌ユ湇鍔″櫒鐨.err鏂囦欢锛屾壘鍑洪敊璇

濡傛灉鍒扮洰鍓嶄负姝竴鍒囨甯革紝鍙娇鐢ㄧ皣鍚姩瀹冿細

shell> mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.1.2-alpha-Max
 
閿叆鈥help;鈥欐垨鈥\h鈥欒幏鍙栧府鍔┿傞敭鍏モ\c鈥欐竻绌虹紦鍐插尯銆
 
mysql> SHOW ENGINES\G
 
...
*************************** 12. row ***************************
Engine: NDBCLUSTER
Support: YES
Comment: Clustered, fault-tolerant, memory-based tables
*************************** 13. row ***************************
Engine: NDB
Support: YES
Comment: Alias for NDBCLUSTER
...

锛堟敞鎰忥紝涓婁緥杈撳嚭涓樉绀虹殑琛屽彿鍙兘涓庝綘鐨勭郴缁熶笂鏄剧ず鐨勪笉鍚岋紝鍏蜂綋鎯呭喌鍙栧喅浜庝娇鐢ㄧ殑MySQL鐗堟湰锛屼互鍙婇厤缃畠鐨勬柟寮忥級銆

shell> mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.1.2-alpha-Max
 
閿叆鈥help;鈥欐垨鈥\h鈥欒幏鍙栧府鍔┿傞敭鍏モ\c鈥欐竻绌虹紦鍐插尯銆
 
mysql> USE test;
Database changed
 
mysql> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;
Query OK, 0 rows affected (0.09 sec)
 
mysql> SHOW CREATE TABLE ctest \G
*************************** 1. row ***************************
       Table: ctest
Create Table: CREATE TABLE `ctest` (
  `i` int(11) default NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

瑕佹兂妫鏌ユ槸鍚︽伆褰撹缃簡鑺傜偣锛屽彲鍚姩绠$悊瀹㈡埛绔細

shell> ndb_mgm

闅忓悗锛屼负浜嗚幏寰楀叧浜庣皣鐘舵佺殑鎶ュ憡锛屽彲浠庣鐞嗗鎴风鍐呬娇鐢SHOW鍛戒护锛

NDB> SHOW
Cluster Configuration
---------------------
[ndbd(NDB)]     1 node(s)
id=2    @127.0.0.1  (Version: 3.5.3, Nodegroup: 0, Master)
 
[ndb_mgmd(MGM)] 1 node(s)
id=1    @127.0.0.1  (Version: 3.5.3)
 
[mysqld(API)]   3 node(s)
id=3    @127.0.0.1  (Version: 3.5.3)
id=4 (not connected, accepting connect from any host)
id=5 (not connected, accepting connect from any host)

姝ゆ椂锛屼綘鎴愬姛鍦拌缃簡宸ヤ綔鐨MySQL绨囥傜幇鍦紝浣犺兘浣跨敤鐢ENGINE=NDBCLUSTER鎴栧叾鍒悕ENGINE=NDB鍒涘缓鐨勮〃锛屽皢鏁版嵁淇濆瓨鍒扮皣涓

17.4.4.聽閰嶇疆鏂囦欢

閰嶇疆MySQL绨囬渶瑕佷笌涓や釜鏂囦欢鎵撲氦閬擄細

         my.cnf锛氫负鎵鏈夌殑MySQL绨囧彲鎵ц鏂囦欢鎸囧畾浜嗛夐」銆備綘搴旂啛鎮変簡鍓嶉潰浠嬬粛鐨勪娇鐢MySQL鐨勬柟寮忥紝閫氳繃杩愯鍦ㄧ皣涓殑姣忎釜鍙墽琛屾枃浠讹紝蹇呴』鑳藉璁块棶璇ユ枃浠躲

         config.ini锛氳鏂囦欢浠呯敱MySQL绨囩鐞嗘湇鍔″櫒璇诲彇锛岄殢鍚庣鐞嗘湇鍔″櫒浼氬皢鍖呭惈璇ユ枃浠剁殑淇℃伅鍒嗛厤缁欑皣涓殑鎵鏈夎繘绋嬨config.ini鏂囦欢鍖呭惈瀵圭皣涓悇鑺傜偣鐨勬弿杩般傚寘鎷暟鎹妭鐐圭殑閰嶇疆鍙傛暟锛屼互鍙婄皣涓墍鏈夎妭鐐归棿杩炴帴鐨勯厤缃弬鏁般

鎴戜滑姝e湪涓嶆柇鏀硅繘绨囬厤缃紝骞跺姫鍔涚畝鍖栬杩涚▼銆傚敖绠℃垜浠皢灏介噺缁存姢鍚戝悗鍏煎鎬э紝浣嗗湪鏌愪簺鏃跺欙紝鍙兘涔熼渶瑕佸紩鍏ヤ笉鍏煎鐨勫彉鍔ㄣ傚湪杩欑鎯呭喌涓嬶紝鎴戜滑灏嗗敖閲忚绨囩敤鎴蜂簨鍏堜簡瑙h鍙樺姩鏄惁鏄悜鍚庡吋瀹圭殑銆傚鏋滀綘鍙戠幇浜嗗皻鏈褰曞湪鏂囨。涓殑杩欑被鍙樺姩锛岃浣跨敤鎴戜滑鐨缂洪櫡鏁版嵁搴閫氭姤瀹冦

17.4.4.1. MySQL绨囩殑閰嶇疆绀轰緥

涓轰簡鏀寔MySQL绨囷紝闇瑕佹洿鏂版枃浠my.cnf锛屽涓嬩緥鎵绀恒傛敞鎰忥紝涓嶅簲灏嗚繖閲岀粰鍑虹殑閫夐」涓config.ini鏂囦欢涓嚭鐜扮殑閫夐」娣锋穯璧锋潵銆傛澶栵紝浠庡懡浠よ璋冪敤鍙墽琛屾枃浠舵椂锛屾垨璁镐篃搴旀寚瀹氳繖浜涘弬鏁般

# my.cnf
# example additions to my.cnf for MySQL Cluster
# (valid in MySQL 5.1)
 
# enable ndbcluster storage engine, and provide connectstring for
# management server host (default port is 1186)
[mysqld]
ndbcluster
ndb-connectstring=ndb_mgmd.mysql.com
 
 
# provide connectstring for management server host (default port: 1186)
[ndbd]
connect-string=ndb_mgmd.mysql.com
 
# provide connectstring for management server host (default port: 1186)
[ndb_mgm]
connect-string=ndb_mgmd.mysql.com
 
# provide location of cluster configuration file
[ndb_mgmd]
config-file=/etc/config.ini

锛堝叧浜庤繛鎺ュ瓧绗︾殑鏇村淇℃伅锛岃鍙傝17.4.4.2鑺傦紝鈥淢ySQL绨囪繛鎺ュ瓧绗︿覆锛夈

# my.cnf
# example additions to my.cnf for MySQL Cluster
# (will work on all versions)
 
# enable ndbcluster storage engine, and provide connectstring for management
# server host to the default port 1186
[mysqld]
ndbcluster
ndb-connectstring=ndb_mgmd.mysql.com:1186

鎴栬锛屼綘涔熷彲浠ヤ娇鐢ㄧ皣my.cnf涓崟鐙殑[mysql_cluster]閮ㄥ垎锛岃缃彲琚墍鏈夊彲鎵ц鏂囦欢璇诲彇鐨勮缃紝骞跺奖鍝嶆墍鏈夌殑鍙墽琛屾枃浠讹細

# cluster-specific settings
[mysql_cluster]
ndb-connectstring=ndb_mgmd.mysql.com:1186

鐩墠锛岄厤缃枃浠堕噰鐢ㄧ殑鏄INI鏍煎紡锛岄粯璁ゆ儏鍐典笅琚懡鍚嶄负config.ini銆傝鏂囦欢鍦ㄥ惎鍔ㄦ椂鐢ndb_mgmd璇诲彇锛屽苟鑳借缃簬浠讳綍鍦版柟銆傚湪鍛戒护琛屼笂涓ndb_mgmd涓璧蜂娇鐢--config-file=[<path>]<filename>锛屽彲鎸囧畾鍏朵綅缃拰鍚嶇О銆傚鏋滄湭鎸囧畾閰嶇疆鏂囦欢锛榛樿鎯呭喌涓嬶紝ndb_mgmd灏嗗皾璇曡鍙栦綅浜庡綋鍓嶅伐浣滅洰褰曚笅鐨勬枃浠config.ini

瀵逛簬澶у鏁板弬鏁帮紝鍧囧畾涔変簡榛樿鍊硷紝涔熻兘鍦config.ini鏂囦欢涓寚瀹氶粯璁ゅ笺瑕佹兂鍒涘缓榛樿鍊奸儴鍒嗭紝鍙畝鍗曞湴灏嗗崟璇DEFAULT娣诲姞鍒拌閮ㄥ垎鐨勫悕绉颁笂銆渚嬪锛屾暟鎹妭鐐规槸浣跨敤[NDBD]閮ㄥ垎閰嶇疆鐨勩傚鏋滄墍鏈夌殑鏁版嵁鑺傜偣浣跨敤鐩稿悓澶у皬鐨勬暟鎹唴瀛橈紝鑰屼笖璇ュ唴瀛樺ぇ灏忎笉鍚屼簬榛樿鐨勫ぇ灏忥紝搴斿垱寤哄寘鍚DataMemory琛岀殑[NDBD DEFAULT]閮ㄥ垎锛屼负鎵鏈夋暟鎹妭鐐规寚瀹氶粯璁ょ殑鏁版嵁鍐呭瓨澶у皬銆

INI鏍煎紡鍖呭惈澶氫釜閮ㄥ垎锛屾瘡涓閮ㄥ垎浠ヨ閮ㄥ垎鐨勬爣棰橈紙鐢ㄦ柟鎷彿鎷綇锛夊紑濮嬶紝鍚庤窡鎭板綋鐨勫弬鏁板悕鍜屽笺備笌鏍囧噯鏍煎紡鐨勪笉鍚屼箣澶勫湪浜庯紝涓嶈兘鐢ㄥ啋鍙封:鈥濆拰绛夊彿鈥=鈥濋殧寮鍙傛暟鍚嶅拰鍊硷紱鍙︿竴澶勪笉鍚屾槸锛岃繖浜涢儴鍒嗗苟涓嶆槸鐢ㄥ悕绉板敮涓鏍囪瘑鐨勩傚叾鍞竴鎬ф潯鐩紙濡傚叿鏈夌浉鍚岀被鍨嬬殑涓や釜涓嶅悓鑺傜偣锛夋槸鐢卞敮涓ID鏍囪瘑鐨勩

浣滀负鏈浣庤姹傦紝閰嶇疆鏂囦欢蹇呴』瀹氫箟绨囦腑鐨勮绠楁満鍜岃妭鐐癸紝浠ュ強杩欎簺鑺傜偣鎵鍦ㄧ殑璁$畻鏈恒備笅闈㈢粰鍑轰簡涓涓畝鍗曠殑绨囬厤缃枃浠剁ず渚嬶紝璇ョ皣鍖呭惈1涓鐞嗘湇鍔″櫒锛2涓暟鎹妭鐐瑰拰2MySQL鏈嶅姟鍣細

# file "config.ini" - 2 data nodes and 2 SQL nodes
# This file is placed in the startup directory of ndb_mgmd (the management
# server)
# The first MySQL Server can be started from any host. The second can be started
# only on the host mysqld_5.mysql.com
 
[NDBD DEFAULT]
NoOfReplicas= 2
DataDir= /var/lib/mysql-cluster
 
[NDB_MGMD]
Hostname= ndb_mgmd.mysql.com
DataDir= /var/lib/mysql-cluster
 
[NDBD]
HostName= ndbd_2.mysql.com
 
[NDBD]
HostName= ndbd_3.mysql.com
 
[MYSQLD]
[MYSQLD]
HostName= mysqld_5.mysql.com

鍦ㄨ閰嶇疆鏂囦欢涓紝鏈6涓笉鍚岄儴鍒嗭細

         [COMPUTER]锛氬畾涔変簡绨囦富鏈恒

         [NDBD]锛氬畾涔変簡绨囩殑鏁版嵁鑺傜偣銆

         [MYSQLD]锛氬畾涔変簡绨囩殑MySQL鏈嶅姟鍣ㄨ妭鐐广

         [MGM][NDB_MGMD]锛氬畾涔変簡绨囩殑绠$悊鏈嶅姟鍣ㄨ妭鐐广

         [TCP]锛氬畾涔変簡绨囦腑鑺傜偣闂寸殑TCP/IP杩炴帴锛TCP/IP鏄粯璁ょ殑杩炴帴鍗忚銆

         [SHM]锛氬畾涔変簡鑺傜偣闂寸殑鍏变韩鍐呭瓨杩炴帴銆備互鍓嶏紝杩欑被杩炴帴浠呰兘鍦ㄤ娇鐢ㄢ--with-ndb-shm鈥濋夐」鍒涘缓鐨勪簩杩涘埗鏂囦欢涓娇鐢ㄣ傚湪MySQL 5.1-Max涓紝榛樿鎯呭喌涓嬪畠鏄厑璁哥殑锛屼絾浠嶅簲灏嗗叾瑙嗕负璇曢獙鎬х殑銆

娉ㄦ剰锛屾瘡涓妭鐐瑰湪config.ini鏂囦欢涓湁鑷繁鐨勯儴鍒嗐備緥濡傦紝鐢变簬璇ョ皣鏈変袱涓暟鎹妭鐐癸紝鍦ㄩ厤缃枃浠朵腑锛屼篃鍖呭惈瀹氫箟杩欎簺鑺傜偣鐨勯儴鍒嗐

鍙互涓烘瘡涓儴鍒嗗畾涔DEFAULT鍊笺傛墍鏈夌殑绨囧弬鏁板悕绉板潎鍖哄垎澶у皬鍐欍

17.4.4.2. MySQL绨囪繛鎺ュ瓧绗︿覆

闄や簡MySQL绨囩鐞嗘湇鍔″櫒锛ndb_mgmd锛夛紝鏋勬垚MySQL绨囩殑姣忎釜鑺傜偣鍧囬渶瑕1涓繛鎺ュ瓧绗︿覆锛岃杩炴帴瀛楃涓叉寚鍚戠鐞嗘湇鍔″櫒鎵鍦ㄧ殑浣嶇疆銆傚畠鐢ㄤ簬寤虹珛涓庣鐞嗘湇鍔″櫒鐨勮繛鎺ワ紝骞舵墽琛屽叾浠栦换鍔★紝杩欑被鍏朵粬浠诲姟鍙栧喅浜庤妭鐐瑰湪绨囧唴鎵紨鐨勮鑹层傝繛鎺ュ瓧绗︿覆鐨勮娉曞涓嬶細

<connectstring> :=
    [<nodeid-specification>,]<host-specification>[,<host-specification>]
    
<nodeid-specification> := node_id
 
<host-specification> := host[:port]

node_id鏄ぇ浜1鐨勬暣鏁帮紝鐢ㄤ簬纭畾config.ini涓殑鑺傜偣銆port鏄紩鐢ㄦ甯Unix绔彛鐨勬暣鏁般host鏄唬琛ㄦ湁鏁Internet鍦板潃鐨勫瓧绗︿覆銆

example 1 (long):    "nodeid=2,myhost1:1100,myhost2:1100,192.168.0.3:1200"
example 2 (short):   "myhost1"

濡傛灉鏈彁渚涳紝鎵鏈夎妭鐐瑰潎灏嗕娇鐢localhost:1186浣滀负榛樿鐨勮繛鎺ュ瓧绗︿覆鍊笺傚鏋滃湪杩炴帴瀛楃涓蹭腑鐪佺暐浜<port>锛岄粯璁ょ鍙d负1186銆傝绔彛鍦ㄧ綉缁滀笂鎬诲簲鏄彲鐢ㄧ殑锛岃繖鏄洜涓哄畠鏄敱IANA涓鸿鐩殑鑰屾寚瀹氱殑锛堣鎯呰鍙傝http://www.iana.org/assignments/port-numbers锛夈

閫氳繃鍒楀嚭澶氫釜<host-specification>鍊硷紝鑳藉鎸囧畾鏁颁釜鍐椾綑绠$悊鏈嶅姟鍣ㄣ傜皣鑺傜偣灏嗘寜鐓ф寚瀹氱殑椤哄簭灏濊瘯杩炴帴鍒版瘡鍙颁富鏈轰笂鐨勮繛缁鐞嗘湇鍔″櫒锛岀洿鑷虫垚鍔熷缓绔嬭捣杩炴帴涓烘銆

鏈夊绉嶆寚瀹氳繛鎺ュ瓧绗︿覆鐨勪笉鍚屾柟娉曪細

         姣忎釜鍙墽琛屾枃浠舵湁鑷繁鐨勫懡浠よ閫夐」锛屼娇鐢ㄥ畠锛岃兘澶熷湪鍚姩鏃舵寚瀹氱鐞嗘湇鍔″櫒锛堝叧浜庡悇鍙墽琛岀▼搴忕殑浠嬬粛锛岃鍙傝鐩稿簲鐨勬枃妗o級銆

         涔熻兘涓娆℃у湴涓虹皣涓殑鎵鏈夎妭鐐硅缃繛鎺ュ瓧绗︿覆锛屾柟娉曟槸灏嗗叾鏀惧湪绠$悊鏈嶅姟鍣ㄧ殑my.cnf鏂囦欢鐨[mysql_cluster]閮ㄥ垎銆

         涓轰簡鍚戝悗鍏煎鎬э紝杩樻彁渚涗簡涓ょ鍏朵粬閫夐」锛屽叾浣跨敤鐨勮娉曠浉鍚岋細

1.    璁剧疆NDB_CONNECTSTRING鐜鍙橀噺锛屼娇涔嬪寘鍚connectstring锛堣繛鎺ュ瓧绗︿覆锛夈

2.    灏嗛拡瀵瑰悇鍙墽琛屾枃浠剁殑connectstring锛堣繛鎺ュ瓧绗︿覆锛夊啓鍏ュ悕涓Ndb.cfg鐨勬枃鏈枃浠讹紝骞跺皢璇ユ枃浠舵斁鍦ㄥ彲鎵ц鏂囦欢鐨勫惎鍔ㄧ洰褰曚笅銆

浣嗘槸锛岃繖浜涙柟娉曠洰鍓嶅凡涓嶅啀鍙楅噸瑙嗭紝瀵逛簬鏂板畨瑁咃紝涓嶅簲浣跨敤瀹冧滑銆

鎸囧畾杩炴帴瀛楃涓叉椂锛屾帹鑽愮殑鏂规硶鏄湪鍛戒护琛屼笂璁剧疆瀹冿紝鎴栦负姣忎釜鍙墽琛屾枃浠跺湪my.cnf鏂囦欢涓缃畠銆

17.4.4.3. 瀹氫箟鏋勬垚MySQL绨囩殑璁$畻鏈

闄や簡鐢ㄤ簬閬垮厤涓虹郴缁熶腑鐨勬瘡涓妭鐐瑰畾涔変富鏈哄悕澶栵紝[COMPUTER]閮ㄥ垎娌℃湁瀹為檯鐨勯噸瑕佹剰涔夈傝繖閲屾墍鎻愬埌鐨勬墍鏈夊弬鏁伴兘鏄渶瑕佺殑銆

         [COMPUTER]Id

杩欐槸鏁存暟鍊硷紝鐢ㄤ簬寮曠敤浣嶄簬閰嶇疆鏂囦欢涓埆澶勭殑涓绘満璁$畻鏈恒

         [COMPUTER]HostName

杩欐槸璁$畻鏈虹殑涓绘満鍚嶆垨IP鍦板潃銆

17.4.4.4. 瀹氫箟MySQL绨囩鐞嗘湇鍔″櫒

[NDB_MGMD]閮ㄥ垎锛堟垨鍏跺埆鍚[MGM]锛夌敤浜庨厤缃鐞嗘湇鍔″櫒鐨勮涓恒備笅闈㈠垪鍑虹殑鎵鏈夊弬鏁板潎鑳借蹇界暐锛屽鏋滄槸杩欐牱锛屽皢浣跨敤鍏堕粯璁ゅ笺娉ㄩ噴锛濡傛灉ExecuteOnComputerHostName鍙傛暟鍧囨湭鍑虹幇锛浼氫负瀹冧滑鎸囧畾榛樿鍊localhost

         [NDB_MGMD]Id

绨囦腑鐨勬瘡涓妭鐐归兘鏈夊敮涓鐨勬爣璇嗭紝鐢变粠163鐨勬暣鏁拌〃绀恒傛墍鏈夌殑鍐呴儴绨囨秷鎭娇鐢ㄨID鏉ュ畾鍧缁撶偣銆

         [NDB_MGMD]ExecuteOnComputer

瀹冨紩鐢ㄥ湪[COMPUTER]閮ㄥ垎涓畾涔夌殑璁$畻鏈轰箣涓銆

         [NDB_MGMD]PortNumber

杩欐槸绠$悊鏈嶅姟鍣ㄧ敤浜庣洃鍚厤缃姹傚拰绠$悊鍛戒护鐨勭鍙e彿銆

         [NDB_MGMD]LogDestination

璇ュ弬鏁版寚瀹氫簡灏嗙皣鐧诲綍淇℃伅鍙戦佸埌鍝噷銆傛湁涓夌閫夐」锛CONSOLESYSLOGFILE

o        CONSOLE锛屽皢鏃ュ織杈撳嚭鍒版爣鍑嗚緭鍑鸿澶stdout锛夛細

o                     CONSOLE

o        SYSLOG锛屽皢鏃ュ織鍙戦佸埌syslog锛堢郴缁熸棩蹇楋級杞澶锛屽彲鑳界殑鍊煎寘鎷細authauthprivcrondaemonftpkernlprmailnewssysloguseruucplocal0local1local2local3local4local5local6local7

娉ㄩ噴锛骞堕潪鎵鏈夌殑鎿嶄綔绯荤粺鍧囨敮鎸佹墍鏈夌殑杞澶囥

SYSLOG:facility=syslog

o        FILE锛屽皢绨囨棩蹇楄緭鍑哄鍚戠浉鍚屾満鍣ㄤ笂鐨勬瑙勬枃浠躲傚彲鎸囧畾涓嬭堪鍊硷細

         filename锛氭棩蹇楁枃浠剁殑鍚嶇О銆

         maxsize锛氭棩蹇楄褰曞垏鎹㈠埌鏂版枃浠朵箣鍓嶏紝鏂囦欢鑳藉闀垮埌鐨勬渶澶у昂瀵搞傚嚭鐜拌鎯呭喌鏃讹紝灏嗛氳繃鍦ㄦ枃浠跺悕涓婃坊鍔.x锛岄噸鍛藉悕鏃ュ織鏂囦欢锛屽叾涓紝x鏄鍚嶇О灏氭湭浣跨敤鐨勪笅涓涓暟瀛椼

         maxfiles锛氭棩蹇楁枃浠剁殑鏈澶ф暟鐩

o                     FILE:filename=cluster.log,maxsize=1000000,maxfiles=6

浣跨敤鐢卞垎鍙峰垎闅旂殑瀛楃涓诧紝鍙互鎸囧畾澶氫釜鏃ュ織鐩爣锛屽涓嬫墍绀猴細

CONSOLE;SYSLOG:facility=local0;FILE:filename=/var/log/mgmd

FILE鍙傛暟鐨勯粯璁ゅ兼槸FILE:filename=ndb_node_id_cluster.log,maxsize=1000000,maxfiles=6锛屽叾涓紝node_id鏄妭鐐圭殑ID

         [NDB_MGMD]ArbitrationRank

璇ュ弬鏁扮敤浜庡畾涔夊摢涓妭鐐瑰皢鎵紨浠茶绋嬪簭鐨勮鑹层傚彧鏈MGM鑺傜偣鍜SQL鑺傜偣鑳芥壆婕斾徊瑁佺▼搴忕殑瑙掕壊銆ArbitrationRank鍙互鍙栦笅杩板间箣涓锛

o        0锛氳鑺傜偣姘歌繙涓嶄細鐢ㄤ綔浠茶绋嬪簭銆

o        1锛氳鑺傜偣鍏锋湁楂樼殑浼樺厛绾э紝涔熷氨鏄锛屼笌浣庝紭鍏堢骇鑺傜偣鐩告瘮锛屽畠鏇村鏄撴垚涓轰徊瑁佺▼搴忋

o        2锛氳〃鏄庤妭鐐瑰叿鏈変綆鐨勪紭鍏堢骇锛屼粎褰撳叿鏈夐珮浼樺厛绾х殑鑺傜偣鏃犳硶鐢ㄤ簬璇ョ洰鐨勬椂锛屾墠鑳芥垚涓轰徊瑁佺▼搴忋

閫氬父鎯呭喌涓嬶紝搴斿皢ArbitrationRank璁剧疆涓1锛堥粯璁ゅ硷級锛屽苟灏嗘墍鏈夌殑SQL鑺傜偣璁剧疆涓0灏嗙鐞嗘湇鍔″櫒閰嶇疆涓轰徊瑁佺▼搴忋

         [NDB_MGMD]ArbitrationDelay

鏁存暟鍊硷紝浠ユ绉掍负鍗曚綅瑙勫畾浜嗙鐞嗘湇鍔″櫒瀵逛徊瑁佽姹傜殑寤惰繜鏃堕棿銆傞粯璁ゆ儏鍐典笅锛岃鍊间负0锛岄氬父涓嶉渶瑕佹敼鍙樺畠銆

         [NDB_MGMD]DataDir

瀹冪敤浜庤缃繚瀛樼鐞嗘湇鍔″櫒杈撳嚭鏂囦欢鐨勪綅缃傝繖浜涙枃浠跺寘鎷皣鏃ュ織鏂囦欢銆佽繘绋嬭緭鍑烘枃浠躲佷互鍙婄鍙g洃鐫g▼搴忕殑pid鏂囦欢锛堝浜庢棩蹇楁枃浠讹紝鍙氳繃璁剧疆[NDB_MGMD]LogDestinationFILE鍙傛暟瑕嗙洊瀹冿紝璇峰弬瑙佹湰鑺傚墠闈㈢殑璁ㄨ锛夈

17.4.4.5. 瀹氫箟MySQL绨囨暟鎹妭鐐

[NDBD]閮ㄥ垎鐢ㄤ簬閰嶇疆绨囨暟鎹妭鐐圭殑琛屼负銆傛湁寰堝鍙敤浜庢帶鍒剁紦鍐插尯澶у皬銆佹睜澶у皬銆佽秴鏃剁瓑鐨勫弬鏁般傚己鍒舵у弬鏁板寘鎷細

         ExecuteOnComputerHostName.

         鍙傛暟NoOfReplicas

杩欎簺鍙傛暟闇瑕佸湪[NDBD DEFAULT]閮ㄥ垎涓畾涔夈

澶у鏁版暟鎹妭鐐瑰弬鏁版槸鍦[NDBD DEFAULT]閮ㄥ垎涓缃殑銆傚彧鏈夐偅浜涙槑纭0鏄庝负鑳借缃湰鍦板肩殑鍙傛暟鎵嶈兘鍦[NDBD]閮ㄥ垎涓鏇存敼銆HostNameId浠ュ強ExecuteOnComputer蹇呴』鍦ㄦ湰鍦[NDBD]閮ㄥ垎涓畾涔夈

璇嗗埆鏁版嵁鑺傜偣

鍚姩鑺傜偣鏃讹紝鍙湪鍛戒护琛屼笂鍒嗛厤Id锛堝嵆鏁版嵁鑺傜偣ID锛夛紝涔熻兘鍦ㄩ厤缃枃浠朵腑鍒嗛厤Id鍊笺

瀵逛簬鍚勫弬鏁帮紝鑳藉浣跨敤鍚庣紑kMG鐢ㄤ簬鎸囨槑鍗曚綅锛屽垎鍒〃绀10241024*10241024*1024*1024锛堜緥濡傦紝100k琛ㄧず100 * 1024 = 102400锛夈傜洰鍓嶏紝鍙傛暟鍜屽煎尯鍒嗗ぇ灏忓啓銆

         [NBDB]Id

杩欐槸鐢ㄤ綔鑺傜偣鍦板潃鐨勮妭鐐ID锛屼緵鏈夌殑绨囧唴閮ㄦ秷鎭娇鐢ㄣ傝繖鏄粙浜163涔嬮棿鐨勬暣鏁般傜皣涓殑姣忎釜鑺傜偣鍧囨湁鍞竴鐨ID

         [NDBD]ExecuteOnComputer

鐢ㄤ簬寮曠敤鍦COMPUTER閮ㄥ垎涓畾涔夌殑璁$畻鏈猴紙涓绘満锛夈

         [NDBD]HostName

鎸囧畾璇ュ弬鏁扮殑鏁堟灉绫讳技浜庢寚瀹ExecuteOnComputer銆傚畠瀹氫箟浜嗗瓨鍌ㄨ妭鐐规墍鍦ㄨ绠楁満鐨勪富鏈哄悕銆傛寚瀹氶櫎localhost涔嬪鐨勫叾浠栦富鏈哄悕鏃讹紝闇瑕璇ュ弬鏁版垨ExecuteOnComputer

         (OBSOLETE) [NDBD]ServerPort

绨囦腑鐨勫悇鑺傜偣浣跨敤绔彛鏉ヤ笌鍏朵粬鑺傜偣鐩歌繛銆傝绔彛涔熺敤浜庤繛鎺ュ缓绔嬮樁娈典腑鐨勯潪TCP浼犺緭鍣ㄣ傜敱浜庨粯璁ょ鍙f槸鍔ㄦ佸垎閰嶇殑锛屽悓涓鍙拌绠楁満涓婄殑涓や釜鑺傜偣鍏锋湁涓嶅悓鐨勭鍙e彿锛屾甯告儏鍐典笅涓嶉渶瑕佷负璇ュ弬鏁版寚瀹氬笺

         [NDBD]NoOfReplicas

璇ュ叏灞鍙傛暟浠呰兘鍦[NDBD DEFAULT]涓缃紝瀹冨畾涔変簡绨囦腑姣忎釜琛ㄤ繚瀛樼殑鍓湰鏁般傝鍙傛暟杩樻寚瀹氫簡鑺傜偣缁勭殑澶у皬銆傝妭鐐圭粍鎸囩殑鏄繚瀛樼浉鍚屼俊鎭殑鑺傜偣闆嗗悎銆

鑺傜偣缁勬槸浠ラ殣寮忔柟寮忔瀯鎴愮殑銆傜1涓妭鐐圭粍鐢卞叿鏈夋渶浣庤妭鐐ID鐨勬暟鎹妭鐐归泦鍚堟瀯鎴愶紝涓嬩竴涓妭鐐圭粍鐢卞叿鏈夋浣庤妭鐐ID鐨勬暟鎹妭鐐归泦鍚堟瀯鎴愶紝渚濇绫绘帹銆備綔涓虹ず渚嬶紝鎴《鎴戜滑鏈4涓暟鎹妭鐐癸紝骞跺皢NoOfReplicas璁剧疆涓2銆傝繖鍥涗釜鏁版嵁鑺傜偣鐨ID鍒嗗埆鏄2345銆傞偅涔堢1涓妭鐐圭粍鐢辫妭鐐23鏋勬垚锛岀2涓妭鐐圭粍鐢辫妭鐐45鏋勬垚銆傞噸瑕佺殑鏄绨囪繘琛岀浉搴旂殑閰嶇疆锛屼娇寰楀悓涓鑺傜偣缁勪腑鐨勮妭鐐逛綅浜庝笉鍚岀殑璁$畻鏈轰笂锛岃繖鏄洜涓猴紝濡傛灉浣嶄簬鐩稿悓鐨勮绠楁満涓婏紝鍗曚釜纭欢鏁呴殰浼氬鑷存暣涓皣宕╂簝銆

濡傛灉鏈彁渚涜妭鐐ID锛岄偅涔堟暟鎹妭鐐圭殑椤哄簭灏嗘槸鑺傜偣缁勭殑鍐冲畾鍥犵礌銆傛棤璁烘槸鍚﹁繘琛屼簡鏄庣‘鐨勫垎閰嶏紝鍙湪绠$悊瀹㈡埛绔SHOW鍛戒护鐨勮緭鍑轰腑鏌ョ湅瀹冧滑銆

NoOfReplicas娌℃湁榛樿鍊硷紝鏈澶х殑鍙兘鍊间负4

         [NDBD]DataDir

璇ュ弬鏁版寚瀹氫簡瀛樻斁璺熻釜鏂囦欢銆佹棩蹇楁枃浠躲pid鏂囦欢浠ュ強閿欒鏃ュ織鐨勭洰褰曘

         [NDBD]FileSystemPath

璇ュ弬鏁版寚瀹氫簡瀛樻斁涓哄厓鏁版嵁鍒涘缓鐨勬墍鏈夋枃浠躲REDO鏃ュ織銆UNDO鏃ュ織鍜屾暟鎹枃浠剁殑鐩綍銆傞粯璁ょ洰褰曟槸鐢DataDir鎸囧畾鐨勩傛敞鎰忥紝鍚姩ndbd杩涚▼涔嬪墠锛岃鐩綍蹇呴』宸插瓨鍦ㄣ

MySQl绨囨帹鑽愮殑鐩綍灞傛鍖呮嫭/var/lib/mysql-cluster锛屽湪鍏朵笅涓鸿妭鐐圭殑鏂囦欢绯荤粺鍒涘缓1涓负鐩綍銆傝瀛愮洰褰曞寘鍚妭鐐ID銆備緥濡傦紝濡傛灉鑺傜偣ID2锛岃瀛愮洰褰曠殑鍚嶇О涓ndb_2_fs

         [NDBD]BackupDataDir

涔熻兘鎸囧畾瀛樻斁澶囦唤鐨勭洰褰曘傞粯璁ゆ儏鍐典笅锛岃鐩綍鏄FileSystemPath/BACKUP锛堣鍙傝鍓嶉潰鐨勪粙缁嶏級銆

鏁版嵁鍐呭瓨鍜岀储寮曞唴瀛

鍙傛暟DataMemoryIndexMemory鎸囧畾浜嗗瓨鏀惧疄闄呰褰曞強鍏剁储寮曠殑鍐呭瓨娈电殑澶у皬銆杩欐槸瀹冧滑鐨勫兼椂锛岄噸瑕佺殑鏄簲鎺屾彙浣跨敤DataMemoryIndexMemory鐨勬柟寮忥紝杩欐槸鍥犱负锛屼负浜嗗弽鏄犵皣鐨勫疄闄呬娇鐢ㄦ儏鍐碉紝甯稿父闇瑕佹洿鏂板畠浠細

         [NDBD]DataMemory

璇ュ弬鏁板畾涔変簡鐢ㄤ簬淇濆瓨鏁版嵁搴撹褰曠殑绌洪棿澶у皬銆傚叏閮ㄧ┖闂村潎鏄垎閰嶅湪鍐呭瓨涓殑锛屽洜姝わ紝鏈哄櫒搴斿叿鏈夎冻澶熺殑鐗╃悊鍐呭瓨鏉ュ绾宠鍊硷紝杩欑偣鏋佸叾閲嶈銆

DataMemory鍒嗛厤鐨勫唴瀛樼敤浜庝繚瀛樺疄闄呰褰曞拰绱㈠紩銆傜洰鍓嶏紝姣忔潯璁板綍鍏锋湁鍥哄畾鐨勫ぇ灏忥紙鐢氳嚦VARCHAR鍒椾篃淇濆瓨涓哄浐瀹氬搴﹀垪锛夈傛瘡鏉¤褰曠殑寮閿涓16瀛楄妭锛姝ゅ锛屾瘡鏉¤褰曡繕闇瑕侀澶栫殑绌洪棿锛岃繖鏄洜涓猴紝杩欑被璁板綍淇濆瓨鍦ㄥ叿鏈128瀛楄妭椤甸潰寮閿鐨32KB椤典腑锛堣鍙傝涓嬮潰鐨勪粙缁嶏級銆傜敱浜庢瘡鏉¤褰曚粎淇濆瓨鍦1涓〉涓紝鍥犺屾瘡椤垫湁灏戦噺鐨勬氮璐广傜洰鍓嶏紝鏈澶ц褰曞ぇ灏忎负8052瀛楄妭銆

DataMemory瀹氫箟鐨勫唴瀛樼┖闂翠篃鐢ㄤ簬淇濆瓨鏈夊簭绱㈠紩锛屽浜庢瘡鏉¤褰曪紝绱㈠紩绾︿娇鐢10瀛楄妭銆傚湪鏈夊簭绱㈠紩涓紝琛ㄧず浜姣忎釜琛ㄨ銆傜敤鎴峰父鐘殑涓涓敊璇槸锛屾兂褰撶劧鍦拌涓烘墍鏈夌殑绱㈠紩鍧囦繚瀛樺湪鐢IndexMemory鍒嗛厤鐨勫唴瀛樹腑锛屼絾鎯呭喌骞堕潪濡傛锛氬彧鏈変富閿拰鍞竴鎬ф贩缂栫储寮曚娇鐢ㄨ鍐呭瓨锛屾湁搴忕储寮曚娇鐢ㄧ殑鏄DataMemory鍒嗛厤鐨勫唴瀛樸傜劧鑰岋紝鍒涘缓涓婚敭鎴栧敮涓鎬ф贩缂栫储寮鏃讹紝涔熶細鍦ㄧ浉鍚岀殑 閿笂鍒涘缓鏈夊簭绱㈠紩锛岄櫎闈炲湪绱㈠紩鍒涘缓璇彞涓寚瀹氫簡USING HASH閫氳繃鍦ㄧ鐞嗗鎴风涓繍琛ndb_desc -d db_name table_name锛屽彲瀵瑰叾杩涜楠岃瘉銆

DataMemory鍒嗛厤鐨勫唴瀛樼┖闂寸敱澶氫釜32KB椤垫瀯鎴愶紝瀹冧滑鏄负琛ㄧ墖娈靛垎閰嶇殑銆傞氬父鎯呭喌涓嬶紝涓烘瘡涓琛ㄥ垝鍒嗙殑琛ㄧ墖娈垫暟鐩笌绨囦腑鐨勮妭鐐规暟鐩浉鍚屻傚洜姝わ紝瀵逛簬姣忎竴鑺傜偣锛岀墖娈垫暟鐩笌鍦NoOfReplicas涓缃殑鐩稿悓銆涓鏃﹀垎閰嶄簡1椤碉紝鐩墠鏃犳硶灏嗗叾杩斿洖鍒拌嚜鐢遍〉姹犱腑锛岄櫎闈炲垹闄よ〃銆傛墽琛岃妭鐐规仮澶嶄篃灏嗗帇缂╁垎鍖猴紝杩欐槸鍥犱负锛屾墍鏈夎褰曞潎浼氳鎻掑叆鍒板叾浠栨椿鍔ㄨ妭鐐圭殑绌哄垎鍖轰腑銆

DataMemory鍐呭瓨绌洪棿涔熷寘鍚UNDO淇℃伅锛氬浜庢瘡涓鏇存柊锛屾湭鏀瑰彉璁板綍鐨勫壇鏈皢琚垎閰嶅埌DataMemory涓傚湪鏈夊簭琛ㄧ储寮曚腑锛岃繕鏈夊姣忎竴鍓湰鐨勫紩鐢ㄣ備粎褰撴洿鏂板敮涓鎬х储寮曞垪鏃讹紝鎵嶄細鏇存柊鍞竴鎬ф贩缂栫储寮曪紝鍦ㄨ鎯呭喌涓嬶紝灏嗗湪绱㈠紩琛ㄤ腑鎻掑叆鏂扮殑鏉$洰锛屽苟鍦ㄦ彁浜ゆ椂鍒犻櫎鏃х殑鏉$洰銆傚洜姝わ紝涔熸湁蹇呰鍒嗛厤瓒冲鐨勫唴瀛橈紝浠ヤ究澶勭悊鐢变娇鐢ㄧ皣鐨勫簲鐢ㄧ▼搴忔墽琛岀殑鏈澶т簨鍔°鍦ㄤ换浣曟儏鍐典笅锛屾墽琛屽皯閲忓ぇ鐨勪簨鍔″苟涓嶆瘮浣跨敤浼楀灏忕殑浜嬪姟鍗犱紭锛屽師鍥犲涓嬶細

o        澶т簨鍔$殑閫熷害娌℃湁杈冨皬浜嬪姟鐨勯熷害蹇

o        澶х殑浜嬪姟浼氬鍔犱涪澶辨搷浣滅殑鏁扮洰锛屼竴鏃︿簨鍔″け璐ワ紝蹇呴』閲嶅鎵ц銆

o        澶х殑浜嬪姟浣跨敤鏇村鐨勫唴瀛樸

DataMemory鐨勯粯璁ゅ兼槸80MB锛屾渶灏忎负1MB銆傛病鏈夋渶澶у昂瀵搁檺鍒讹紝浣嗗湪瀹為檯浣跨敤杩囩▼涓紝鏈澶ч檺鍒跺簲鎭板綋锛屼互渚垮綋杈惧埌鏈澶ч檺鍒舵椂锛岃繘绋嬩笉浼氬惎鍔ㄤ氦鎹㈠姛鑳姐傝闄愬埗鐢辨満鍣ㄤ笂鍙敤鐨勭墿鐞RAM閲忋佷互鍙婃搷浣滅郴缁熻兘鎻愪氦缁欎换浣曡繘绋嬬殑鍐呭瓨閲忓喅瀹氥傚浜32浣嶆搷浣滅郴缁燂紝璇ラ檺鍒跺间负姣忚繘绋24GB锛屽浜64浣嶆搷浣滅郴缁燂紝璇ラ檺鍒跺兼洿澶с傚浜庡ぇ鐨勬暟鎹簱锛屽嚭浜庤鍘熷洜锛屾渶濂戒娇鐢64浣嶆搷浣滅郴缁熴傛澶栵紝鍦ㄦ瘡鍙版満鍣ㄤ笂涔熻兘杩愯涓涓互涓婄殑ndbd杩涚▼锛屽湪浣跨敤澶CPU鐨勬満鍣ㄤ笂锛岃鐗规ч鍏蜂紭鍔裤

         [NDBD]IndexMemory

璇ュ弬鏁扮敤浜庢帶鍒MySQL绨囦腑鍝堝笇锛堟贩缂栵級绱㈠紩鎵浣跨敤鐨勫瓨鍌ㄩ噺銆傚搱甯岋紙娣风紪锛夌储寮曟荤敤浜庝富閿储寮曘佸敮涓鎬х储寮曘佷互鍙婂敮涓鎬х害鏉熴傛敞鎰忥紝瀹氫箟涓婚敭鍜屽敮涓鎬х储寮曟椂锛屽皢鍒涘缓涓ゆ潯绱㈠紩锛屽叾涓竴鏉℃槸鐢ㄤ簬鎵鏈tuple璁块棶鍜岄攣瀹氬鐞嗙殑鍝堝笇锛堟贩缂栵級绱㈠紩銆傛澶栵紝瀹冭繕鑳界敤浜庡寮哄敮涓鎬х害鏉熴

鍝堝笇锛堟贩缂栵級绱㈠紩鐨勫ぇ灏忔槸姣忚褰25瀛楄妭锛屽啀鍔犱笂涓婚敭鐨勫ぇ灏忋傚澶т簬32瀛楄妭鐨勪富閿紝杩橀渶鍔犱笂8瀛楄妭銆

鑰冭檻涓嬩緥瀹氫箟鐨勮〃锛

CREATE TABLE example (
  a INT NOT NULL,
  b INT NOT NULL,
  c INT NOT NULL,
  PRIMARY KEY(a),
  UNIQUE(b)
) ENGINE=NDBCLUSTER;

12瀛楄妭鐨勫紑閿锛堟棤鍙┖鍒楀皢鑺傜渷4瀛楄妭鐨勫紑閿锛夊姞涓婃瘡璁板綍12瀛楄妭鐨勬暟鎹傛澶栵紝鍦ㄥ垪ab涓婃湁涓や釜鏈夊簭绱㈠紩锛屽亣瀹氭瘡璁板綍鍒嗗埆鑰楃敤绾10瀛楄妭鐨勭┖闂淬傚湪姣忚褰曠害浣跨敤29瀛楄妭鐨勫熀琛ㄤ笂鏈1鏉′富閿搱甯岀储寮曘傚敮涓鎬х害鏉熺敱浠b浣滀负涓婚敭浠ュ強a浣滀负鍒楃殑鍗曠嫭琛ㄥ疄鐜般傚浜庤琛紝姣忚褰曞皢鑰楃敤棰濆鐨29瀛楄妭绱㈠紩鍐呭瓨锛屽湪绀轰緥琛ㄤ腑锛岃繕鍖呮嫭12瀛楄妭鐨勫紑閿鍐嶅姞涓8瀛楄妭鐨勮褰曟暟鎹

鍥犳锛屽浜100涓囨潯璁板綍锛岄渶瑕58MB鐨勭储寮曞唴瀛樻潵澶勭悊鐢ㄤ簬涓婚敭鍜屽敮涓鎬х害鏉熺殑鍝堝笇绱㈠紩銆傝繕闇瑕64 MB鏉ュ鐞嗗熀琛ㄥ拰鍞竴绱㈠紩琛ㄣ佷互鍙婁袱涓湁搴忕储寮曡〃鐨勮褰曘

鐢辨鍙锛屽搱甯岀储寮曞崰鐢ㄤ簡鐩稿綋澶х殑鍐呭瓨绌洪棿锛屼絾浣滀负鍥炴姤锛屽畠浠彁渚涗簡瀵规暟鎹殑鏋佸揩璁块棶銆傚湪MySQl绨囦腑锛屽畠浠篃鐢ㄤ簬澶勭悊鍞竴鎬х害鏉熴

鐩墠浠呮湁鐨勫垎鍖虹畻娉曟槸鏁e垪娉曪紝鏈夊簭绱㈠紩瀵规瘡涓妭鐐规潵璇撮兘鏄眬閮ㄦх殑銆傚洜姝わ紝鏈夊簭绱㈠紩涓嶈兘鐢ㄤ簬澶勭悊涓鑸儏鍐典笅鐨勫敮涓鎬х害鏉熴

瀵逛簬IndexMemoryDataMemory锛岄噸瑕佺殑鏄紝鎬荤殑鏁版嵁搴撳ぇ灏忔槸鍚勮妭鐐圭粍鐨勬墍鏈夋暟鎹唴瀛樺拰鎵鏈夌储寮曞唴瀛樹箣鍜屻傛瘡涓妭鐐圭粍鐢ㄤ簬淇濆瓨澶嶅埗淇℃伅锛屽洜姝わ紝濡傛灉鏈4涓妭鐐瑰拰2涓壇鏈紝灏嗘湁2涓妭鐐圭粍銆傚浜庢瘡涓暟鎹妭鐐癸紝鍙敤鐨勬绘暟鎹唴瀛樻槸2*DataMemory

寮虹儓寤鸿涓烘墍鏈夌殑鑺傜偣璁剧疆鐩稿悓鐨DataMemory鍊煎拰IndexMemory鍊笺傜敱浜庢暟鎹槸骞冲潎鍒嗗竷鍦ㄧ皣涓殑鎵鏈夎妭鐐逛笂锛屼换浣曡妭鐐瑰彲鐢ㄧ殑鏈澶х┖闂翠笉瓒呰繃绨囦腑鏈灏忚妭鐐圭殑鍙敤绌洪棿銆

DataMemoryIndexMemory鍙鏇存敼锛屼絾闄嶄綆浠讳綍涓涓殑鍊煎潎浼氬鑷村嵄闄╋紝濡傛灉杩欐牱鍋氾紝寰堝鏄撲娇鏌愪竴鑺傜偣鐢氳嚦鏁翠釜绨囧洜缂哄皯瓒冲鐨勫唴瀛樼┖闂磋屾棤娉曢噸鍚傚鍔犲畠浠殑鍊煎簲鏄彲鎺ュ彈鐨勶紝浣嗗缓璁噰鐢ㄤ笌杞欢鍗囩骇鐩稿悓鐨勬柟寮忓崌绾у畠锛岄鍏堟洿鏂伴厤缃枃浠讹紝鐒跺悗閲嶅惎绠$悊鏈嶅姟鍣紝鏈鍚庝緷娆¢噸鍚瘡涓暟鎹妭鐐广

鏇存柊涓嶄細澧炲姞鎵鐢ㄧ殑绱㈠紩鍐呭瓨銆傛彃鍏ュ皢绔嬪埢鐢熸晥锛屼絾鏄紝鍦ㄦ彁浜や簨鍔′箣鍓嶅苟涓嶄細瀹為檯鍒犻櫎琛屻

IndexMemory鐨勯粯璁ゅ兼槸18MB銆傛渶灏忓间负1MB

浜嬪姟鍙傛暟

涓嬮潰璁ㄨ鐨勪笁涓弬鏁板崄鍒嗛噸瑕侊紝杩欐槸鍥犱负锛屽畠浠細褰卞搷骞跺彂浜嬪姟鐨勬暟鐩紝浠ュ強绯荤粺鑳藉澶勭悊鐨勪簨鍔$殑澶у皬銆MaxNoOfConcurrentTransactions鐢ㄤ簬璁剧疆鑺傜偣鍐呭彲鑳界殑骞跺彂浜嬪姟鏁扮洰銆MaxNoOfConcurrentOperations鐢ㄤ簬璁剧疆鑳藉悓鏃跺嚭鐜板湪鏇存柊闃舵鎴栧悓鏃堕攣瀹氱殑璁板綍鏁扮洰銆

瀵逛簬鎵撶畻璁惧畾鐗瑰畾鍊笺佷笉浣跨敤榛樿鍊肩殑鐢ㄦ埛锛岃繖涓や釜鍙傛暟鍙兘姝f槸浠栦滑鎵闇鐨勶紙灏ゅ叾鏄MaxNoOfConcurrentOperations锛夈傞粯璁ゅ兼槸涓轰娇鐢ㄥ皬鍨嬩簨鍔$殑绯荤粺鑰岃缃殑锛涓虹殑鏄‘淇濊繖绫讳簨鍔′笉浼氫娇鐢ㄨ繃澶氱殑鍐呭瓨銆

         [NDBD]MaxNoOfConcurrentTransactions

瀵逛簬绨囦腑鐨勬瘡涓椿鍔ㄤ簨鍔★紝蹇呴』鍦ㄧ皣鑺傜偣涔嬩竴涓湁1鏉¤褰曘傚浜嬪姟鐨勫崗璋冧换鍔℃槸鍦ㄥ悇鑺傜偣闂磋繘琛岀殑锛氬湪绨囦腑锛屼簨鍔¤褰曠殑鎬绘暟绛変簬浠绘剰缁欏畾鑺傜偣涓殑浜嬪姟鏁颁箻浠ョ皣涓殑鑺傜偣鏁般

浜嬪姟璁板綍琚垎閰嶇粰鍗曠嫭鐨MySQL鏈嶅姟鍣ㄣ傛甯告儏鍐典笅锛屽浜庝娇鐢ㄧ皣涓换浣曡〃鐨勬瘡涓繛鎺ワ紝蹇呴』涓哄叾鍒嗛厤鑷冲皯1鏉′簨鍔¤褰曘傚嚭浜庤鍘熷洜锛屽簲纭繚绨囦腑鐨勪簨鍔¤褰曟暟澶т簬绨囦腑鎵鏈MySQL鏈嶅姟鍣ㄧ殑骞跺彂杩炴帴鏁般

瀵逛簬鎵鏈夌殑绨囪妭鐐癸紝蹇呴』灏嗚鍙傛暟璁剧疆涓虹浉鍚岀殑鍊笺

鏇存敼璇ュ弬鏁颁笉瀹夊叏锛屽鏋滆繖鏍峰仛锛屼細瀵艰嚧绨囧穿婧冦傚綋鏌愪竴鑺傜偣宕╂簝鏃讹紝绨囦腑鐨勪竴涓妭鐐癸紙瀹為檯涓婃槸鐢熷瓨鏃堕棿鏈涔呯殑鑺傜偣锛夊皢涓哄穿婧冧箣鏃舵鍦ㄥ穿婧冭妭鐐逛腑杩愯鐨勬墍鏈変簨鍔″缓绔嬩簨鍔$姸鎬併傚洜姝わ紝閲嶈鐨勬槸锛岃鑺傜偣鐨勪簨鍔¤褰曟暟涓嶄綆浜庡け鏁堣妭鐐逛腑鐨勪簨鍔¤褰曟暟銆

璇ュ弬鏁扮殑榛樿鍊间负4096.

         [NDBD]MaxNoOfConcurrentOperations

鏍规嵁浜嬪姟鐨勫ぇ灏忓拰鏁扮洰璋冩暣璇ュ弬鏁扮殑鍊硷紝杩欎釜鎯虫硶涓嶉敊銆傛墽琛屼粎鍖呭惈灏戦噺鎿嶄綔涓斾笉娑夊強寰堝璁板綍鐨勪簨鍔℃椂锛屼笉闇瑕佸皢璇ュ弬鏁拌缃緱寰堥珮銆備絾鍦ㄦ墽琛屾秹鍙婂ぇ閲忚褰曠殑澶т簨鍔℃椂锛岄渶瑕佸皢璇ュ弬鏁拌缃緱杈冮珮銆

瀵逛簬姣忔浜嬪姟鏇存柊鐨勭皣鏁版嵁锛屽潎浼氫繚瀛樿褰曪紝骞朵細灏嗗畠浠繚瀛樺湪浜嬪姟鍗忚皟鍣ㄤ腑浠ュ強鎵ц瀹為檯鏇存柊鐨勮妭鐐逛腑銆傝繖浜涜褰曞寘鍚墍闇鐨勭姸鎬佷俊鎭紝杩欑被淇℃伅鍙敤浜庝负鍥炴粴鎿嶄綔鎵惧埌UNDO璁板綍锛岀敤浜庨攣瀹氭煡璇㈡垨鍏朵粬鐩殑銆

璇ュ弬鏁板簲琚缃负锛氫簨鍔′腑鍚屾椂鏇存柊鐨勮褰曟暟闄や互绨囨暟鎹妭鐐圭殑鏁扮洰銆備緥濡傦紝鍦ㄥ寘鍚4涓暟鎹妭鐐圭殑绨囦腑锛屽鏋滈鏈熷鐞嗙殑銆佷娇鐢ㄤ簨鍔$殑骞跺彂鏇存柊鏁颁负1000000锛屽氨搴斿皢璇ュ艰缃负1000000 / 4 = 250000

璁剧疆閿佸畾鐨勮璇锋眰涔熶細瀵艰嚧鎿嶄綔璁板綍鐨勫垱寤恒傚湪鍗曠嫭鑺傜偣鍐呬篃浼氬垎閰嶄竴浜涢澶栫殑绌洪棿锛屼互渚垮鐞嗗湪鑺傜偣闂村垎閰嶄笉瀹岀編鐨勯棶棰樸

褰撴煡璇娇鐢ㄥ敮涓鎬у搱甯岀储寮曟椂锛屽浜庝簨鍔′腑鐨勬瘡鏉¤褰曪紝瀹為檯涓婂皢浣跨敤涓ゆ潯鎿嶄綔璁板綍銆傜1鏉¤褰曚唬琛ㄥ湪绱㈠紩琛ㄤ腑鐨勮锛岀2鏉¤褰曡礋璐e鐞嗗熀琛ㄤ笂鐨勬搷浣溿

璇ュ弬鏁扮殑榛樿鍊间负32768.

璇ュ弬鏁板疄闄呬笂澶勭悊鐨勬槸鑳藉垎鍒厤缃殑涓や釜鍊笺傜1涓兼寚瀹氫簡灏嗗灏戞搷浣滆褰曟斁鍒颁簨鍔″崗璋冨櫒涓紝绗2涓兼寚瀹氫簡澶氬皯鎿嶄綔璁板綍鏄暟鎹簱鐨勬湰鍦拌褰曘

瀵逛簬鍦8鑺傜偣绨囦笂鎵ц鐨勭壒澶т簨鍔★紝瀹冭姹備簨鍔″崗璋冨櫒涓殑鎿嶄綔璁板綍鏁颁笉灏戜簬浜嬪姟涓秹鍙婄殑璇诲彇銆佹洿鏂板拰鍒犻櫎娆℃暟銆傜劧鑰岋紝绨囦腑鐨勬搷浣滆褰曞垎甯冨湪鎵鏈夌殑8涓妭鐐逛笂銆傚洜姝わ紝濡傛灉鏈夊繀瑕佷负鐗瑰ぇ浜嬪姟閰嶇疆绯荤粺锛岃壇濂界殑鏂规硶鏄垎鍒厤缃鍙傛暟鐨勪袱涓儴鍒嗐MaxNoOfConcurrentOperations鎬讳細琚敤浜庤绠鑺傜偣鐨勪簨鍔″崗璋冨櫒閮ㄥ垎涓殑鎿嶄綔璁板綍鏁般

搴斾簡瑙f搷浣滆褰曞鍐呭瓨鐨勮姹傦紝杩欑偣涔熷緢閲嶈銆傛瘡璁板綍绾︽秷鑰1KB

         [NDBD]MaxNoOfLocalOperations

榛樿鎯呭喌涓嬶紝灏嗘寜鐓1.1 * MaxNoOfConcurrentOperations璁$畻璇ュ弬鏁帮紝瀹冮傚悎浜庡叿鏈夊緢澶氬苟鍙戜簨鍔′絾涓嶅瓨鍦ㄧ壒澶т簨鍔$殑绯荤粺銆濡傛灉闇瑕佸湪鏌愪竴鏃堕棿澶勭悊鐗瑰ぇ浜嬪姟鑰屼笖鏈夊緢澶氳妭鐐癸紝鏈濂介氳繃鏄庣‘鎸囧畾璇ュ弬鏁颁互瑕嗙洊榛樿鍊笺

浜嬪姟涓存椂瀛樺偍

涓嬩竴缁勫弬鏁扮敤浜庡喅瀹氭墽琛屼綔涓虹皣浜嬪姟缁勬垚閮ㄥ垎鐨勬煡璇㈡椂鎵闇鐨勪复鏃跺瓨鍌ㄧ┖闂淬傛煡璇㈠畬鎴愬悗灏嗛噴鏀炬墍鏈夎褰曪紝绨囧皢绛夊緟鎻愪氦鎴栧洖婊氫簨浠躲

瀵逛簬澶у鏁版儏鍐碉紝杩欎簺鍙傛暟鐨勯粯璁ゅ兼槸鎭板綋鐨勩備絾鏄紝濡傛灉闇瑕佹敮鎸佹秹鍙婂ぇ閲忚鎴栨搷浣滅殑浜嬪姟锛岀敤鎴锋垨璁稿簲澧炲ぇ杩欎簺鍙傛暟鐨勫硷紝浠ヤ究鍦ㄧ郴缁熶腑鑾峰緱鏇村ソ鐨勫钩琛屾с傚浜庨渶瑕佺浉瀵硅緝灏戜簨鍔$殑搴旂敤绋嬪簭锛岀敤鎴峰彲闄嶄綆杩欎簺鍙傛暟鐨勫硷紝浠ヤ究鑺傜渷鍐呭瓨銆

         [NDBD]MaxNoOfConcurrentIndexOperations

瀵逛簬浣跨敤鍞竴鎬у搱甯岀储寮曠殑鏌ヨ锛屽湪鏌ヨ鎵ц鏈熼棿锛屽皢浣跨敤鎿嶄綔璁板綍鐨勫彟涓涓复鏃堕泦鍚堛傝鍙傛暟鐢ㄤ簬璁剧疆璁板綍姹犵殑澶у皬銆傚洜姝わ紝浠呭綋鎵ц鏌ヨ鐨勬煇涓閮ㄥ垎鏃舵墠浼氬垎閰嶈璁板綍锛屼竴鏃﹁閮ㄥ垎鎵ц瀹屾垚锛屽皢閲婃斁璁板綍銆傚浜庡鐞嗘斁寮冨拰鎻愪氦鎵闇鐨勭姸鎬侊紝瀹冩槸鐢辨甯哥殑鎿嶄綔璁板綍璐熻矗澶勭悊鐨勶紝杩欑被璁板綍鐨勬睜澶у皬鐢卞弬鏁MaxNoOfConcurrentOperations璁剧疆銆

璇ュ弬鏁扮殑榛樿鍊间负8192銆傚彧鏈夊湪鏋佸叾缃曡鐨勬儏鍐典笅锛岄渶瑕佷娇鐢ㄥ敮涓鎬у搱甯岀储寮曟墽琛屾瀬楂樼殑骞惰鎿嶄綔鏃讹紝鎵嶆湁蹇呰澧炲ぇ璇ュ笺傚鏋DBA锛堟暟鎹簱绠$悊鍛橈級纭俊璇ョ皣涓嶉渶瑕侀珮鐨勫苟琛屾搷浣滐紝鍙互浣跨敤杈冨皬鐨勫煎苟鑺傜渷鍐呭瓨銆

         [NDBD]MaxNoOfFiredTriggers

MaxNoOfFiredTriggers鐨勯粯璁ゅ兼槸4000锛屽畠瓒充互搴斾粯澶у鏁版儏鍐点傚湪鏌愪簺鎯呭喌涓嬶紝濡傛灉DBA璁や负鍦ㄧ皣涓骞惰鎿嶄綔鐨勮姹傚苟涓嶉珮锛岀敋鑷宠繕鑳介檷浣庡畠銆

鎵ц浼氬奖鍝嶅敮涓鍝堝笇绱㈠紩鐨勬搷浣滄椂锛屽皢鍒涘缓璁板綍銆傚湪鍏锋湁鍝堝笇绱㈠紩鐨勮〃涓彃鍏ユ垨鍒犻櫎璁板綍鏃讹紝鎴栨洿鏂颁綔涓哄敮涓鍝堝笇绱㈠紩缁勬垚閮ㄥ垎鐨勫垪鏃讹紝鍧囦細瑙﹀彂绱㈠紩琛ㄤ腑鐨勬彃鍏ユ垨鍒犻櫎鎿嶄綔銆傛墍鑾峰緱鐨勮褰曠敤浜庝唬琛ㄨ绱㈠紩琛ㄦ搷浣滐紝鍚屾椂绛夊緟淇冧娇鍏跺畬鎴愮殑鍒濆鎿嶄綔銆傝鎿嶄綔鐨勬椂闂村緢鐭紝浣嗗浜庡湪鍩鸿〃锛堝寘鍚敮涓鍝堝笇绱㈠紩锛変笂鏈夊緢澶氬苟鍙戝啓鎿嶄綔鐨勬儏褰紝浠嶉渶瑕佸湪璁板綍姹犱腑鏈夊ぇ閲忕殑璁板綍銆

         [NDBD]TransactionBufferMemory

璇ュ弬鏁板奖鍝嶇殑鍐呭瓨鐢ㄤ簬璺熻釜鏇存柊绱㈠紩琛ㄥ拰璇诲彇鍞竴绱㈠紩鏃舵墽琛岀殑鎿嶄綔銆傝鍐呭瓨鐢ㄤ簬淇濆瓨鍏充簬杩欑被鎿嶄綔鐨勯敭鍜屽垪淇℃伅銆傚嚑涔庝笉闇瑕佹洿鏀硅鍙傛暟鐨勯粯璁ゅ笺

姝e父鐨勮鍜屽啓鎿嶄綔浣跨敤绫讳技鐨勭紦鍐插尯锛屽叾浣跨敤鏃堕棿鐢氳嚦鏇寸煭銆傜紪璇戞椂闂村弬鏁ZATTRBUF_FILESIZE锛堝湪ndb/src/kernel/blocks/Dbtc/Dbtc.hpp涓級琚涓4000*128瀛楄妭锛500KB锛夈傜敤浜 閿俊鎭殑绫讳技缂撳啿鍖猴紝ZDATABUF_FILESIZE锛堜篃鍦Dbtc.hpp涓級鍖呭惈4000 * 16 = 62.5KB鐨勭紦鍐茬┖闂淬Dbtc鏄敤浜庡鐞嗕簨鍔″崗璋冪殑妯″潡銆

鎵弿鍜岀紦鍐

Dblqh妯″潡涓锛堝湪ndb/src/kernel/blocks/Dblqh/Dblqh.hpp鍐咃級鏈夊緢澶氶檮鍔犲弬鏁帮紝杩欎簺鍙傛暟浼氬奖鍝嶈鍜屽啓鎿嶄綔銆傝繖浜涘弬鏁板寘鎷細ZATTRINBUF_FILESIZE锛岄粯璁ゅ间负10000*128瀛楄妭锛1250KB锛夛紱浠ュ強ZDATABUF_FILE_SIZE锛岄粯璁ょ殑缂撳啿绌洪棿澶у皬涓10000*16瀛楄妭锛堢害156KB锛夈傚埌鐩墠涓烘锛屾病鏈変换浣曡抗璞¤〃鏄庡簲澧炲姞杩欑被缂栬瘧鏃堕棿闄愬埗鍙傛暟鐨勫硷紝鏃犺鏄敤鎴锋姤鍛婅繕鏄垜浠嚜宸辩殑澶ч噺娴嬭瘯銆

TransactionBufferMemory鐨勯粯璁ゅ兼槸1MB

         [NDBD]MaxNoOfConcurrentScans

璇ュ弬鏁扮敤浜庢帶鍒跺彲鍦ㄧ皣涓墽琛岀殑骞惰鎵弿鐨勬暟鐩傛瘡涓簨鍔″崗璋冪▼搴忓潎鑳藉鐞嗕负璇ュ弬鏁板畾涔夌殑骞惰鎵弿銆傚浜庢瘡娆℃墽琛岀殑鎵弿鏌ヨ锛屽皢浠ュ苟琛屾柟寮忔壂鎻忔墍鏈夊垎鍖恒傛瘡娆″垎鍖烘壂鎻忓皢浣跨敤鍒嗗尯鎵鍦ㄨ妭鐐瑰唴鐨勬壂鎻忚褰曪紝璁板綍鏁扮瓑浜庤鍙傛暟鐨勫间箻浠ヨ妭鐐规暟銆傜皣搴旇兘鏀寔浠庣皣鍐呮墍鏈夎妭鐐瑰悓鏃舵墽琛岀殑MaxNoOfConcurrentScans鎵弿銆

鎵弿瀹為檯涓婃槸鍦ㄤ袱绉嶆儏鍐典笅鎵ц鐨勩傜1绉嶆儏鍐垫槸锛屽鐞嗘煡璇㈡椂涓嶅瓨鍦ㄥ搱甯屾垨鏈夊簭绱㈠紩锛屽湪璇ユ儏鍐典笅锛屾煡璇㈡槸閫氳繃鎵ц鍏ㄨ〃鎵弿杩涜鐨勩傜2绉嶆儏鍐垫槸锛屾病鏈夋敮鎸佹煡璇㈢殑鍝堝笇绱㈠紩锛屼絾瀛樺湪鏈夊簭绱㈠紩銆備娇鐢ㄦ湁搴忕储寮曟剰鍛崇潃灏嗘墽琛屽苟鍙戣寖鍥存壂鎻忋傜敱浜庨『搴忎粎淇濆瓨鍦ㄦ湰鍦板垎鍖轰笂锛岄渶瑕佸湪鎵鏈夊垎鍖轰笂鎵ц绱㈠紩鎵弿銆

MaxNoOfConcurrentScans鐨勯粯璁ゅ兼槸256銆傛渶澶у间负500

璇ュ弬鏁版寚瀹氫簡浜嬪姟鍗忚皟鍣ㄤ腑鐨勫彲鑳芥壂鎻忔暟銆傚鏋滄湭鎻愪緵鏈湴鎵弿璁板綍鐨勬暟鐩紝浼氬鍏惰繘琛岃绠楋紝绛変簬MaxNoOfConcurrentScans涔樹互绯荤粺涓暟鎹妭鐐圭殑鏁扮洰銆

         [NDBD]MaxNoOfLocalScans

濡傛灉寰堝鎵弿涓嶆槸瀹屽叏骞惰鍖栫殑锛屾寚瀹氭湰鍦版壂鎻忚褰曠殑鏁扮洰銆

         [NDBD]BatchSizePerLocalScan

璇ュ弬鏁扮敤浜庤绠楅攣瀹氳褰曠殑鏁扮洰锛岃鎯冲鐞嗗緢澶氬苟鍙戞壂鎻忔搷浣滐紝闇瑕佽繖绫昏褰曘

榛樿鍊兼槸64锛岃鍊间笌SQL鑺傜偣涓畾涔夌殑ScanBatchSize鍏崇郴瀵嗗垏銆

         [NDBD]LongMessageBuffer

杩欐槸鐢ㄤ簬鍦ㄥ崟鐙妭鐐瑰唴鍜岃妭鐐逛箣闂翠紶閫掓秷鎭殑鍐呴儴缂撳啿銆傚敖绠″嚑涔庝笉闇瑕佹敼鍙樺畠锛屼絾瀹冧粛鏄彲閰嶇疆鐨勩傞粯璁ゆ儏鍐典笅锛屽畠琚缃负1MB

鏃ュ織鍜Checkpointing

         [NDBD]NoOfFragmentLogFiles

璇ュ弬鏁扮敤浜庤缃妭鐐圭殑REDO鏃ュ織鏂囦欢鐨勫ぇ灏忋REDO鏃ュ織鏂囦欢鏄寜寰幆鏂瑰紡缁勭粐鐨勩傜1涓拰鏈鍚1涓棩蹇楁枃浠讹紙鏈夋椂涔熷垎鍒О涓衡滃ご鈥濇棩蹇楁枃浠跺拰鈥滃熬鈥濇棩蹇楁枃浠讹級涓嶅簲鐩搁亣锛岃繖鐐规瀬鍏堕噸瑕侊紝褰撳畠浠郊姝よ繃浜庢帴杩戞椂锛岀敱浜庣己灏戞柊鏃ュ織璁板綍鐨勭┖闂达紝鑺傜偣灏嗗紑濮嬫斁寮冩墍鏈変簨鍔★紝鍖呮嫭鏇存柊銆

鑷彃鍏ユ棩蹇楄褰曞紑濮嬶紝鍦ㄤ笁涓湰鍦版鏌ョ偣瀹屾垚涔嬪墠锛屼笉浼氬垹闄REDO鏃ュ織璁板綍銆傛鏌ョ偣鐨勯鐜囩敱鍏惰嚜宸辩殑閰嶇疆鍙傛暟闆嗗喅瀹氾紝璇峰弬瑙佹湰绔犵殑鐩稿簲閮ㄥ垎銆

榛樿鐨勫弬鏁板间负8锛屽畠琛ㄧず鏈8涓泦鍚堬紝姣忎釜闆嗗悎鏈416MB鏂囦欢锛屾诲閲忎负512MB銆傛崲鍙ヨ瘽璁诧紝REDO鏃ュ織绌洪棿蹇呴』鎸64MB鐨勫潡澶у皬鍒嗛厤銆傚湪闇瑕佸ぇ閲忔洿鏂扮殑鎯呭喌涓嬶紝鍙兘闇瑕佸皢NoOfFragmentLogFiles鐨勫煎鍔犲埌300鎴栨洿楂橈紝浠ヤ究涓REDO鏃ュ織鎻愪緵瓒冲鐨勭┖闂淬

濡傛灉checkpointing寰堟參锛屽苟鏈夊緢澶氬鏁版嵁搴撶殑鍐欐搷浣滀互鑷充簬鏃ュ織鏂囦欢宸叉弧锛岃屼笖鍦ㄦ病鏈jeapo rdising鎭㈠鍔熻兘鐨勬儏鍐典笅鏃犳硶鎴柇鏃ュ織灏鹃儴锛岄偅涔堟墍鏈夌殑鏇存柊鏃ュ織鍧囧皢琚斁寮冿紝骞剁粰鍑洪敊璇唬鐮410鎴栫己灏戜复鏃舵棩蹇楃┖闂淬傝鐘跺喌灏嗕竴鐩存寔缁紝鐩磋嚦瀹屾垚浜嗘鏌ョ偣鎿嶄綔骞惰兘灏嗘棩蹇楀熬閮ㄥ悜鍓嶇Щ鍔ㄤ负姝€

         [NDBD]MaxNoOfSavedMessages

璇ュ弬鏁扮敤浜庤缃窡韪枃浠剁殑鏈澶ф暟鐩紝鍦ㄨ鐩栨棫鏂囦欢涔嬪墠锛屽皢淇濈暀杩欎簺璺熻釜鏂囦欢銆傛棤璁哄嚭浜庝綍绉嶅師鍥狅紝褰撹妭鐐瑰穿婧冩椂灏嗗垱寤鸿窡韪枃浠躲

榛樿涓25涓窡韪枃浠躲

鍏冩暟鎹璞

涓嬩竴缁勫弬鏁颁负鍏冩暟鎹璞″畾涔変簡姹犵殑澶у皬锛屽彲鐢ㄤ簬瀹氫箟鏈澶у睘鎬ф暟锛岃〃锛岀储寮曪紝绱㈠紩浣跨敤鐨勮Е鍙戠▼搴忓璞★紝浜嬩欢锛屼互鍙婄皣涔嬮棿鐨勫鍒躲傛敞鎰忥紝杩欎簺鍙傛暟浠呮槸瀵圭皣鐨勨滃缓璁濓紝浠讳綍鏈寚瀹氱殑鍙傛暟鍧囧皢閲囩敤鍏堕粯璁ゅ笺

         [NDBD]MaxNoOfAttributes

瀹氫箟浜嗗彲鍦ㄧ皣涓畾涔夌殑灞炴ф暟鐩

璇ュ弬鏁扮殑榛樿鍊间负1000锛屾渶灏忕殑鍙兘鍊间负32銆傛病鏈夋渶澶у奸檺鍒躲傚浜庢瘡涓灞炴э紝姣忚妭鐐圭害闇200瀛楄妭鐨勫瓨鍌ㄧ┖闂达紝杩欐槸搴斾负锛屾墍鏈夌殑鍏冩暟鎹皢瀹屾暣鍦板鍒跺埌鏈嶅姟鍣ㄤ笂銆

璁剧疆MaxNoOfAttributes鏃讹紝搴斿疄鐜板噯澶囧ソ鎵撶畻鍦ㄥ皢鏉ユ墽琛岀殑浠讳綍ALTER TABLE鍛戒护锛岃繖鐐瑰緢閲嶈銆傝繖鏄洜涓轰笅杩颁簨瀹烇紝鍦ㄧ皣琛ㄤ笂鎵цALTER TABLE鐨勮繃绋嬩腑锛屾墍浣跨敤鐨勫睘鎬ф暟鐩槸鍘熷琛ㄤ腑鐨3鍊嶃備緥濡傦紝濡傛灉鏌愪竴琛ㄩ渶瑕100涓睘鎬э紝鑰屼笖浣犳墦绠楀湪浠ュ悗鏇存敼瀹冿紝閭d箞灏遍渶瑕佸皢MaxNoOfAttributes鐨勫艰涓300銆傛湁涓涓壇濂界殑缁忛獙瑙勫垯锛屽鏋滀綘鑳藉湪涓嶅嚭鐜伴棶棰樼殑鎯呭喌涓嬪垱寤烘墍鏈夋墍闇鐨勮〃锛岃灏嗘渶澶ц〃涓睘鎬ф暟鐩殑涓ゅ嶅姞鍒MaxNoOfAttributes涓娿傚畬鎴愯璁剧疆鍚庯紝搴旈氳繃鎵ц瀹為檯鐨ALTER TABLE鎿嶄綔锛岄獙璇佽鏁扮洰鏄冻澶熺殑銆傚鏋滃け璐ワ紝灏嗗師濮嬪肩殑鍊嶆暟鍔犲埌MaxNoOfAttributes涓婏紝骞跺啀娆℃祴璇曘

         [NDBD]MaxNoOfTables

琛ㄥ璞℃槸涓烘瘡涓〃銆佸敮涓鍝堝笇绱㈠紩鍜屾湁搴忕储寮曞垎閰嶇殑銆傝鍙傛暟涓轰綔涓烘暣浣撶殑绨囪缃簡鏈澶ц〃瀵硅薄鏁扮洰銆

瀵逛簬鍏锋湁BLOB鏁版嵁绫诲瀷鐨勬瘡涓睘鎬э紝灏嗕娇鐢ㄩ澶栫殑琛ㄦ潵淇濆瓨澶ч儴鍒BLOB鏁版嵁銆傚畾涔夎〃鐨勬绘暟鏃讹紝蹇呴』灏嗚繖浜涜〃鑰冭檻鍦ㄥ唴銆

璇ュ弬鏁扮殑榛樿鍊间负128銆傛渶灏忓间负8锛屾渶澶у间负1600銆傛瘡涓〃瀵硅薄姣忚妭鐐圭害闇20KB鐨勭┖闂淬

         [NDBD]MaxNoOfOrderedIndexes

瀵逛簬绨囦腑鐨勬瘡涓湁搴忕储寮曪紝灏嗗垎閰1涓璞★紝璇ュ璞℃弿杩颁簡缂栧叆绱㈠紩鐨勬槸浠涔堜互鍙婂叾瀛樺偍娈点傞粯璁ゆ儏鍐典笅锛屾瘡涓繖鏍峰畾涔夌殑绱㈠紩杩樺皢瀹氫箟1涓湁搴忕储寮曘傛瘡涓敮涓绱㈠紩鍜屼富閿棦鏈1涓湁搴忕储寮曡繕鏈1涓搱甯岀储寮曘

璇ュ弬鏁扮殑榛樿鍊间负128銆傛瘡涓璞℃瘡鑺傜偣绾﹂渶10KB鐨勬暟鎹

         [NDBD]MaxNoOfUniqueHashIndexes

瀵逛簬姣忎釜涓嶆槸涓婚敭鐨勫敮涓绱㈠紩锛屽皢鍒嗛厤1涓壒娈婅〃锛岃琛ㄥ皢鍞竴閿槧灏勫埌绱㈠紩琛ㄧ殑涓婚敭涓娿傞粯璁ゆ儏鍐典笅锛屽浜庢瘡涓敮涓绱㈠紩锛岃繕灏嗗畾涔1涓湁搴忕储寮曘備负浜嗛槻姝㈣鎯呭喌锛屽畾涔夊敮涓绱㈠紩鏃讹紝蹇呴』浣跨敤USING HASH閫夐」銆

榛樿鍊兼槸64銆傛瘡涓储寮曟瘡鑺傜偣绾﹂渶15KB鐨勭┖闂淬

         [NDBD]MaxNoOfTriggers

瀵逛簬姣忎釜鍞竴鎬у搱甯岀储寮曪紝灏嗗垎閰嶅唴閮ㄦ洿鏂般佹彃鍏ャ佸拰鍒犻櫎瑙﹀彂绋嬪簭锛堣繖鎰忓懗鐫瀵逛簬姣忎釜鍞竴鎬у搱甯岀储寮曪紝灏嗗垱寤轰笁涓Е鍙戠▼搴忥級銆備絾鏄紝1涓湁搴忕储寮曚粎闇瑕1涓Е鍙戠▼搴忓璞°傚浜庣皣涓瘡涓甯歌〃锛屽浠戒篃灏嗕娇鐢ㄤ笁涓Е鍙戠▼搴忓璞°

娉ㄩ噴锛氭敮鎸佺皣涔嬮棿鐨勫鍒舵椂锛屼篃灏嗕娇鐢ㄥ唴閮ㄨЕ鍙戠▼搴忋

璇ュ弬鏁扮敤浜庤缃皣涓Е鍙戠▼搴忓璞$殑鏈澶ф暟鐩

璇ュ弬鏁扮殑榛樿鍊间负768.

         [NDBD]MaxNoOfIndexes

MySQL 5.1涓紝璇ュ弬鏁板凡琚斁寮冿紝搴斾娇鐢MaxNoOfOrderedIndexesMaxNoOfUniqueHashIndexes鍙栬屼唬涔嬨

璇ュ弬鏁颁粎渚涘敮涓鎬у搱甯岀储寮曚娇鐢ㄣ傚浜庡湪绨囦腑瀹氫箟鐨勬瘡涓敮涓鎬у搱甯岀储寮曪紝鍦ㄨ姹犱腑闇瑕佹湁1鏉¤褰曘

璇ュ弬鏁扮殑榛樿鍊间负128.

甯冨皵鍙傛暟

鏁版嵁鑺傜偣鐨勮涓轰篃浼氬彈鍏锋湁甯冨皵鍊肩殑涓缁勫弬鏁扮殑褰卞搷銆傚皢鍏惰涓衡1鈥濇垨鈥Y鈥濓紝鍙皢杩欑被鍙傛暟璁剧疆涓衡滅湡鈥濓紝灏嗗叾璁句负鈥0鈥濇垨鈥N鈥濓紝鍙皢杩欑被鍙傛暟璁剧疆涓衡滃亣鈥濄

         [NDBD]LockPagesInMainMemory

瀵逛簬鍖呮嫭SolarisLinux鍦ㄥ唴鐨勫緢澶氭搷浣滅郴缁燂紝鑳藉灏嗚繘绋嬮攣瀹氬湪鍐呭瓨涓紝浠ラ伩鍏嶄笌纾佺洏鐨勪氦鎹€備娇鐢ㄥ畠锛屽彲纭繚绨囩殑瀹炴椂鐗规с

榛樿鎯呭喌涓嬶紝璇ョ壒鎬ф槸琚姝㈢殑銆

         [NDBD]StopOnError

鍑虹幇閿欒鏃讹紝璇ュ弬鏁版寚瀹氫簡NDBD杩涚▼鏄鍑鸿繕鏄墽琛岃嚜鍔ㄩ噸鍚

榛樿鎯呭喌涓嬶紝鍏佽璇ョ壒鎬с

         [NDBD]Diskless

鑳藉灏MySQL绨囩殑琛ㄦ寚瀹氫负鈥滄棤纾佺洏鐨勨濓紝杩欐剰鍛崇潃涓嶄細鍦ㄧ鐩樹笂瀵硅〃鎵ц妫鏌ョ偣鎿嶄綔锛屼篃涓嶄細鍑虹幇鏃ュ織鎿嶄綔銆傝繖绫昏〃浠呭瓨鍦ㄤ簬涓诲唴瀛樹腑銆備娇鐢ㄢ滄棤纾佺洏鈥濊〃鐨勪竴涓粨鏋滄槸锛屽嚭鐜板穿婧冧警锛屼笉浼氫繚鐣欒繖绫昏〃锛屼篃涓嶄細淇濈暀杩欑被琛ㄤ腑鐨勪换浣曡褰曘備絾鏄紝褰撳伐浣滃湪鈥滄棤纾佺洏鈥濇ā寮忎笅鏃讹紝鑳藉鍦ㄦ棤鐩樿绠楁満涓婅繍琛ndbd

瑕佺偣锛璇ョ壒鎬т細浣挎暣涓皣杩愯鍦ㄢ滄棤纾佺洏鈥濇ā寮忎笅銆

鍏佽璇ョ壒鎬ф椂锛屽彲鎵ц澶囦唤鎿嶄綔锛屼絾涓嶄細瀹為檯淇濆瓨澶囦唤鏁版嵁銆

灏嗏Diskless鈥濊缃负鈥1鈥濇垨鈥Y鈥濆彲鍏佽璇ョ壒鎬с傞粯璁ゆ儏鍐典笅锛岀姝㈣鐗规с

         [NDBD]RestartOnErrorInsert

浠呭綋鍒涘缓璋冭瘯鐗堟椂鎵嶈兘璁块棶璇ョ壒鎬э紝鍦ㄦ墽琛屼綔涓烘祴璇曠粍鎴愰儴浠界殑浠g爜鍧楃殑杩囩▼涓紝鍙互鎻掑叆閿欒銆

榛樿鎯呭喌涓嬶紝璇ョ壒鎬ф槸琚姝㈢殑銆

鎺у埗瓒呮椂銆侀棿闅斻佸拰纾佺洏鍒嗛〉

鏈夊绉嶇敤浜庢寚瀹氳秴鏃朵互鍙婄皣鏁版嵁鑺傜偣涓悇绉嶅姩浣滈棿鏃堕棿闂撮殧鐨勫弬鏁般傚ぇ澶氭暟瓒呮椂鍊间互姣涓哄崟浣嶆寚瀹氥備换浣曚緥澶栧潎灏嗗湪閫傜敤鏃舵寚鏄庛

         [NDBD]TimeBetweenWatchDogCheck

涓轰簡闃叉涓荤嚎绋嬪湪鏌愪竴鐐逛笂闄峰叆鏃犻檺寰幆锛岄噰鐢ㄤ簡鈥滅湅闂ㄧ嫍鈥濈嚎绋嬫潵妫鏌ヤ富绾跨▼銆傝鍙傛暟浠ユ绉掍负鍗曚綅鎸囧畾浜嗘鏌ヤ箣闂寸殑鏃堕棿闂撮殧銆傚鏋滀笁娆℃鏌ヤ箣鍚庤繘绋嬩粛淇濇寔鍦ㄧ浉鍚岀殑鐘舵侊紝瀹冨皢琚滅湅闂ㄧ嫍鈥濈嚎绋嬩腑姝€

鍑轰簬璇曢獙鐩殑锛屽彲鏂逛究鍦版洿鏀硅鍙傛暟锛屼篃鍙互瀵瑰叾杩涜璋冩暣浠ラ傚悎鏈湴鏉′欢銆備篃鍙互鎸夎妭鐐规寚瀹氬畠锛岃櫧鐒惰繖鏍蜂綔鐨勭悊鐢卞緢灏戙

榛樿瓒呮椂涓4000姣锛4绉掞級銆

         [NDBD]StartPartialTimeout

璇ュ弬鏁版寚瀹氫簡鍦ㄨ皟鐢ㄧ皣鍒濆鍖栧瓙绋嬪簭涔嬪墠锛岀皣绛夊緟鎵鏈夊瓨鍌ㄨ妭鐐瑰嚭鐜扮殑鏃堕棿銆傝瓒呮椂鍙傛暟鐢变簬闃叉閮ㄥ垎绨囧惎鍔ㄣ

榛樿鍊兼槸30000姣锛30绉掞級銆0琛ㄧず鏃犻檺瓒呮椂锛屾崲鍙ヨ瘽璁诧紝浠呭綋鎵鏈夎妭鐐瑰潎鍙兘鏃舵墠浼氬惎鍔ㄧ皣銆

         [NDBD]StartPartitionedTimeout

绛夊緟浜StartPartialTimeout姣鍚庯紝濡傛灉绨囧仛濂戒簡鍚姩鍑嗗浣嗕粛鍙兘澶勪簬闅旂鐘舵侊紝绨囧皢绛夊緟璇ヨ秴鏃舵椂闂寸粨鏉熴

榛樿瓒呮椂涓60000姣锛60绉掞級銆

         [NDBD]StartFailureTimeout

濡傛灉鏁版嵁鑺傜偣鍦ㄨ鍙傛暟鎸囧畾鐨勬椂闂村唴鏈畬鎴愬叾鍚姩搴忓垪锛岃妭鐐瑰惎鍔ㄥ皢澶辫触銆傚鏋滃皢璇ュ弬鏁拌缃负0锛岃〃绀轰笉閲囩敤鏁版嵁鑺傜偣瓒呮椂銆

榛樿鍊兼槸60000姣(60绉掞級銆傚浜庡寘鍚ぇ閲忔暟鎹殑鏁版嵁鑺傜偣锛屽簲澧炲姞璇ュ弬鏁般備緥濡傦紝瀵逛簬鍖呭惈鏁GB鏁版嵁鐨勫瓨鍌ㄨ妭鐐癸紝涓轰簡鎵ц鑺傜偣閲嶅惎锛屽彲鑳介渶瑕1015鍒嗛挓锛堝嵆6000001000000姣锛夈

         [NDBD]HeartbeatIntervalDbDb

鍙戠幇澶辫触鑺傜偣鐨勪富瑕佹柟娉曚箣涓鏄娇鐢ㄢ滃績璺斥濇暟銆傝鍙傛暟鎸囨槑浜嗗績璺充俊鍙风殑鍙戦侀鐜囷紝浠ュ強鎺ユ敹瀹冧滑鐨勯鐜囥傚鏋滃湪1琛屽唴涓㈠け浜嗕笁娆″績璺筹紝鑺傜偣灏嗚瀹e憡涓烘浜°傚洜姝わ紝閫氳繃蹇冭烦鏈哄埗鍙戠幇鏁呴殰鐨勬渶澶ф椂闂存槸蹇冭烦闂撮殧鐨勫洓鍊嶃

榛樿鐨勫績璺抽棿闅斾负1500姣锛1.5绉掞級銆備笉寰楀ぇ骞呭害鏇存敼璇ュ弬鏁帮紝鍚勮妭鐐归棿璇ュ弬鏁扮殑鍙樺寲鑼冨洿涔熶笉寰楄繃瀹姐備緥濡傦紝濡傛灉鏌愪竴鑺傜偣浣跨敤浜5000姣背鐨勫硷紝鑰岃瀵熷畠鐨勮妭鐐归噰鐢1000姣锛屽緢鏄剧劧锛岃鑺傜偣寰堝揩灏变細琚甯冧负姝讳骸銆傝兘澶熷湪杞欢鍗囩骇鏈熼棿鏇存敼璇ュ弬鏁帮紝浣嗗閲忓簲杈冨皬銆

         [NDBD]HeartbeatIntervalDbApi

姣忎釜鏁版嵁鑺傜偣浼氬皢蹇冭烦淇″彿鍙戦佸埌鍚MySQL鏈嶅姟鍣紙SQL鑺傜偣锛夛紝浠ョ‘淇濅繚鎸佹帴瑙︺傚鏋滄煇涓MySQL鏈嶅姟鍣ㄦ湭鑳藉強鏃跺彂鍑哄績璺充俊鍙凤紝瀹冨皢琚甯冧负姝讳骸銆傚湪杩欑鎯呭喌涓嬶紝鎵鏈夋鍦ㄨ繘琛岀殑浜嬪姟灏嗙粨鏉熷苟閲婃斁鎵鏈夎祫婧愩SQL鑺傜偣涓嶈兘閲嶆柊杩炴帴锛岀洿鑷崇敱浠ュ墠鐨MySQL瀹炰緥鍒濆鍖栫殑鎵鏈夋椿鍔ㄥ畬鎴愪负姝€傜敤浜庤鍒ゆ柇鐨3蹇冭烦鍒ゆ嵁涓HeartbeatIntervalDbDb鎻忚堪鐨勭浉鍚屻

榛樿鏃堕棿闂撮殧涓1500姣锛1.5绉掞級銆備笉鍚岀殑鏁版嵁鑺傜偣涔嬮棿锛岃闂撮殧鍙互鏈夋墍涓嶅悓锛岃繖鏄洜涓猴紝姣忎釜瀛樺偍鑺傜偣鍧囦細鐙珛浜庢墍鏈夊叾浠栨暟鎹妭鐐硅瀵熶笌涔嬬浉杩炵殑MySQL鏈嶅姟鍣ㄣ

         [NDBD]TimeBetweenLocalCheckpoints

璇ュ弬鏁版槸涓涓緥澶栵紝瀹冩湭鎸囧畾鍚姩鏂扮殑鏈湴妫鏌ュ墠搴旂瓑寰呯殑鏃堕棿锛岀浉鍙嶏紝瀹冪敤浜庣‘淇濆湪鍑虹幇鐩稿杈冨皯鏇存柊鐨勭皣鍐呮湭鎵ц鏈湴妫鏌ョ偣鎿嶄綔銆傚湪鍏锋湁杈冮珮鏇存柊鐜囩殑澶у鏁扮皣鍐咃紝寰堝彲鑳藉湪鍓嶄竴涓湰鍦版鏌ョ偣鎿嶄綔瀹屾垚鍚庣珛鍒诲惎鍔ㄤ竴涓柊鐨勬鏌ョ偣鎿嶄綔銆

浠庡墠涓涓湰鍦版鏌ョ偣鍚姩鍚庯紝鎵鏈夊凡鎵ц鍐欐搷浣滅殑澶у皬灏嗗鍔犮傝鍙傛暟涔熸槸涓涓緥澶栵紝鍘熷洜鍦ㄤ簬瀹冭鎸囧畾涓4瀛楄妭瀛楁绘暟鐨勪互2涓哄簳鏁扮殑瀵规暟锛屽洜姝わ紝榛樿鍊20琛ㄧず4MB (4 220)鍐欐搷浣滐紝21琛ㄧず8MB锛屼緷姝ょ被鎺紝鐩磋嚦绛夊悓浜8GB鍐欐搷浣滅殑鏈澶у31

绨囦腑鎵鏈夌殑鍐欐搷浣滃皢鍔犲湪涓璧枫傚皢TimeBetweenLocalCheckpoints璁剧疆涓6鎴栨洿灏忚〃绀烘湰鍦版鏌ョ偣鎿嶄綔灏嗕笉鍋滈】鍦拌繛缁墽琛岋紝涓庣皣鐨勫伐浣滆礋鑽锋棤鍏炽

         [NDBD]TimeBetweenGlobalCheckpoints

鎻愪氦浜嬪姟鏃讹紝瀹冭鎻愪氦鍒板瓨鏈夐暅鍍忔暟鎹殑鎵鏈夎妭鐐圭殑涓诲唴瀛樹腑銆備絾鏄紝浜嬪姟鏃ュ織璁板綍涓嶄細浣滀负鎻愪氦杩涚▼鐨勪竴閮ㄥ垎鍐欏叆纾佺洏銆傚叾鍘熷洜鍦ㄤ簬锛屽湪鑷冲皯涓ゅ彴鐙珛涓绘満鏈哄櫒涓婂畨鍏ㄤ綋鎻愪氦浜嬪姟搴旇兘婊¤冻鍏充簬鍏充簬鎸佷箙鎬х殑鍚堢悊鏍囧噯銆

鍙︿竴涓緢閲嶈鐨勬柟闈㈡槸锛屽簲纭繚鍗充娇鍦ㄦ渶宸儏鍐典笅锛堢皣瀹屽叏宕╂簝锛夛紝涔熻兘杩涜鎭板綋鍦板鐞嗐備负浜嗙‘淇濊繖鐐癸紝鍦ㄧ粰瀹氭椂闂撮棿闅斿唴鍑虹幇鐨勬墍鏈変簨鍔″潎浼氳鏀惧埌鍏ㄥ眬妫鏌ョ偣锛屽彲灏嗗叾瑙嗕负鍐欏叆纾佺洏鐨勫凡鎻愪氦浜嬪姟鐨勯泦鍚堛傛崲鍙ヨ瘽璁诧紝浣滀负鎻愪氦杩涚▼鐨勭粍鎴愰儴鍒嗭紝浜嬪姟灏嗚鏀惧叆鍏ㄥ眬妫鏌ョ偣缁勶紱绋嶅悗锛岃缁勭殑鏃ュ織璁板綍灏嗚鍐欏叆纾佺洏锛岀劧鍚庡皢鏁翠釜浜嬪姟缁勫畨鍏ㄥ湴鎻愪氦鍒扮皣鍐呮墍鏈夎绠楁満鐨勭鐩樹笂銆傘

璇ュ弬鏁板畾涔変簡鍏ㄥ眬妫鏌ョ偣鎿嶄綔涔嬮棿鐨勬椂闂撮棿闅斻傞粯璁ゅ间负2000姣銆 milliseconds.

         [NDBD]TimeBetweenInactiveTransactionAbortCheck

瀵逛簬璇ュ弬鏁版寚瀹氱殑姣忎釜鏃堕棿闂撮殧锛岄氳繃妫鏌ユ瘡涓簨鍔$殑瀹氭椂鍣ㄦ潵鎵ц瓒呮椂澶勭悊銆傚洜姝わ紝濡傛灉璇ュ弬鏁拌璁句负1000姣锛屾瘡闅1绉掑氨浼氬浜嬪姟杩涜妫鏌ャ

璇ュ弬鏁扮殑榛樿鍊间负1000姣锛1绉掞級銆

         [NDBD]TransactionInactiveTimeout

濡傛灉浜嬪姟鐩墠鏈墽琛屼换浣曟煡璇紝鑰屾槸绛夊緟杩涗竴姝ョ殑鐢ㄦ埛杈撳叆锛岃鍙傛暟鎸囨槑浜嗘斁寮冧簨鍔′箣鍓嶇敤鎴疯兘澶熺瓑寰呯殑鏈闀挎椂闂淬

璇ュ弬鏁扮殑榛樿鍊兼槸0锛堟棤瓒呮椂锛夈傚浜庨渶瑕佺‘淇濇棤浠讳綍浜嬪姟閿佸畾浜嗚繃闀挎椂闂寸殑鏁版嵁搴擄紝搴斿皢鍙傛暟璁剧疆涓鸿緝灏忕殑鍊笺傚崟浣嶄负姣銆

         [NDBD]TransactionDeadlockDetectionTimeout

褰撹妭鐐规墽琛屾秹鍙婁簨鍔$殑鏌ヨ鏃讹紝鍦ㄧ户缁箣鍓嶏紝鑺傜偣灏嗙瓑寰呯皣涓叾浠栬妭鐐逛綔鍑哄洖搴斻傚鏋滃嚭鐜颁笅杩板師鍥狅紝灏嗘棤娉曚簣浠ュ洖搴旓細

1.    鑺傜偣鈥滄浜♀濄

2.    鎿嶄綔杩涘叆閿佸畾闃熷垪銆

3.    琚姹傛墽琛屽姩浣滅殑鑺傜偣璐熻嵎杩囬噸銆

璇ヨ秴鏃跺弬鏁版寚鏄庝簡鏀惧純浜嬪姟涔嬪墠锛屼簨鍔″崗璋冨櫒绛夊欏彟涓鑺傜偣鎵ц鏌ヨ鐨勬椂闂撮暱鐭紝璇ュ弬鏁板湪鑺傜偣澶辫触澶勭悊鍜屾閿佹娴嬫柟闈㈠崄鍒嗛噸瑕併傚湪娑夊強姝婚攣鍜岃妭鐐瑰け璐ョ殑鎯呭舰涓嬶紝濡傛灉灏嗗叾璁剧疆鐨勮繃楂橈紝浼氬鑷翠笉鍚堥渶瑕佺殑琛屼负銆

榛樿鐨勮秴鏃跺间负1200姣锛1.2绉掞級銆

         [NDBD]NoOfDiskPagesToDiskAfterRestartTUP

鎵ц鏈湴妫鏌ョ偣鎿嶄綔鏃讹紝鐩稿簲鐨勭畻娉曚細灏嗘墍鏈夋暟鎹〉鍐欏叆纾佺洏銆傚鏋滆拷姹傚敖蹇畬鎴愯鎿嶄綔鑰屼笉鏄備腑锛屽緢鍙兘浼氬澶勭悊鍣ㄣ佺綉缁滃拰纾佺洏甯︽潵杩囬噸璐熸媴銆備负浜嗘帶鍒跺啓鍏ラ熷害锛岃鍙傛暟鎸囨槑浜嗘瘡100姣鍙啓鍏ュ灏戞暟鎹〉銆傚湪鏈儏褰笅锛1涓暟鎹〉瀹氫箟涓8KB锛屽洜鑰岃鍙傛暟鐨勫崟浣嶆槸姣忕80KB銆傚洜姝わ紝濡傛灉灏NoOfDiskPagesToDiskAfterRestartTUP璁剧疆涓20閭d箞鍦ㄦ墽琛屾湰鍦版鏌ョ偣鎿嶄綔鏈熼棿锛岃姹傛瘡绉掓兂纾佺洏鍐欏叆1.6MB鐨勬暟鎹傝鍊煎寘鎷拡瀵规暟鎹〉鐨UNDO鏃ュ織璁板綍鍐欏叆锛屼篃灏辨槸璇达紝璇ュ弬鏁拌兘澶勭悊鏉ヨ嚜鏁版嵁鍐呭瓨鐨勫啓鍏ラ檺鍒躲傜疆浜庨拡瀵圭储寮曢〉鐨UNDO鏃ュ織璁板綍锛屽畠浠槸鐢卞弬鏁NoOfDiskPagesToDiskAfterRestartACC澶勭悊鐨勶紙鍏充簬绱㈠紩椤电殑鏇村淇℃伅锛岃鍙傝鍏充簬IndexMemory鐨勬潯鐩級銆

绠鑰岃█涔嬶紝璇ュ弬鏁版寚瀹氫簡鎵ц鏈湴妫鏌ョ偣鎿嶄綔鐨勯熷害锛屽苟鑳戒笌NoOfFragmentLogFilesDataMemoryIndexMemory涓璧蜂娇鐢ㄣ

榛樿鍊兼槸40锛堟瘡绉3.2MB鐨勬暟鎹〉锛夈

         [NDBD]NoOfDiskPagesToDiskAfterRestartACC

璇ュ弬鏁颁娇鐢ㄧ殑鍗曚綅涓NoOfDiskPagesToDiskAfterRestartTUP鐨勭浉鍚岋紝宸ヤ綔鏂瑰紡涔熺被浼硷紝浣嗛檺鍒剁殑鏄粠绱㈠紩鍐呭瓨杩涜鐨勭储寮曢〉鍐欏叆閫熷害銆

璇ュ弬鏁扮殑榛樿鍊间负姣忕20涓储寮曞唴瀛橀〉锛1.6MB姣忕锛夈

         [NDBD]NoOfDiskPagesToDiskDuringRestartTUP

璇ュ弬鏁扮殑宸ヤ綔鏂瑰紡绫讳技浜NoOfDiskPagesToDiskAfterRestartTUPNoOfDiskPagesToDiskAfterRestartACC浣嗕粎瀵归噸鍚妭鐐规椂鍦ㄨ妭鐐瑰唴鎵ц鐨勬湰鍦版鏌ョ偣鎿嶄綔鏈夋晥銆備綔涓烘墍鏈夎妭鐐归噸鍚殑缁勬垚閮ㄤ唤锛屾讳細鎵ц鏈湴妫鏌ョ偣鎿嶄綔銆傚湪鑺傜偣閲嶅惎杩囩▼涓紝鑳藉浠ユ瘮鍏朵粬鏃堕棿鏇村揩鐨勯熷害鎵ц纾佺洏鍐欏叆鎿嶄綔锛岃繖鏄洜涓猴紝姝ゆ椂鍦ㄨ妭鐐瑰唴鎵ц鐨勬椿鍔ㄦ暟杈冨皯銆

璇ュ弬鏁版秹鍙婁粠鏁版嵁鍐呭瓨鍐欏叆鐨勯〉銆

榛樿鍊兼槸403.2MB姣忕锛夈

         [NDBD]NoOfDiskPagesToDiskDuringRestartACC

鍦ㄨ妭鐐归噸鍚殑鏈湴妫鏌ョ偣闃舵锛屽鑳藉鍐欏叆鍒扮鐩樼殑绱㈠紩鍐呭瓨椤电殑鏁扮洰杩涜鎺у埗銆

NoOfDiskPagesToDiskAfterRestartTUPNoOfDiskPagesToDiskAfterRestartACC涓鏍凤紝璇ュ弬鏁扮殑鍊奸噰鐢ㄧ殑鍗曚綅涔熸槸姣100姣鍐欏叆8KB80KB/绉掞級銆

榛樿鍊兼槸20 (1.6MB姣忕锛夈

         [NDBD]ArbitrationTimeout

璇ュ弬鏁版寚瀹氫簡鏁版嵁鑺傜偣绛夊緟浠茶绋嬪簭瀵逛徊瑁佹秷鎭殑鍥炲簲鐨勬椂闂淬傚鏋滆秴杩囦簡璇ユ椂闂达紝灏嗗亣瀹氱綉缁滃凡鏂紑銆

榛樿鍊兼槸1000姣锛1绉掞級銆

缂撳啿鍜屾棩蹇楀姛鑳

涓浜涗笌浠ュ墠鐨勭紪璇戞椂闂村弬鏁板搴旂殑閰嶇疆鍙傛暟浠嶅彲鐢ㄣ備娇鐢ㄨ繖浜涘弬鏁帮紝楂樼骇鐢ㄦ埛鑳藉瀵硅妭鐐硅繘绋嬩娇鐢ㄧ殑璧勬簮杩涜鏇村鐨勬帶鍒讹紝骞惰兘鏍规嵁闇瑕佽皟鏁村悇绉嶇紦鍐插尯澶у皬銆

灏嗘棩蹇楄褰曞啓鍏ョ鐩樻椂锛岃繖浜涚紦鍐插尯鐢ㄤ綔鏂囦欢绯荤粺鐨勫墠绔傚鏋滆妭鐐硅繍琛屽湪鏃犵洏妯″紡涓嬶紝閭d箞鍙互灏嗚繖浜涘弬鏁拌缃负瀹冧滑鐨勬渶灏忓艰屼笉浼氶犳垚璐熼潰褰卞搷锛岃繖鏄洜涓猴紝纾佺洏鍐欏叆鏄敱NDB瀛樺偍寮曟搸鐨勬枃浠剁郴缁熸彁鍙栧眰铏氭嫙鐨勩

         [NDBD]UndoIndexBuffer

璇ョ紦鍐茬敤浜庢湰鍦版鏌ョ偣鎿嶄綔鎵ц鏈熼棿銆NDB瀛樺偍寮曟搸閲囩敤浜嗕竴绉嶆仮澶嶆柟妗堬紝璇ユ柟妗堝缓绔嬪湪妫鏌ョ偣涓鑷存т互鍙婃搷浣滄REDO鏃ュ織鍊间笂銆備负浜嗗湪涓嶉殧鏂暣涓郴缁熺殑鍐欐搷浣滅殑鎯呭喌涓嬭幏寰椾竴鑷寸殑妫鏌ョ偣锛屽湪鎵ц鏈湴妫鏌ョ偣鎿嶄綔鐨勫悓鏃讹紝灏嗘墽琛UNDO鏃ュ織鎿嶄綔銆UNDO鏃ュ織鍔熻兘姣忔鏄湪鍗曚釜琛ㄥ亸鐭笂瑙﹀彂鐨勩傜敱浜庤〃鍏ㄩ儴淇濆瓨鍦ㄤ富鍐呭瓨涓紝璇ヤ紭鍖栨槸鍙兘鐨勩

UNDO绱㈠紩缂撳啿鐢ㄤ簬涓婚敭鍝堝笇绱㈠紩涓婄殑鏇存柊銆傛彃鍏ュ拰鍒犻櫎鎿嶄綔浼氬鑷村搱甯岀储寮曠殑閲嶆柊鎺掑垪锛NDB瀛樺偍寮曟搸灏嗘槧灏勪簡鎵鏈夌墿鐞嗗彉鍖栫殑UNDO鏃ュ織璁板綍鍐欏叆绱㈠紩椤碉紝浠ヤ究鑳藉湪绯荤粺閲嶅惎鏃舵挙閿杩欎簺鍙樺寲銆傚畠杩樿兘璁板綍鍚姩鏈湴妫鏌ョ偣鎿嶄綔鏃跺姣忎釜鍋忕煭鐨勬墍鏈夋彃鍏ユ搷浣溿

璇诲彇鍜屾洿鏂拌兘澶熻缃攣瀹氫綅锛屽苟鏇存柊鍝堝笇绱㈠紩鏉$洰涓殑鏍囬銆傝繖绫诲彉鏇寸敱椤靛啓鍏ョ畻娉曡礋璐e鐞嗭紝浠ョ‘淇濊繖浜涙搷浣滀笉闇瑕UNDO鏃ュ織銆

璇ョ紦鍐茬殑榛樿澶у皬涓2MB銆傛渶灏忓间负1MB锛屽浜庡ぇ澶氭暟搴旂敤锛屾渶灏忓煎凡瓒冲銆傚浜庢墽琛屾瀬澶у拰锛忔垨澶ч噺鎻掑叆鍜屽垹闄ゆ搷浣溿佸苟澶勭悊澶т簨鍔″拰澶т富閿殑搴旂敤绋嬪簭锛屾垨璁告湁蹇呰澧炲ぇ璇ョ紦鍐层傚鏋滆缂撳啿杩囧皬锛NDB瀛樺偍寮曟搸浼氬彂鍑洪敊璇唬鐮677鈥滅储寮UNDO缂撳啿杩囪浇鈥

         [NDBD]UndoDataBuffer

UNDO鏁版嵁缂撳啿鐨勪綔鐢ㄤ笌UNDO绱㈠紩缂撳啿鐨勭浉鍚岋紝涓嶅悓涔嬪鍦ㄤ簬锛屽畠浣滅敤鍦ㄦ暟鎹唴瀛樹笂鑰屼笉鏄储寮曞唴瀛樹笂銆傚浜庢彃鍏ャ佸垹闄ゅ拰鏇存柊锛岃缂撳啿鏄湪鐗囨鐨勬湰鍦版鏌ョ偣闃舵浣跨敤鐨勩

鐢变簬UNDO鏃ュ織鏉$洰浼氶殢鐫鎵璁板綍鎿嶄綔鐨勫鍔犺屽澶э紝璇ョ紦鍐插ぇ浜庝笌涔嬪搴旂殑绱㈠紩鍐呭瓨缂撳啿锛岄粯璁ゅ间负16MB

瀵逛簬鏌愪簺搴旂敤绋嬪簭锛岃鍐呭瓨鍙兘杩囧ぇ銆傚湪杩欑鎯呭喌涓嬶紝鍙檷浣庡畠鐨勫硷紝鏈灏忎负1MB

闇瑕佸鍔犺缂撳啿鐨勬儏鍐靛崄鍒嗙綍瑙併傚鏋滅‘瀹炴湁杩欐柟闈㈢殑瑕佹眰锛岃緝濂界殑鏂瑰紡鏄紝妫鏌ョ鐩樻槸鍚﹁兘瀹為檯澶勭悊鏁版嵁搴撴洿鏂版椿鍔ㄦ墍浜х敓鐨勮礋鑽枫傚鏋滅己灏戣冻澶熺殑纾佺洏绌洪棿锛屽嵆浣垮鍔犺缂撳啿鐨勫ぇ灏忎篃涓嶈兘瑙e喅闂銆

濡傛灉璇ョ紦鍐茶繃灏忓苟鍙樺緱鈥滄嫢鎸や笉鍫濓紝NDB瀛樺偍寮曟搸灏嗗彂鍑洪敊璇唬鐮891鈥滄暟鎹UNDO缂撳啿杩囪浇鈥濄

         [NDBD]RedoBuffer

鎵鏈夌殑鏇存柊娲诲姩涔熼渶瑕佽璁板綍鍒版棩蹇椾腑銆備娇鐢ㄨ繖绫绘棩蹇楋紝褰撶郴缁熼噸鍚椂锛岃兘澶熼噸鐜拌繖绫绘洿鏂般NDB鎭㈠绠楁硶閲囩敤浜嗏滄ā绯娾濇暟鎹鏌ョ偣鍜UNDO鏃ュ織锛岀劧鍚庝娇鐢REDO鏃ュ織鍐嶇幇鎵鏈夊彉鍖栫洿鑷冲埌杈炬仮澶嶇偣銆

璇ョ紦鍐茬殑榛樿澶у皬鏄8MB銆傛渶灏忓间负1MB

濡傛灉璇ョ紦鍐茶繃灏忥紝NDB瀛樺偍寮曟搸灏嗗彂鍑洪敊璇唬鐮1221REDO鏃ュ織缂撳啿杩囪浇

鍦ㄧ鐞嗙皣鐨勮繃绋嬩腑锛屽簲鑳芥帶鍒朵负鍚勭浜嬩欢绫诲瀷鍙戦佽嚦鏍囧噯杈撳嚭瑁呯疆鐨勬棩蹇楁秷鎭殑鏁扮洰锛岃繖鐐瑰崄鍒嗛噸瑕併傛湁16绉嶅彲鑳界殑浜嬩欢绾у埆锛堢紪鍙蜂粠015锛夈傚鏋滃皢缁欏畾浜嬩欢绫诲埆鐨勪簨浠堕氭姤绾у埆璁剧疆涓15锛岄偅涔堣绫诲埆涓殑鎵鏈変簨浠舵姤鍛婂潎浼氳鍙戦佽嚦鏍囧噯杈撳嚭瑁呯疆锛屽鏋滃皢鍏惰缃负0锛岃〃绀哄湪璇ョ被鍒腑鐨勬病鏈変簨浠舵姤鍛娿

榛樿鎯呭喌涓嬶紝浠呬細灏嗗惎鍔ㄦ秷鎭彂閫佽嚦鏍囧噯杈撳嚭瑁呯疆锛屽叾浣欑殑浜嬩欢閫氭姤绾у埆榛樿涓0銆傝繖鏍峰仛鐨勫師鍥犲湪浜庯紝杩欎簺娑堟伅涔熶細琚彂閫佽嚦绠$悊鏈嶅姟鍣ㄧ殑绨囨棩蹇椼

瀵逛簬绠$悊瀹㈡埛绔紝涔熻兘璁剧疆绫讳技鐨勭骇鍒紝鐢ㄤ互纭畾鍦ㄧ皣鏃ュ織涓褰曞摢浜涚骇鍒殑浜嬩欢銆

         [NDBD]LogLevelStartup

閫氭姤绾у埆锛岀敤浜庤繘绋嬪惎鍔ㄨ繃绋嬩腑鐢熸垚鐨勪簨浠躲

榛樿绾у埆涓1.

         [NDBD]LogLevelShutdown

閫氭姤绾у埆锛岀敤浜庝綔涓鸿妭鐐规伆褰撳叧闂繘绋嬬粍鎴愰儴鍒嗚岀敓鎴愮殑浜嬩欢銆

榛樿绾у埆涓0.

         [NDBD]LogLevelStatistic

閫氭姤绾у埆锛岀敤浜庣粺璁′簨浠讹紝濡備富閿硶璇诲彇娆℃暟锛屾洿鏂版暟鐩紝鎻掑叆鏁扮洰锛屼笌缂撳啿浣跨敤鏈夊叧鐨勪俊鎭瓑銆

榛樿绾у埆涓0.

         [NDBD]LogLevelCheckpoint

閫氭姤绾у埆锛岀敤浜庣敱鏈湴鍜屽叏灞妫鏌ョ偣鎿嶄綔鐢熸垚鐨勪簨浠躲

榛樿绾у埆涓0.

         [NDBD]LogLevelNodeRestart

閫氭姤绾у埆锛岀敤浜庡湪鑺傜偣閲嶅惎杩囩▼涓敓鎴愮殑浜嬩欢銆

榛樿绾у埆涓0.

         [NDBD]LogLevelConnection

閫氭姤绾у埆锛岀敤浜庣敱绨囪妭鐐归棿鐨勮繛鎺ョ敓鎴愮殑浜嬩欢銆

榛樿绾у埆涓0.

         [NDBD]LogLevelError

閫氭姤绾у埆锛岀敤浜庣敱鍦ㄦ暣涓皣鍐呯殑閿欒鍜岃鍛婄敓鎴愮殑浜嬩欢銆傝繖绫婚敊璇笉浼氬鑷翠换浣曡妭鐐瑰け璐ワ紝褰撲粛鍊煎緱閫氭姤銆

榛樿绾у埆涓0.

         [NDBD]LogLevelInfo

閫氭姤绾у埆锛岀敤浜庝负绨囩殑涓鑸姸鎬佷俊鎭岀敓鎴愮殑浜嬩欢銆

榛樿绾у埆涓0.

澶囦唤鍙傛暟

鏈妭璁ㄨ鐨勫弬鏁板畾涔変簡涓庡湪绾垮浠芥墽琛屾湁鍏崇殑鍐呭瓨缂撳啿闆嗐

         [NDBD]BackupDataBufferSize

鍦ㄥ垱寤哄浠界殑杩囩▼涓紝涓轰簡灏嗘暟鎹彂閫佸埌纾佺洏锛屽皢浣跨敤涓ょ被缂撳啿銆傚浠芥暟鎹紦鍐茬敤浜庡~鍏呯敱鎵弿鑺傜偣鐨勮〃鑰岃褰曠殑鏁版嵁銆備竴鏃﹀皢璇ョ紦鍐插~鍏呭埌浜嗘寚瀹氱殑姘村钩BackupWriteSize锛堣鍙傝涓嬮潰鐨勪粙缁嶏級锛屽氨浼氬皢椤靛彂閫佽嚦纾佺洏銆傚湪灏嗛〉鍐欏叆纾佺洏鐨勫悓鏃讹紝澶囦唤杩涚▼鑳藉缁х画濉厖璇ョ紦鍐诧紝鐩磋嚦鍏剁┖闂存秷鑰楀畬涓烘銆傚嚭鐜拌鎯呭喌鏃讹紝澶囦唤杩涚▼灏嗘殏鍋滄壂鎻忥紝鐩磋嚦涓浜涚鐩樺啓鍏ユ搷浣滃畬鎴愬苟閲婃斁浜嗗唴瀛樹负姝紝鐒跺悗鎵弿缁х画銆

璇ュ弬鏁扮殑榛樿鍊间负2MB

         [NDBD]BackupLogBufferSize

澶囦唤鏃ュ織缂撳啿鎵紨鐨勮鑹茬被浼间簬澶囦唤鏁版嵁缂撳啿锛屼笉鍚屼箣澶勫湪浜庯紝瀹冪敤浜庣敓鎴愬浠芥墽琛屾湡闂磋繘琛岀殑鎵鏈夎〃鍐欏叆鐨勬棩蹇椼傜浉鍚岀殑鍘熺悊涔熼傜敤浜庡浠芥暟鎹紦鍐叉儏褰笅鐨勯〉鍐欏叆锛屼笉鍚屼箣澶勫湪浜庯紝褰撳浠芥棩蹇楃紦鍐蹭腑娌℃湁澶氫綑绌洪棿鏃讹紝澶囦唤灏嗗け璐ャ傚嚭浜庤鍘熷洜锛屽浠芥棩蹇楃紦鍐茬殑澶у皬搴旇冻浠ュ鐞嗘墽琛屽浠芥椂浜х敓鐨勮礋杞姐

璇ュ弬鏁扮殑榛樿鍊煎浜庡ぇ澶氭暟搴旂敤绋嬪簭鍧囨槸閫傚綋鐨勩備簨瀹炰笂锛屽浠藉け璐ョ殑鍘熷洜鏇村彲鑳芥槸鍥犱负纾佺洏鍐欏叆閫熷害涓嶅锛岃屼笉鏄浠芥棩蹇楃紦鍐插彉婊°傚鏋滄病鏈変负搴旂敤绋嬪簭浜х敓鐨勫啓璐熻浇閰嶇疆纾佺洏瀛愮郴缁燂紝绨囧緢鍙兘鏃犳硶鎵ц鎵闇鐨勬搷浣溿

鏈濂芥寜鎭板綋鐨勬柟寮忛厤缃皣锛屼娇寰楀鐞嗗櫒鎴愪负鐡堕鑰屼笉鏄鐩樻垨缃戠粶杩炴帴銆

榛樿鍊兼槸2MB

         [NDBD]BackupMemory

璇ュ弬鏁版槸BackupDataBufferSizeBackupLogBufferSize涔嬪拰銆

榛樿鍊兼槸2MB + 2MB = 4MB

         [NDBD]BackupWriteSize

璇ュ弬鏁版寚瀹氫簡鐢卞浠芥棩蹇楃紦鍐插拰澶囦唤鏁版嵁缂撳啿鍐欏叆纾佺洏鐨勬秷鎭ぇ灏忋

榛樿鍊兼槸32KB.

17.4.4.6. 瀹氫箟MySQL绨囧唴鐨凷QL鑺傜偣

config.ini鏂囦欢鐨[MYSQLD]閮ㄥ垎涓紝瀹氫箟浜嗙敤浜庤闂皣鏁版嵁鐨MySQL鏈嶅姟鍣紙SQL鑺傜偣锛夌殑琛屼负銆備笉闇瑕佸叾涓墍缁欏嚭鐨勫弬鏁般傚鏋滄湭鎻愪緵璁$畻鏈烘垨涓绘満鍚嶏紝閭d箞浠讳綍涓绘満鍧囪兘浣跨敤璇SQL鑺傜偣銆

         [MYSQLD]Id

璇ュ肩敤浣滆妭鐐圭殑鍦板潃锛屼緵鎵鏈夌殑绨囧唴閮ㄦ秷鎭娇鐢紝瀹冨繀椤绘槸浠嬩簬163涔嬮棿鐨勬暣鏁般傚湪绨囧唴锛屾瘡涓皣鑺傜偣蹇呴』鏈夊敮涓鐨ID

         [MYSQLD]ExecuteOnComputer

瀹冨紩鐢ㄧ殑鏄湪閰嶇疆鏂囦欢鐨[COMPUTER]閮ㄥ垎瀹氫箟鐨勪富鏈猴紙璁$畻鏈猴級涔嬩竴銆

         [MYSQLD]ArbitrationRank

璇ュ弬鏁扮敤浜庡畾涔夊彲浣滀负浠茶绋嬪簭鐨勮妭鐐广MGM鑺傜偣鍜SQL鑺傜偣鍧囪兘鎴愪负浠茶绋嬪簭銆傚鏋滃间负0锛岃〃鏄庣粰瀹氱殑鑺傜偣姘歌繙涓嶄細鐢ㄤ綔浠茶绋嬪簭锛屽鏋滃间负1锛岃〃鏄庣粰瀹氱殑鑺傜偣鍦ㄦ垚涓轰徊瑁佺▼搴忔柟闈㈠叿鏈夐珮鐨勪紭鍏堢骇锛屽鏋滃间负2锛岃〃鏄庣粰瀹氱殑鑺傜偣鍦ㄦ垚涓轰徊瑁佺▼搴忔柟闈㈠叿鏈変綆鐨勪紭鍏堢骇銆傚浜庢甯搁厤缃紝浣跨敤绠$悊鏈嶅姟鍣ㄤ綔涓轰徊瑁佺▼搴忥紝灏嗗畠鐨ArbitrationRank璁剧疆涓1锛堥粯璁わ級锛屽苟灏嗘墍鏈SQL鑺傜偣鐨ArbitrationRank璁剧疆涓0

         [MYSQLD]ArbitrationDelay

濡傛灉灏嗚鍙傛暟璁剧疆涓洪櫎0锛堥粯璁ゅ硷級浠ュ鐨勫叾浠栧硷紝琛ㄧず浠茶绋嬪簭瀵逛徊瑁佽姹傜殑鐩稿簲灏嗚寤惰繜璁惧畾鐨勬绉掓暟銆傞氬父涓嶉渶瑕佹洿鏀硅鍊笺

         [MYSQLD]BatchByteSize

瀵逛簬杞崲涓哄叏琛ㄦ壂鎻忔垨瀵圭储寮曠殑鑼冨洿鎵弿鐨勬煡璇紝瑕佹兂鑾峰緱鏈浣虫ц兘锛岄噸瑕佺殑鏄互鎭板綋鐨勫ぇ灏忚幏鍙栬褰曘傝兘澶熶互璁板綍鏁颁负鍗曚綅锛BatchSize锛夊拰瀛楄妭涓哄崟浣嶏紙BatchByteSize锛夎缃伆褰撶殑澶у皬銆瀹為檯鐨勬壒澶у皬鐢变袱涓弬鏁伴檺瀹氥

鏌ヨ鐨勬墽琛岄熷害鍙兘浼氬嚭鐜40锛呯殑鍙樺寲锛屽叿浣撴儏鍐靛彇鍐充簬璇ュ弬鏁扮殑璁剧疆銆傚湪鏈潵鐨勭増鏈腑锛MySQL鏈嶅姟鍣ㄥ皢鏍规嵁鏌ヨ绫诲瀷鎭板綋鍦拌缃笌鎵瑰ぇ灏忕浉鍏崇殑鍙傛暟銆

璇ュ弬鏁颁互瀛楄妭涓哄崟浣嶏紝榛樿鍊兼槸32KB

         [MYSQLD]BatchSize

璇ュ弬鏁颁互璁板綍鏁颁负鍗曚綅锛岄粯璁ゅ兼槸64銆傛渶澶у间负992

         [MYSQLD]MaxScanBatchSize

鎵瑰ぇ灏忔寚鐨勬槸浠庡悇鏁版嵁鑺傜偣鍙戦佺殑姣忔壒鏁版嵁鐨勫ぇ灏忋傚ぇ澶氭暟鎵弿鍧囨槸浠ュ苟琛屾柟寮忔墽琛岀殑锛岀洰鐨勬槸涓轰簡闃叉MySQL鏈嶅姟鍣ㄦ敹鍒版潵鑷紬澶氳妭鐐圭殑杩囧鏁版嵁锛岃鍙傛暟瀵规墍鏈夎妭鐐逛笂鐨勬荤殑鎵瑰ぇ灏忚繘琛屼簡闄愬埗銆

璇ュ弬鏁扮殑榛樿鍊间负256KB銆傚叾鏈澶уぇ灏忎负16MB

17.4.4.7. MySQL绨嘥CP/IP杩炴帴

MySQL绨囦腑锛TCP/IP鏄敤浜庡缓绔嬭繛鎺ョ殑榛樿浼犺緭鍗忚銆傛甯告儏鍐典笅涓嶉渶瑕佸畾涔夎繛鎺ワ紝杩欐槸鍥犱负锛岀皣鑳借嚜鍔ㄥ缓绔嬫暟鎹妭鐐归棿銆佹暟鎹妭鐐逛笌鎵鏈MySQL鏈嶅姟鍣ㄨ妭鐐广佷互鍙婃暟鎹妭鐐逛笌绠$悊鏈嶅姟鍣ㄤ箣闂寸殑杩炴帴锛堝叧浜庤瑙勫垯鐨勪緥澶栵紝锛岃鍙傝17.4.4.8鑺傦紝鈥滀娇鐢ㄧ洿鎺ヨ繛鎺ョ殑MySQL绨嘥CP/IP杩炴帴鈥)

濡傛灉鎵撶畻瑕嗙洊榛樿鐨勮繛鎺ュ弬鏁帮紝鎵嶉渶瑕佸畾涔夎繛鎺ャ傚湪杩欑鎯呭喌涓嬶紝鑷冲皯闇瑕佸畾涔NodeId1NodeId2銆佷互鍙婃墦绠楁洿鏀圭殑鍙傛暟銆

閫氳繃鍦[TCP DEFAULT]閮ㄥ垎杩涜璁剧疆锛屼篃鑳芥洿鏀硅繖浜涘弬鏁扮殑榛樿鍊笺

         [TCP]NodeId1 , [TCP]NodeId2

瑕佹兂纭畾涓や釜鑺傜偣涔嬮棿鐨勮繛鎺ワ紝闇瑕佸湪閰嶇疆鏂囦欢鐨勶蓟TCP锛介儴鍒嗕腑鎻愪緵姣忎釜鑺傜偣鐨ID

         [TCP]SendBufferMemory

鍦ㄥ悜鎿嶄綔绯荤粺鍙戝嚭璋冪敤璇锋眰涔嬪墠锛TCP浼犺緭鍣ㄩ噰鐢ㄧ紦鍐叉潵淇濆瓨鎵鏈夌殑娑堟伅銆傚綋璇ョ紦鍐茶揪鍒64KB鏃讹紝灏嗗彂閫佸叾鍐呭锛屾墽琛屽畬涓缁勬秷鎭惊鐜悗锛屼篃灏嗗彂閫佽繖浜涘唴瀹广備负浜嗗鐞嗕复鏃惰繃杞芥儏鍐碉紝涔熻兘瀹氫箟涓涓緝澶х殑鍙戦佺紦鍐层傚彂閫佺紦鍐茬殑榛樿鍊兼槸256KB

         [TCP]SendSignalId

涓轰簡鑳藉鍥炴壂鍒嗗竷寮忔秷鎭浘锛岄渶瑕佺‘瀹氭瘡鏉℃秷鎭傚皢璇ュ弬鏁拌缃负鈥Y鈥濇椂锛屽皢閫氳繃缃戠粶浼犺緭娑堟伅ID銆傞粯璁ゆ儏鍐典笅绂佹璇ョ壒鎬с

         [TCP]Checksum

璇ュ弬鏁颁篃鏄竴涓竷灏斿弬鏁帮紙Y/N1/0锛夛紝榛樿鎯呭喌涓嬫槸绂佹鐨勩傚惎鐢ㄤ簡璇ュ弬鏁版椂锛屽湪灏嗘墍鏈夋秷鎭疆浜庡彂閫佺紦鍐蹭箣鍓嶏紝灏嗕负鎵鏈夊弬鏁拌绠楁牎楠屽拰銆備娇鐢ㄨ鐗规э紝褰撴秷鎭瓑鍊欏湪鍙戦佺紦鍐蹭腑鏃讹紝鍙互纭繚娑堟伅涓嶄細鎹熷潖锛屼篃鑳界‘淇濇秷鎭笉浼氳浼犺緭鏈哄埗鐮村潖銆

         [TCP]PortNumber

锛堝凡杩囨椂锛変互鍓嶏紝璇ュ弬鏁版寚瀹氫簡鐢ㄤ簬鐩戝惉鏉ヨ嚜鍏朵粬鑺傜偣鐨勮繛鎺ョ殑绔彛鍙枫備笉搴斿啀浣跨敤鍢庡弬鏁般

         [TCP]ReceiveBufferMemory

鎸囧畾浜嗕粠TCP/IP濂楁帴瀛楁帴鏀舵暟鎹椂鎵浣跨敤鐨勭紦鍐插ぇ灏忋傚嚑涔庝笉闇瑕佹洿鏀硅鍙傛暟鐨勯粯璁ゅ硷紝榛樿鍊间负64KB锛屼絾鏄鏋滄墦绠楄妭鐪佸唴瀛橈紝涔熻兘鏇存敼瀹冦

17.4.4.8.聽浣跨敤鐩存帴杩炴帴鐨凪ySQL绨嘥CP/IP杩炴帴

浣跨敤鏁版嵁鑺傜偣涔嬮棿鐨勭洿鎺ヨ繛鎺ュ缓绔嬬皣鏃讹紝闇瑕佸湪绨config.ini鏂囦欢鐨[TCP]閮ㄥ垎涓鏄庣‘鎸囧畾濡傛杩炴帴鐨勬暟鎹妭鐐圭殑浜ゅ弶IP鍦板潃銆

鍦ㄤ笅闈㈢殑绀轰緥涓紝鍋囧畾绨囧叿鏈夎嚦灏4鍙颁富鏈猴紝1鍙扮敤浜庣鐞嗘湇鍔″櫒锛屼竴鍙扮敤浜SQL鑺傜偣锛屼袱鍙扮敤浜庢暟鎹妭鐐广備綔涓烘暣浣擄紝绨囦綅浜LAN172.23.72.*瀛愮綉鍐呫傞櫎浜嗛氬父鐨勭綉缁滆繛鎺ュ锛屼袱涓暟鎹妭鐐逛娇鐢ㄦ爣鍑嗙殑浜ゅ弶鐢电紗鐩存帴鐩歌繛锛屽苟浣跨敤鑼冨洿鍦1.1.0.*IP鍦板潃褰兼闂寸洿鎺ラ氫俊锛屽涓嬫墍绀猴細

# Management Server
[NDB_MGMD]
Id=1
HostName=172.23.72.20
 
# SQL Node
[MYSQLD]
Id=2
HostName=172.23.72.21
 
# Data Nodes
[NDBD]
Id=3
HostName=172.23.72.22
 
[NDBD]
Id=4
HostName=172.23.72.23
 
# TCP/IP Connections
[TCP]
NodeId1=3
NodeId2=4
HostName1=1.1.0.1
HostName2=1.1.0.2

浣跨敤鏁版嵁鑺傜偣闂寸殑鐩存帴杩炴帴鑳藉鏀瑰杽绨囩殑鏁翠綋鏁堢巼锛屼娇鐢ㄨ鏂瑰紡锛屾暟鎹妭鐐硅兘缁曡繃浠ュお缃戣澶囷紝濡備氦鎹㈠櫒銆Hub銆佽矾鐢卞櫒绛夛紝浠庤屽噺灏戜簡绨囩殑绛夊緟鏃堕棿銆傛敞鎰忥紝瀵逛簬涓や釜浠ヤ笂鐨勬暟鎹妭鐐癸紝瑕佹兂鍏呭垎鍒╃敤杩欑被鐩存帴杩炴帴鐨勪紭鐐癸紝闇瑕佷负鍚勬暟鎹妭鐐瑰缓绔嬩笌鐩稿悓鑺傜偣缁勫唴鐨勫叾浠栨暟鎹妭鐐归棿鐨勭洿鎺ヨ繛鎺ャ

17.4.4.9. MySQL绨囧叡浜唴瀛樿繛鎺

MySQL绨囧皢灏濊瘯浣跨敤鍏变韩鍐呭瓨浼犺緭鍣紝骞跺湪鍙兘鐨勬儏鍐典笅鑷姩閰嶇疆瀹冿紝灏ゅ叾鏄湪鐩稿悓鐨勭皣涓绘満涓婂悓鏃惰繍琛岀潃1涓互涓婄殑鑺傜偣鏃躲傚湪MySQL绨囩殑鏃╂湡鐗堟湰涓紝浠呭綋浣跨敤--with-ndb-shm鍒涘缓浜-max浜岃繘鍒剁増鏈椂锛屾墠鏀寔鍏变韩鍐呭瓨娈点傛槑纭湴灏嗗叡浜唴瀛樺畾涔変负杩炴帴鏂规硶鏃讹紝鑷冲皯闇瑕佸畾涔NodeId1NodeId2ShmKey銆傚浜庢墍鏈夊叾浠栧弬鏁帮紝搴斿叿鏈夊湪澶у鏁版儏鍐典笅鍧囪壇濂藉伐浣滅殑榛樿鍊笺

娉ㄩ噴锛SHM鏀寔浠嶅簲琚涓鸿瘯楠屾х殑銆

         [SHM]NodeId1, [SHM]NodeId2

瑕佹兂纭畾涓や釜鑺傜偣涔嬮棿鐨勮繛鎺ワ紝闇瑕佷负姣忎釜鑺傜偣鎻愪緵鑺傜偣IDNodeId1NodeId2

         [SHM]ShmKey

璁剧疆鍏变韩鍐呭瓨娈垫椂锛岃妭鐐ID鐢ㄤ簬鍞竴鍦扮‘瀹氶氫俊鎵鐢ㄧ殑鍏变韩鍐呭瓨娈点傚畠浠ユ暣鏁拌〃绀猴紝娌℃湁榛樿鍊笺

         [SHM]ShmSize

姣忎釜SHM杩炴帴鍧囨湁涓涓叡浜唴瀛樻锛屽彂閫佹柟灏嗚妭鐐逛箣闂寸殑娑堟伅缃簬璇ュ锛岃鍙栨柟浠庤澶勮鍙栬繖绫绘秷鎭gai 鍏变韩鍐呭瓨娈电殑澶у皬鐢ShmSize瀹氫箟銆傞粯璁ゅ兼槸1MB

         [SHM]SendSignalId

涓轰簡鍥炴壂鍒嗗竷寮忔秷鎭殑璺緞锛岄渶瑕佷负姣忔潯娑堟伅鎻愪緵鍞竴鎬ID銆傚鏋滃皢璇ュ弬鏁拌缃负鈥Y鈥濓紝涔熻兘鍦ㄧ綉缁滀笂浼犺緭杩欑被娑堟伅ID榛樿鎯呭喌涓嬶紝璇ョ壒鎬ф槸绂佹鐨勩

         [SHM]Checksum

璇ュ弬鏁颁篃鏄竴绉Y/N鍙傛暟锛岄粯璁ゆ儏鍐典笅澶勪簬绂佹鐘舵併傚鏋滃厑璁歌鍙傛暟锛屽湪灏嗘墍鏈夋秷鎭疆浜庡彂閫佺紦鍐蹭箣鍓嶏紝瀵逛负鎵鏈夋秷鎭绠楁牎楠屽拰銆

浣跨敤璇ョ壒鎬э紝褰撴秷鎭瓑鍊欏湪鍙戦佺紦鍐蹭腑鏃讹紝鑳介槻姝㈡秷鎭崯鍧忋傛澶栵紝瀹冭繕鑳界敤浜庡湪浼犺緭杩囩▼涓鏌ユ崯鍧忕殑鏁版嵁銆

17.4.4.10. MySQL绨嘢CI浼犺緭杩炴帴

浠呭綋浣跨敤--with-ndb-sci=/your/path/to/SCI鍒涘缓浜MySQL-Max浜岃繘鍒剁増鏈椂锛屽湪MySQL绨囦腑鎵嶆敮鎸佷娇鐢SCI浼犺緭鍣ㄦ潵杩炴帴鑺傜偣銆path搴旀寚鍚戝寘鍚渶浣庡簱鐨勭洰褰曪紝骞跺簲鍖呮嫭鍚SISCI搴撳拰澶存枃浠剁殑鐩綍銆

姝ゅ锛SCI瑕佹眰涓撶敤纭欢銆

寮虹儓寤鸿锛屼粎搴斾负ndbd杩涚▼涔嬮棿鐨勯氫俊浣跨敤SVI浼犺緭鍣ㄣ傛敞鎰忥紝浣跨敤SCI浼犺緭鍣ㄦ剰鍛崇潃ndbd杩涚▼姘镐笉鍋滄銆傚洜姝わ紝浠呭簲鍦ㄥ叿鏈夎嚦灏戜袱鍧椾笓渚ndbd杩涚▼浣跨敤鐨CPU鐨勬満鍣ㄤ笂浣跨敤SCI浼犺緭鍣ㄣ傛瘡涓ndbd杩涚▼鑷冲皯搴旀湁1CPU锛岃嚦灏戣繕搴旀湁1CPU鐢ㄤ簬澶勭悊鎿嶄綔绯荤粺鐨勬椿鍔ㄣ

         [SCI]NodeId1, [SCI]NodeId2

涓轰簡纭畾涓や釜鑺傜偣涔嬮棿鐨勮繛鎺ワ紝闇瑕佷负姣忎釜鑺傜偣鎻愪緵鑺傜偣IDNodeId1NodeId2

         [SCI]Host1SciId0

瀹冪敤浜庣‘瀹氱1涓皣鑺傜偣涓婄殑SCI鑺傜偣ID锛堢敱NodeId1纭畾锛夈

         [SCI]Host1SciId1

鑳藉涓轰袱鍧SCI鍗¢棿鐨勬晠闅滃垏鎹㈣缃SCI浼犺緭鍣紝杩欎袱鍧楀崱搴斾娇鐢ㄨ妭鐐逛箣闂寸殑涓嶅悓缃戠粶銆傚畠鐢ㄤ簬纭畾鑺傜偣ID锛屼互鍙婂湪绗1涓妭鐐逛笂浣跨敤鐨勭2SCI鍗°

         [SCI]Host2SciId0

瀹冪敤浜庣‘瀹氱2涓皣鑺傜偣涓婄殑SCI鑺傜偣ID锛堢敱NodeId2纭畾锛夈

         [SCI]Host2SciId1

浣跨敤涓ゅ潡SCI鍗℃潵鎻愪緵鏁呴殰鍒囨崲鍔熻兘鏃讹紝璇ュ弬鏁扮敤浜庣‘瀹氬皢鍦ㄧ2涓妭鐐逛笂浣跨敤鐨勭2SCI鍗°

         [SCI]SharedBufferSize

姣忎釜SCI浼犺緭鍣ㄥ潎鏈1涓敤浜庝袱鑺傜偣闂撮氫俊鐨勫叡浜唴瀛樻銆傚彲灏嗚鍏变韩鍐呭瓨娈佃缃负榛樿鐨1 MB锛岃繖瓒充互搴斿澶у鏁板簲鐢ㄧ▼搴忋傚鏋滀娇鐢ㄨ緝灏忕殑鍊硷紝褰撴墽琛屽ぇ閲忓苟琛屾彃鍏ユ搷浣滄椂锛屼細鍑虹幇闂锛屽鍏变韩缂撳啿杩囧皬锛岃繕浼氬鑷ndbd杩涚▼宕╂簝銆

         [SCI]SendLimit

SCI濯掍粙鍓嶉潰鐨勫皬缂撳啿鐢ㄤ簬淇濆瓨娑堟伅锛屽湪閫氳繃SCI缃戠粶浼犺緭杩欑被娑堟伅鍓嶏紝浼氬皢瀹冧滑淇濆瓨鍦ㄨ缂撳啿鍐呫傚畠鐨勯粯璁ゅ间负8kB銆傛寜鐓ф垜浠殑鍩哄噯锛屽湪64KB鏃舵ц兘鏈濂斤紝浣16kB浠呮湁灏戦噺鎻愬崌锛屽嵆浣垮ぇ浜8KB鏈夊ソ澶勶紝濂藉涔熶笉澶с

         [SCI]SendSignalId

涓轰簡璺熻釜鍒嗗竷寮忔秷鎭紝闇瑕佸敮涓鍦扮‘瀹氭瘡鏉℃秷鎭傚皢璇ュ弬鏁拌缃负鈥Y鈥濇椂锛屽氨鑳藉湪缃戠粶涓婁紶杈撴秷鎭ID銆傞粯璁ゆ儏鍐典笅绂佹璇ョ壒鎬с

         [SCI]Checksum

T璇ュ弬鏁颁篃鏄竴绉嶅竷灏斿硷紝榛樿鎯呭喌涓嬶紝璇ュ弬鏁版槸琚姝㈢殑銆傚惎鐢ㄤ簡Checksum锛堟牎楠屽拰锛夋椂锛鍦ㄥ皢鎵鏈夋秷鎭疆浜庡彂閫佺紦鍐蹭箣鍓嶏紝灏嗕负鎵鏈夊弬鏁拌绠楁牎楠屽拰銆備娇鐢ㄨ鐗规э紝褰撴秷鎭瓑鍊欏湪鍙戦佺紦鍐蹭腑鏃讹紝鍙互纭繚娑堟伅涓嶄細鎹熷潖銆傛澶栵紝瀹冭繕鑳界敤浜庡湪浼犺緭杩囩▼涓鏌ユ崯鍧忕殑鏁版嵁銆

17.5. MySQL绨囦腑鐨勮繘绋嬬鐞

瑕佹兂鎺屾彙绠$悊MySQL绨囩殑鏂规硶锛岄渶瑕佷簡瑙4绉嶅熀鏈繘绋嬨傚湪鏈珷涓嬮潰鐨勫嚑鑺傚唴锛屼粙缁嶄簡杩欎簺杩涚▼鍦ㄧ皣鍐呯殑浣滅敤锛屽畠浠殑浣跨敤鏂规硶锛屼互鍙婃瘡绉嶈繘绋嬪彲鐢ㄧ殑鍚姩閫夐」銆

17.5.1. 鐢ㄤ簬MySQL绨囩殑MySQL鏈嶅姟鍣ㄨ繘绋嬩娇鐢

mysqld鏄紶缁熺殑MySQL鏈嶅姟鍣ㄨ繘绋嬨傝鎯充笌MySQL绨囦竴璧蜂娇鐢紝鎵鍒涘缓鐨mysqld搴旀敮鎸NDB绨囧瓨鍌ㄥ紩鎿庯紝灏卞儚鍦ㄩ缂栬瘧鐨-max浜岃繘鍒剁増鏈腑閭f牱锛http://dev.mysql.com/downloads/

鍗充娇閲囩敤璇ユ柟寮忓垱寤轰簡mysqld浜岃繘鍒剁増鏈紝鍦ㄩ粯璁ゆ儏鍐典笅锛NDB绨囧瓨鍌ㄥ紩鎿庝粛澶勪簬绂佹鐘舵併傝鎯冲惎鐢NDB绨囧瓨鍌ㄥ紩鎿庯紝鍙娇鐢ㄤ袱绉嶅彲鑳界殑閫夐」涔嬩竴锛

         鍚姩mysqld鏃讹紝灏嗏溾ndbcluster鈥濈敤浣滃惎鍔ㄩ夐」銆

         my.cnf鏂囦欢鐨[mysqld]閮ㄥ垎鎻掑叆鍖呭惈ndbcluster1琛屽唴瀹广

楠岃瘉杩愯鐨勬湇鍔″櫒鏄惁鍚敤浜NDB绨囧瓨鍌ㄥ紩鎿庣殑绠鍗曟柟娉曟槸锛屽湪MySQL鐩戣鍣紙mysql锛変腑鍙戝嚭鍛戒护SHOW ENGINES銆傚湪鍒楀嚭NDBCLUSTER鐨勮涓簲鑳界湅鍒板YES锛屽鏋滃湪璇ヨ涓婄湅鍒NO锛堟垨鍦ㄨ緭鍑轰腑鏈樉绀鸿琛岋級锛屼綘鎵杩愯鐨勬槸鏈惎鐢NDB鍔熻兘鐨MySQl鐗堟湰銆傚鏋滃湪璇ヨ涓婄湅鍒DISABLED锛屽氨闇閲囩敤涓婅堪涓ょ鏂规硶涔嬩竴鍚敤瀹冦

涓轰簡璇诲彇绨囬厤缃暟鎹紝MySQL鏈嶅姟鍣ㄨ嚦灏戦渶瑕3绉嶄俊鎭細

         MySQL鏈嶅姟鍣ㄨ嚜宸辩殑绨囪妭鐐ID

         绠$悊鏈嶅姟鍣紙MGM鑺傜偣锛夌殑涓绘満鍚嶆垨IP鍦板潃銆

         涓庣鐞嗘湇鍔″櫒鐩歌繛鐨勭鍙c

鑺傜偣ID鍙姩鎬佸垎閰嶏紝鍥犳涓嶄竴瀹氶渶瑕佹槑纭寚瀹氬畠浠

mysqld鍙傛暟ndb-connectstring鐢ㄤ簬鎸囧畾杩炴帴瀛楃涓诧紝鎴栨槸鍦ㄥ惎鍔mysqld鏃跺湪鍛戒护琛屼笂鎸囧畾锛屾垨鏄湪my.cnf鏂囦欢涓寚瀹氥傝繛鎺ュ瓧绗︿覆鍖呭惈涓绘満鍚嶆垨IP鍦板潃锛浠ュ強鑳藉鍙戠幇绠$悊鏈嶅姟鍣ㄧ殑绔彛銆

鍦ㄤ笅闈㈢殑绀轰緥涓紝ndb_mgmd.mysql.com鏄鐞嗘湇鍔″櫒鎵鍦ㄧ殑涓绘満锛岀鐞嗘湇鍔″櫒鍦ㄧ鍙1186涓婄洃鍚皣娑堟伅銆

shell> mysqld --ndb-connectstring=ndb_mgmd.mysql.com:1186

鍏充簬杩炴帴瀛楃涓茬殑鏇村淇℃伅锛岃鍙傝17.4.4.2鑺傦紝鈥淢ySQL绨囪繛鎺ュ瓧绗︿覆

缁欏畾璇ヤ俊鎭紝MySQL鏈嶅姟鍣ㄥ皢鎴愪负绨囦腑鐨勫畬鍏ㄥ弬涓庤呫傦紙鏈夋椂锛屾垜浠篃灏嗚繍琛屽湪璇ユ柟寮忎笅鐨mysqld杩涚▼绉颁负SQL鑺傜偣锛夈傚畠鑳藉畬鍏ㄤ簡瑙f墍鏈夌殑绨囨暟鎹妭鐐逛互鍙婂畠浠殑鐘舵侊紝骞惰兘寤虹珛涓庢墍鏈夋暟鎹妭鐐圭殑杩炴帴銆傚湪杩欑鎯呭舰涓嬶紝瀹冭兘灏嗕换浣曟暟鎹妭鐐圭敤浣滀簨鍔″崗璋冨櫒锛屽苟鑳借闂暟鎹妭鐐逛互鎵ц璇诲彇鍜屾洿鏂版搷浣溿

17.5.2.聽ndbd锛屽瓨鍌ㄥ紩鎿庤妭鐐硅繘绋

ndbd鏄娇鐢NDB绨囧瓨鍌ㄥ紩鎿庡鐞嗚〃涓墍鏈夋暟鎹殑杩涚▼銆傞氳繃璇ヨ繘绋嬶紝瀛樺偍鑺傜偣鑳藉瀹炵幇鍒嗗竷寮忎簨鍔″鐞嗭紝鑺傜偣鎭㈠锛屽纾佺洏鐨勬鏌ョ偣鎿嶄綔锛屽湪绾垮浠斤紝浠ュ強鐩稿叧鐨勪换鍔°

MySQL绨囦腑锛屼竴缁ndbd杩涚▼鑳藉鍏卞悓澶勭悊鏁版嵁銆傝繖浜涜繘绋嬪彲浠ュ湪鐩稿悓鐨勮绠楁満锛堜富鏈猴級涓婃墽琛岋紝涔熻兘鍦ㄤ笉鍚岀殑璁$畻鏈轰笂鎵ц銆傛暟鎹妭鐐瑰拰绨囦富鏈轰箣闂寸殑閫氫俊鏄畬鍏ㄥ彲閰嶇疆鐨勩

Ndbd灏嗙敓鎴愪竴缁勬棩蹇楁枃浠讹紝杩欎簺鏂囦欢浣嶄簬鐢遍厤缃枃浠朵腑DataDir鎸囧畾鐨勭洰褰曚笅銆備笅闈㈠垪鍑轰簡杩欎簺鏃ュ織鏂囦欢銆傛敞鎰忥紝node_id浠h〃鑺傜偣鐨勫敮涓ID銆備緥濡傦紝ndb_2_error.log鏄敱鑺傜偣ID2鐨勫瓨鍌ㄨ妭鐐圭敓鎴愮殑閿欒鏃ュ織銆

         ndb_node_id_error.log鏄寘鍚墍寮曠敤ndbd杩涚▼鎵閬囧埌鐨勬墍鏈夊穿婧冭褰曠殑鏂囦欢銆傝鏂囦欢涓殑姣忔潯璁板綍鍧囧寘鍚1涓畝瑕佺殑閿欒瀛楃涓诧紝浠ュ強瀵硅宕╂簝璺熻釜鏂囦欢鐨勫紩鐢ㄣ傝鏂囦欢鐨勫吀鍨嬫潯鐩笌涓嬮潰缁欏嚭鐨勭被浼硷細

                Date/Time: Saturday 30 July 2004 - 00:20:01
                Type of error: error
                Message: Internal program error (failed ndbrequire)
                Fault ID: 2341
                Problem data: DbtupFixAlloc.cpp
                Object of reference: DBTUP (Line: 173)
                ProgramName: NDB Kernel
                ProcessID: 14909
                TraceFile: ndb_2_trace.log.2
                ***EOM***

娉ㄩ噴锛璇疯浣忥紝閿欒鏃ュ織鏂囦欢涓殑鏈鍚1涓潯鐩苟涓嶅繀鐒舵槸鏈鏂扮殑锛堜篃涓嶅お鍙兘锛夛紝杩欑偣寰堥噸瑕閿欒鏃ュ織涓殑鏉$洰涓嶆槸鎸夋椂闂撮『搴忔帓鍒楃殑锛岃屾槸涓ndb_node_id_trace.log.next锛堣鍙傝涓嬮潰鐨勪粙缁嶏級涓畾涔夌殑璺熻釜鏂囦欢鐨勯『搴忓搴斻傚洜姝わ紝閿欒鏃ュ織鏉$洰鏄寜寰幆鏂瑰紡鑰屼笉鏄『搴忔柟寮忚鐩栫殑銆

         ndb_node_id_trace.log.trace_id鏄噯纭弿杩颁簡閿欒鍑虹幇涔嬫椂鎵鍙戠敓鎯呭喌鐨勮窡韪枃浠躲傝淇℃伅鍦MySQL绨囧紑鍙戝洟闃熻繘琛屽垎鏋愭椂寰堟湁甯姪銆

鑳藉瀵硅鐩栨棫鏂囦欢涔嬪墠鍒涘缓鐨勮窡韪枃浠剁殑鏁扮洰杩涜閰嶇疆銆trace_id鏄负姣忎釜杩炵画鐨勮窡韪枃浠跺鍔犵殑缂栧彿銆

         ndb_node_id_trace.log.next鏄褰曚簡瑕佹寚瀹氱殑涓嬩竴涓窡韪枃浠剁紪鍙风殑鏂囦欢銆

         ndb_node_id_out.log鏄寘鍚ndbd杩涚▼鐨勪换浣曟暟鎹緭鍑虹殑鏂囦欢銆備粎褰撳皢ndbd鍚姩涓虹鍙g洃鐫g▼搴忔椂鎵嶄細鍒涘缓璇ユ枃浠躲

         ndb_node_id.pid鏄寘鍚惎鍔ㄦ椂浣滀负绔彛鐩戠潱绋嬪簭鐨ndbd杩涚▼鐨勮繘绋ID鐨勬枃浠躲傚畠杩樿兘璧峰埌閿佸畾鏂囦欢鐨勪綔鐢紝浠ラ槻姝㈠惎鍔ㄥ叿鏈夌浉鍚ID鐨勮妭鐐广

         ndb_node_id_signal.log鏄粎鍦ndbd璋冭瘯鐗堜笅浣跨敤鐨勬枃浠讹紝瀹冭兘璺熻釜ndbd杩涚▼涓墍鏈夌殑鍏ョ珯銆佸嚭绔欏拰鍐呴儴娑堟伅銆備互鍙婂畠浠殑鏁版嵁銆

寤鸿涓嶈浣跨敤閫氳繃NFS瀹夎鐨勭洰褰曪紝杩欐槸鍥犱负鍦ㄦ煇浜涙儏鍐典笅锛屽鏋pid-file涓婄殑閿佸畾渚濇棫鏈夋晥锛屽嵆浣垮綋杩涚▼涓鍚庝篃浼氫骇鐢熼棶棰樸

鍚姩ndbd鏃讹紝鎴栬闇瑕佹寚瀹氱鐞嗘湇鍔″櫒鐨勪富鏈哄悕浠ュ強鐩戝惉鐨勭鍙e彿銆備綔涓哄彲閫夋柟寮忥紝涔熷彲浠ユ寚瀹氳繘绋嬪皢浣跨敤鐨勮妭鐐ID

shell> ndbd --connect-string="nodeid=2;host=ndb_mgmd.mysql.com:1186"

鍏充簬杩欐柟闈㈢殑棰濆淇℃伅锛岃鍙傝17.4.4.2鑺傦紝鈥淢ySQL绨囪繛鎺ュ瓧绗︿覆

鍚姩ndbd鏃讹紝瀹冨疄闄呬笂灏嗗惎鍔ㄤ袱绉嶈繘绋嬨傜1绉嶈繘绋嬬О涓衡angel process鈥濓紙澶╀娇杩涚▼锛夛紝瀹冪殑鍞竴浠诲姟鏄彂鐜版墽琛岃繘绋嬪湪浣曟椂瀹屾垚锛岀劧鍚庨噸鍚ndbd杩涚▼锛堝鏋滀綔浜嗚閰嶇疆鐨勮瘽锛夈傚洜姝わ紝濡傛灉浣犳墦绠椾娇鐢Unixkill鍛戒护鏉姝ndbd杩涚▼锛屽氨闇瑕佹潃姝昏繖涓や釜杩涚▼銆備腑姝ndbd杩涚▼鐨勬洿鎭板綋鏂规硶鏄娇鐢ㄧ鐞嗗鎴风锛屽苟閫氳繃璇ョ鐞嗗鎴风鍋滄杩涚▼銆

鎵ц杩涚▼閲囩敤浜1涓嚎绋嬶紝鐢ㄤ簬璇诲彇銆佸啓鍏ュ拰鎵弿鏁版嵁锛屼互鍙婃墍鏈夊叾浠栦换鍔°傝绾跨▼鏄紓姝ュ疄鏂界殑锛屼互渚胯兘鏂逛究鍦板鐞嗘暟浠ュ崈璁$殑骞跺彂娲诲姩銆傛澶栵紝鐪嬮棬鐙楃嚎绋嬭礋璐g洃鐫f墽琛岀嚎绋嬶紝浠ョ‘淇濇墽琛岀嚎绋嬩笉浼氶櫡鍏ユ棤闄愬惊鐜傜嚎绋嬫睜璐熻矗澶勭悊鏂囦欢I/O锛屾瘡涓嚎绋嬪潎鑳藉鐞嗕竴涓墦寮鐨勬枃浠躲傝繖浜涚嚎绋嬩篃鑳借ndbd杩涚▼涓殑浼犺緭鍣ㄧ敤浣滀紶杈撳櫒杩炴帴銆傚湪鎵ц鍖呭惈鏇存柊鍦ㄥ唴鐨勫ぇ閲忔搷浣滅殑绯荤粺涓紝濡傛灉鍏佽锛ndbd杩涚▼鑳藉崰鐢2CPU銆傚浜庢嫢鏈夊CPU鐨勬満鍣紝寤鸿浣跨敤灞炰簬涓嶅悓鑺傜偣缁勭殑鏁颁釜ndbd杩涚▼銆

17.5.3.聽ndb_mgmd锛屸滅鐞嗘湇鍔″櫒鈥濊繘绋

绠$悊鏈嶅姟鍣ㄦ槸杩欐牱涓绉嶈繘绋嬶紝瀹冭鍙栫皣閰嶇疆鏂囦欢锛屽苟灏嗚淇℃伅鍒嗛厤缁欑皣涓墍鏈夎姹傝淇℃伅鐨勮妭鐐广傚畠杩樿礋璐g淮鎶ょ皣娲诲姩鐨勬棩蹇椼傜鐞嗗鎴风鑳藉杩炴帴鍒扮鐞嗘湇鍔″櫒锛屽苟妫鏌ョ皣鐨勭姸鎬併

鍚姩绠$悊鏈嶅姟鍣ㄦ椂锛屼笉鏄竴瀹氶渶瑕佹寚瀹氳繛鎺ュ瓧绗︿覆銆備絾鏄紝濡傛灉浣跨敤浜1涓互涓婄殑绠$悊鏈嶅姟鍣紝搴旀彁渚涜繛鎺ュ瓧绗︿覆锛岃屼笖绨囦腑鐨勬瘡涓妭鐐瑰簲鏄庣‘鎸囧畾鑷繁鐨勮妭鐐ID

涓嬭堪鏂囦欢鏄敱ndb_mgmd鍦ㄥ叾鍚姩鐩綍涓嬪垱寤烘垨浣跨敤鐨勶紝骞朵細琚疆浜庨厤缃枃浠朵腑鎸囧畾鐨DataDir涓傚湪涓嬮潰鐨勫垪琛ㄤ腑锛node_id鏄敮涓鎬ц妭鐐ID

         config.ini鏄綔涓烘暣浣撶殑绨囩殑閰嶇疆鏂囦欢銆傝鏂囦欢鐢辩敤鎴峰垱寤哄苟鐢辩鐞嗘湇鍔″櫒璇诲彇銆傚湪17.4鑺傦紝鈥淢ySQL绨囩殑閰嶇疆鈥涓紝璁ㄨ浜嗚缃鏂囦欢鐨勬柟娉曘

         ndb_node_id_cluster.log鏄皣浜嬩欢鏃ュ織鏂囦欢銆傝繖绫讳簨浠剁殑渚嬪瓙鍖呮嫭锛氭鏌ョ偣鎿嶄綔鐨勫惎鍔ㄥ拰瀹屾垚锛岃妭鐐瑰惎鍔ㄤ簨浠讹紝鑺傜偣鏁呴殰锛屼互鍙婂唴瀛樹娇鐢ㄦ按骞炽傚叧浜庣皣浜嬩欢鐨勫畬鏁村垪琛ㄥ拰鎻忚堪锛岃鍙傝17.6鑺傦紝鈥淢ySQL绨囩殑绠$悊鈥

褰撶皣鏃ュ織鐨勫ぇ灏忚揪鍒1MB鏃讹紝鏂囦欢灏嗚閲嶅懡鍚嶄负ndb_node_id_cluster.log.seq_id锛屽叾涓seq_id鏄皣鏃ュ織鏂囦欢鐨勫簭鍒楀彿锛堜緥濡傦紝濡傛灉缂栧彿123宸插瓨鍦紝涓嬩竴涓棩蹇楁枃浠跺皢鐢4鍛藉悕锛夈

         ndb_node_id_out.log鏄皢绠$悊鏈嶅姟鍣ㄧ敤浣滅鍙g洃鐫g▼搴忔椂鐢ㄤ簬stdoutstderr鐨勬枃浠躲

         ndb_node_id.pid鏄皢绠$悊鏈嶅姟鍣ㄧ敤浣滅鍙g洃鐫g▼搴忔椂鎵浣跨敤鐨PID鏂囦欢銆

17.5.4.聽ndb_mgm锛屸滅鐞嗗鎴风鈥濊繘绋

瀵逛簬绨囩殑杩愯锛屽疄闄呬笂涓嶉渶瑕佺鐞嗗鎴风鐨勮繘绋嬨傚叾浠峰煎湪浜庡畠鎻愪緵浜嗕竴缁勫懡浠わ紝杩欑粍鍛戒护鍙敤浜庢鏌ョ皣鐨勭姸鎬併佸惎鍔ㄥ浠姐佸苟鎵ц鍏朵粬绠$悊鍔熻兘銆傜鐞嗗鎴风浣跨敤C API鏉ヨ闂鐞嗘湇鍔″櫒锛岄珮绾х敤鎴蜂篃鑳戒娇鐢C API鏉ョ紪鍒朵笓鐢ㄧ殑绠$悊杩涚▼鏉ユ墽琛屼换鍔★紝杩欑被浠诲姟涓ndb_mgm鎵ц鐨勭被浼笺

鍚姩绠$悊瀹㈡埛绔椂锛岄渶瑕佹彁渚涚鐞嗘湇鍔″櫒鐨勪富鏈哄悕鍜岀鍙e彿锛屽涓嬩緥鎵绀恒傞粯璁ゅ兼槸localhost1186

shell> ndb_mgm localhost 1186

鍏充簬浣跨敤ndb_mgm鐨勬洿澶氫俊鎭紝璇峰弬瑙17.5.5.4鑺傦紝鈥渘db_mgm鐨勫懡浠ら夐」17.6.2鑺傦紝鈥滅鐞嗗鎴风鈥濅腑鐨勫懡浠

17.5.5. 鐢ㄤ簬MySQL绨囪繘绋嬬殑鍛戒护閫夐」

鎵鏈MySQL绨囩殑鍙墽琛屾枃浠讹紙闄mysqld锛夊潎浣跨敤涓嬭堪閫夐」銆傛棭鏈MySQL绨囩増鏈殑鐢ㄦ埛搴旀敞鎰忥紝杩欎簺閫夐」寮鍏充腑鐨勪竴浜涗笌MySQL 4.1绨囦腑鐨勭浉姣旀湁鎵鏀瑰彉锛屼负鐨勬槸淇濇寔瀹冧滑涔嬮棿鐨勪竴鑷存э紝浠ュ強涓mysqld鐨勪竴鑷存с傚彲浠ヤ娇鐢-?寮鍏虫潵鏌ョ湅鏀寔鐨勯夐」鍒楄〃銆

         -?, --usage, --help

缁欏嚭绠鏄庢竻鍗曪紝浠ュ強鍙敤鍛戒护閫夐」鐨勬弿杩般

         -V, --version

缁欏嚭ndbd杩涚▼鐨勭増鏈彿銆傝鐗堟湰鍙锋槸MySQL绨囩殑鐗堟湰鍙枫傜増鏈彿鏈変竴瀹氱殑浣滅敤锛岃繖鏄洜涓哄苟闈炴墍鏈夌殑鐗堟湰鍧囪兘涓璧蜂娇鐢紝鑰屼笖鍦ㄥ惎鍔ㄦ椂锛MySQL绨囪繘绋嬪皢楠岃瘉浜岃繘鍒舵枃浠剁殑鐗堟湰鏄惁鑳藉湪鍚屼竴绨囧唴鍏卞瓨銆傛墽琛MySQL绨囩殑鍦ㄧ嚎鍗囩骇鏃讹紝瀹冧篃寰堥噸瑕侊紙璇峰弬瑙MySQL绨囩殑杞欢鍗囩骇锛夈

         -c connect_string, --connect-string

connect_string浣滀负鍛戒护閫夐」锛岀敤浜庤缃笌绠$悊鏈嶅姟鍣ㄧ殑杩炴帴瀛楃涓层

shell> ndbd --connect-string="nodeid=2;host=ndb_mgmd.mysql.com:1186"

         --debug[=options]

璇ラ夐」浠呰兘鐢ㄤ簬鍏锋湁璋冭瘯鍔熻兘鐨勭増鏈備娇鐢ㄥ畠锛岃兘澶熶互涓mysqld杩涚▼鐩稿悓鐨勬柟寮忓厑璁告潵鑷皟璇曡皟鐢ㄧ殑杈撳嚭銆

         -e, --execute

浣跨敤瀹冿紝鑳藉浠庣郴缁shell灏嗗懡浠ゅ彂閫佽嚦绨囨墽琛岀▼搴忥紝濡傦細

shell> ndb_mgm -e show

shell> ndb_mgm --execute="SHOW"

绛夋晥浜

NDB> SHOW;

瀹冪被浼间簬鈥-e鈥閫夐」涓mysql鍛戒护琛屽鎴风涓璧峰伐浣滅殑鏂瑰紡銆傝鍙傝4.3.1鑺傦紝鈥滃湪鍛戒护琛屼笂浣跨敤閫夐」鈥

 

17.5.5.1. 鐢ㄤ簬mysqld鐨勪笌MySQL鏈夊叧鐨勫懡浠ら夐」

         --ndbcluster

濡傛灉浜岃繘鍒剁増鏈寘鍚NDB绨囧瓨鍌ㄥ紩鎿庣殑鏀寔锛屽彲浣跨敤璇ラ夐」瑕嗙洊瀵NDB绨囧瓨鍌ㄥ紩鎿庯紙绠绉颁负NDB瀛樺偍寮曟搸锛夌殑榛樿绂佹璁剧疆銆備娇鐢MySQL绨囨椂锛NDB绨囧瓨鍌ㄥ紩鎿庢槸蹇呰鐨勩

         --skip-ndbcluster

绂佹NDB绨囧瓨鍌ㄥ紩鎿庛傚浜庡寘鍚鍔熻兘鐨勪簩杩涘埗鐗堟湰锛屽湪榛樿鎯呭喌涓嬶紝璇ュ姛鑳芥槸琚姝㈢殑锛屾崲鍙ヨ瘽璁诧紝NDB绨囧瓨鍌ㄥ紩鎿庡浜庣姝㈢姸鎬侊紝鐩磋嚦浣跨敤鈥溾攏dbcluster鈥閫夐」婵娲讳簡瀹冧负姝€備粎褰撴墍缂栬瘧鐨勬湇鍔″櫒鏀寔NDB绨囧瓨鍌ㄥ紩鎿庢椂锛屾墠鑳戒娇鐢ㄨ閫夐」銆

         --ndb-connectstring=connect_string

浣跨敤NDB瀛樺偍寮曟搸鏃讹紝閫氳繃璁剧疆璇ラ夐」锛岃兘澶熸寚瀹氬垎閰嶇皣閰嶇疆鏁版嵁鐨勭鐞嗘湇鍔″櫒銆

17.5.5.2. ndbd鍛戒护閫夐」

鍏充簬鏌愪簺甯歌閫夐」鐨勬洿澶氫俊鎭紝璇峰弬瑙17.5.5鑺傦紝鈥滅敤浜嶮ySQL绨囪繘绋嬬殑鍛戒护閫夐」鈥

         -d, --daemon

閫氱煡ndbd浣滀负daemon锛堢鍙g洃鐫g▼搴忥級杩涚▼鎵ц锛堥粯璁よ涓猴級銆

         --nodaemon

鎸囨槑ndbd涓嶅緱浣滀负daemon锛堢鍙g洃鐫g▼搴忥級杩涚▼鍚姩銆傝皟璇ndbd浠ュ強甯屾湜灏嗚緭鍑洪噸瀹氬悜鍒板睆骞曟椂锛屽畠寰堟湁鐢ㄣ

         --initial

閫氱煡ndbd鎵ц鍒濆鍖栧惎鍔ㄣ傚垵濮嬪寲鍚姩灏嗗垹闄や互鍓ndbd瀹炰緥涓烘仮澶嶇洰鐨勫垱寤虹殑浠讳綍鏂囦欢銆傚畠杩樿兘閲嶆柊鍒涘缓鎭㈠鐢ㄦ棩蹇楁枃浠躲傛敞鎰忥紝鍦ㄦ煇浜涙搷浣滅郴缁熶笂锛岃杩涚▼鍙兘浼氬崰鐢ㄨ緝闀跨殑鏃堕棿銆

浠呭湪棣栨鍚姩ndbd杩涚▼鏃舵墠搴斾娇鐢鈥攊nitial鍚姩锛岃繖鏄洜涓哄畠灏嗗垹闄ょ皣鏂囦欢绯荤粺鐨勬墍鏈夋枃浠讹紝骞跺啀娆″垱寤烘墍鏈夌殑REDO鏃ュ織鏂囦欢銆璇ヨ鍒欑殑渚嬪濡備笅锛

o        鎵ц閭d簺浼氭洿鏀规枃浠跺唴瀹圭殑杞欢鍗囩骇鏃躲

o        鐢ㄦ柊鐨ndbd鐗堟湰閲嶅惎鑺傜偣鏃躲

o        鍑轰簬鏌愮鍘熷洜锛岃妭鐐归噸鍚垨绯荤粺閲嶅惎涓嶆柇澶辫触鏃剁殑鏈鍚庢墜娈点傚湪杩欑被鎯呭舰涓嬶紝璇锋敞鎰忥紝鐢变簬鏁版嵁鏂囦欢鐨勬崯鍧忥紝涓嶈兘浣跨敤璇ヨ妭鐐规潵鎭㈠鏁版嵁銆

璇ラ夐」涓嶅奖鍝嶉偅浜涘凡琚彈褰卞搷鑺傜偣鍒涘缓鐨勫浠芥枃浠躲

         --nostart

鎸囩ずndbd涓嶈嚜鍔ㄥ惎鍔ㄣ備娇鐢ㄨ閫夐」鏃讹紝ndbd杩炴帴鍒扮鐞嗘湇鍔″櫒锛屼粠绠$悊鏈嶅姟鍣ㄨ幏鍙栭厤缃暟鎹紝骞跺垵濮嬪寲閫氫俊瀵硅薄銆備絾鏄紝鍦ㄧ鐞嗘湇鍔″櫒鐗瑰埆瑕佹眰涔嬪墠锛屽畠涓嶄細瀹為檯鍚姩鎵ц寮曟搸銆傞氳繃鍚戠鐞嗗鎴风鍙戝嚭鎭板綋鐨勫懡浠わ紝鍙畬鎴愯浠诲姟銆

17.5.5.3. ndb_mgmd鐨勫懡浠ら

鍏充簬鏌愪簺甯歌閫夐」鐨勬洿澶氫俊鎭紝璇峰弬瑙17.5.5鑺傦紝鈥滅敤浜嶮ySQL绨囪繘绋嬬殑鍛戒护閫夐」鈥

         -f filename, --config-file=filename, (OBSOLETE): -c filename

閫氱煡绠$悊鏈嶅姟鍣ㄥ簲浣跨敤鍝釜鏂囦欢浣滀负鍏堕厤缃枃浠躲傚繀椤绘寚瀹氳閫夐」銆傛枃浠跺悕榛樿涓config.ini銆傛敞鎰忥紝-c鈥蹇嵎鏂瑰紡宸茶繃鏃讹紝涓嶅簲鍦ㄦ柊鐨勫畨瑁呭疄渚嬩腑浣跨敤瀹冦

         -d, --daemon

鎸囩ずndb_mgmd浣滀负绔彛鐩戠潱绋嬪簭鍚姩銆傝繖鏄粯璁よ涓恒

         --nodaemon

鎸囩ず绠$悊鏈嶅姟鍣ㄤ笉浣滀负绔彛鐩戠潱绋嬪簭鍚姩銆

17.5.5.4. ndb_mgm鐨勫懡浠ら夐」

鍏充簬鏌愪簺甯歌閫夐」鐨勬洿澶氫俊鎭紝璇峰弬瑙17.5.5鑺傦紝鈥滅敤浜嶮ySQL绨囪繘绋嬬殑鍛戒护閫夐」鈥

         [host_name [port_num]]

瑕佹兂鍚姩绠$悊瀹㈡埛绔紝闇瑕佹寚瀹氱鐞嗘湇鍔″櫒鎵鍦ㄧ殑浣嶇疆锛屽嵆鎸囧畾涓绘満鍚嶅拰绔彛銆傞粯璁ょ殑涓绘満鍚嶆槸localhost锛岄粯璁ょ鍙f槸1186

         --try-reconnect=number

濡傛灉涓庣鐞嗘湇鍔″櫒鐨勮繛鎺ユ柇寮锛屾瘡闅5绉掞紝鑺傜偣灏嗗皾璇曞啀娆¤繛鎺ュ埌绠$悊鏈嶅姟鍣紝鐩磋嚦鎴愬姛銆備娇鐢ㄨ閫夐」锛岃兘澶熷皢灏濊瘯鐨勫瓧鏁伴檺鍒跺湪number鎸囧畾鐨勫硷紝瓒呰繃璇ラ檺鍒跺悗锛屽皢鏀惧純灏濊瘯骞堕氭姤閿欒銆

17.6. MySQL绨囩殑绠$悊

绠$悊MySQL绨囨秹鍙婁紬澶氫换鍔★紝棣栧厛鏄厤缃拰鍚姩MySQL绨囥傝鎯呰鍙傝17.4鑺傦紝鈥淢ySQL绨囩殑閰嶇疆鈥17.5鑺傦紝鈥淢ySQL绨囦腑鐨勮繘绋嬬鐞嗏

涓嬮潰浠嬬粛浜MySQL绨囩殑绠$悊浜嬪疁銆

鏈変袱绉嶇Н鏋佺鐞MySQL绨囩殑鍩烘湰鏂规硶銆傜1绉嶆柟娉曟槸锛屼娇鐢ㄥ湪绠$悊瀹㈡埛绔腑杈撳叆鐨勫懡浠わ紝鍊熸鍙鏌ョ皣鐨勭姸鎬侊紝鏇存敼鏃ュ織绾у埆锛屽惎鍔ㄥ拰鍋滄澶囦唤锛屼互鍙婂惎鍔ㄥ拰鍋滄鑺傜偣銆傚浜庣2绉嶆柟娉曪紝闇瑕佺爺绌剁鐞嗘湇鍔″櫒DataDir鐩綍涓嬬皣鏃ュ織鏂囦欢ndb_node_id_cluster.log鐨勫唴瀹广傦紙node_id浠h〃鍏舵椿鍔ㄥ凡琚褰曠殑鑺傜偣鐨勫敮涓ID锛夈傜皣鏃ュ織鍖呭惈鐢ndbd鐢熸垚鐨勪簨浠舵姤鍛娿備篃鑳藉皢绨囨棩蹇楁潯鐩彂閫佸埌Unix鐨勭郴缁熸棩蹇椾腑銆

17.6.1.聽MySQL绨囩殑鍚姩闃舵

鏈妭浠嬬粛浜嗗惎鍔ㄧ皣鏃舵秹鍙婄殑姝ラ銆

鏈夋暟绉嶄笉鍚岀殑鍚姩绫诲瀷鍜屾ā寮忥紝濡備笅鎵杩帮細

         棣栨鍚姩锛鍦ㄦ墍鏈夎妭鐐逛笂涓庡共鍑鐨勬枃浠剁郴缁熶竴璧峰惎鍔ㄧ皣銆傝繖鎴栨槸鍑虹幇鍦ㄩ娆″惎鍔ㄧ皣鏃讹紝鎴栨槸浣跨敤鈥--initial鈥濋夐」閲嶅惎绨囨椂銆

         绯荤粺閲嶅惎锛绨囧惎鍔ㄥ苟璇诲彇淇濆瓨鍦ㄦ暟鎹妭鐐逛腑鐨勬暟鎹傝繖鍑虹幇鍦ㄤ笅杩版儏鍐典笅锛氫娇鐢ㄥ畬鍚庡叧闂簡绨囷紝骞跺笇鏈涗粠绨囩殑鍋滄鐐规仮澶嶇皣鎿嶄綔鏃躲

         鑺傜偣閲嶅惎锛杩欐槸鍦ㄧ皣杩愯鐨勫悓鏃剁皣鑺傜偣鐨勫湪绾块噸鍚

         棣栨鑺傜偣閲嶅惎锛涓庤妭鐐归噸鍚被浼硷紝宸埆鍦ㄤ簬灏嗗啀娆″垵濮嬪寲鑺傜偣锛屽苟涓庡共鍑鐨勬枃浠剁郴缁熶竴璧峰惎鍔ㄣ

鍚姩涔嬪墠锛屽繀椤诲姣忎釜鑺傜偣杩涜鍒濆鍖栨搷浣滐紙ndbd杩涚▼锛夈傝繖鍖呮嫭涓嬭堪姝ラ锛

1.    鑾峰彇鑺傜偣ID

2.    鑾峰彇閰嶇疆鏁版嵁銆

3.    涓鸿妭鐐归棿鐨勯氫俊鍒嗛厤绔彛銆

4.    鏍规嵁浠庨厤缃枃浠惰幏寰楃殑璁剧疆鍒嗛厤鍐呭瓨銆

涓鏃﹀畬鎴愪簡瀵瑰悇鑺傜偣鐨勫垵濮嬪寲鎿嶄綔锛屽皢杩涘叆绨囧惎鍔ㄨ繘绋嬨傚湪璇ヨ繘绋嬩腑锛岀皣灏嗙粡鍘嗕笅杩伴樁娈碉細

         闃舵0

娓呯悊绨囨枃浠剁郴缁熴備粎褰撲娇鐢ㄢ--initial鈥濋夐」鍚姩绨囨椂锛屾墠浼氬嚭鐜般

         闃舵1

寤虹珛绨囪繛鎺ワ紝寤虹珛鑺傜偣闂寸殑閫氫俊銆傚惎鍔ㄧ皣鈥滃績璺斥濇満鍒躲

         闃舵2

閫変妇浠茶绋嬪簭鑺傜偣銆

濡傛灉杩欐槸绯荤粺閲嶅惎闃舵锛岀皣灏嗙‘瀹氭渶杩戠殑鍙仮澶嶅叏灞妫鏌ョ偣銆

         闃舵3

璇ラ樁娈靛寘鎷紬澶氬唴閮ㄧ皣鍙橀噺鐨勫垵濮嬪寲銆

         闃舵4

瀵逛簬鍒濆鍚姩鎴栧垵濮嬭妭鐐归噸鍚紝灏嗗垱寤redo鏃ュ織鏂囦欢銆傝繖绫绘枃浠剁殑鏁扮洰绛変簬NoOfFragmentLogFiles

瀵逛簬绯荤粺閲嶅惎锛

o        璇诲彇鏂规銆

o        浠庢湰鍦版鏌ョ偣鍜undo鏃ュ織璇诲彇鏁版嵁銆

o        搴旂敤鎵鏈夌殑redo淇℃伅锛岀洿鑷冲埌杈炬渶杩戠殑鍙仮澶嶆鏌ョ偣涓烘銆

瀵逛簬鑺傜偣閲嶅惎锛屾壘鍒redo鏃ュ織鐨勬湯灏俱

         闃舵5

濡傛灉杩欐槸棣栨鍚姩锛屽皢鍒涘缓SYSTAB_0NDB$EVENTS鍐呴儴绯荤粺琛ㄣ

瀵逛簬鑺傜偣閲嶅惎鎴栭娆¤妭鐐归噸鍚細

o        鑺傜偣鍖呭惈鍦ㄤ簨鍔″鐞嗘搷浣滀腑銆

o        灏嗚妭鐐圭殑鏂规涓庝富鏈嶅姟鍣ㄧ殑鏂规杩涜姣旇緝锛屽苟涓庡叾鍚屾銆

o        瀵规墍鏀跺埌鐨勩佹潵鑷湰鑺傜偣鎵鍦ㄨ妭鐐圭粍鍐呭叾浠栬妭鐐圭殑銆INSERT褰㈠紡鐨勬暟鎹繘琛屽悓姝ャ

o        鍦ㄤ换浣曟儏褰笅锛岀瓑寰呯敱浠茶绋嬪簭鍒ゅ畾鐨勬湰鍦版鏌ョ偣鎿嶄綔鐨勫畬鎴愩

         闃舵6

鏇存柊鍐呴儴鍙橀噺銆

         闃舵7

鏇存柊鍐呴儴鍙橀噺銆

         闃舵8

鍦ㄧ郴缁熼噸鍚腑锛岄噸寤烘墍鏈夌殑绱㈠紩銆

         闃舵9

鏇存柊鍐呴儴鍙橀噺銆

         闃舵10

鍦ㄨ妭鐐归噸鍚垨棣栨鑺傜偣閲嶅惎鐨勮繖涓闃舵锛API鍙兘浼氳繛鎺ュ埌鑺傜偣锛屽苟鎺ユ敹浜嬩欢銆

         闃舵11

鍦ㄨ妭鐐归噸鍚垨棣栨鑺傜偣閲嶅惎鐨勮繖涓闃舵锛屽皢浜嬩欢浼犻掍换鍔℃彁浜ょ粰鍔犲叆绨囩殑鑺傜偣銆傛柊鍔犲叆鐨勮妭鐐硅礋璐e皢鍏朵富瑕佹暟鎹紶閫掔粰璁㈡柟銆

瀵逛簬棣栨鍚姩鎴栫郴缁熼噸鍚紝涓鏃﹁杩涚▼瀹屾垚锛屽皢鍚敤浜嬪姟澶勭悊鍔熻兘銆傚浜庤妭鐐归噸鍚垨棣栨鑺傜偣閲嶅惎锛屽惎鍔ㄨ繘绋嬬殑瀹屾垚鎰忓懗鐫鑺傜偣鐜板湪鑳藉鎴愪负浜嬪姟鍗忚皟绋嬪簭銆

17.6.2. 鈥滅鐞嗗鎴风鈥濅腑鐨勫懡浠

闄や簡涓ぎ閰嶇疆鏂囦欢澶栵紝杩樿兘閫氳繃绠$悊瀹㈡埛绔ndb_mgm鎻愪緵鐨勫懡浠よ鐣岄潰瀵圭皣杩涜鎺у埗銆傝繖鏄繍琛岀皣鐨勪富瑕佺鐞嗙晫闈€

绠$悊瀹㈡埛绔彁渚涗簡涓嬭堪鍩烘湰鍛戒护銆傚湪涓嬮潰缁欏嚭鐨勬竻鍗曚腑锛node_id鎸囩殑鏄暟鎹簱鑺傜偣ID鎴栧叧閿瓧ALL锛屾寚鏄庡懡浠ゅ皢搴旂敤鍒版墍鏈夌殑绨囨暟鎹妭鐐逛笂銆

         HELP

鏄剧ず鍏充簬鎵鏈夊彲鑳藉懡浠ょ殑淇℃伅銆

         SHOW

鏄剧ず鍏充簬绨囩姸鎬佺殑淇℃伅銆

娉ㄩ噴锛鍦ㄤ娇鐢ㄥ涓鐞嗚妭鐐圭殑绨囦腑锛岃鍛戒护浠呮樉绀轰笌褰撳墠绠$悊鏈嶅姟鍣ㄥ疄闄呯浉杩炵殑鏁版嵁鑺傜偣鐨勪俊鎭

         node_id START

鍚姩鐢node_id鏍囪瘑鐨勬暟鎹妭鐐癸紙鎴栨墍鏈夋暟鎹妭鐐癸級銆

         node_id STOP

鍋滄鐢node_id鏍囪瘑鐨勬暟鎹妭鐐癸紙鎴栨墍鏈夋暟鎹妭鐐癸級銆

         node_id RESTART [-N] [-I]

閲嶅惎鐢node_id鏍囪瘑鐨勬暟鎹妭鐐癸紙鎴栨墍鏈夋暟鎹妭鐐癸級銆

         node_id STATUS

鏄剧ず鐢node_id鏍囪瘑鐨勬暟鎹妭鐐癸紙鎴栨墍鏈夋暟鎹妭鐐癸級鐨勭姸鎬佷俊鎭

         ENTER SINGLE USER MODE node_id

杩涘叆鍗曠敤鎴锋ā寮忥紝浠呭厑璁哥敱鑺傜偣IDnode_id鈥濇爣璇嗙殑MySQL鏈嶅姟鍣ㄨ闂暟鎹簱銆

         EXIT SINGLE USER MODE

閫鍑哄崟鐢ㄦ埛妯″紡锛屽厑璁告墍鏈夌殑SQL鑺傜偣锛堝嵆鎵鏈夎繍琛岀殑mysqld杩涚▼锛夎闂暟鎹簱銆

         QUIT

涓绠$悊瀹㈡埛绔

         SHUTDOWN

鍏抽棴闄SQL鑺傜偣涔嬪鐨勬墍鏈夌皣鑺傜偣锛屽苟閫鍑恒

鍦ㄤ笅涓鑺備腑锛屼粙缁嶄簡鐢ㄤ簬浜嬩欢鏃ュ織鐨勫懡浠ゃ傚湪杩欎簺璁鐨勫崟鐙竴鑺備腑锛屼粙缁嶄簡鐢ㄤ簬鍒涘缓澶囦唤浠ュ強浠庡浠戒腑鎭㈠鐨勫懡浠ゃ

17.6.3. MySQL绨囦腑鐢熸垚鐨勪簨浠舵姤鍛

鍦ㄦ湰鑺備腑锛屾垜浠璁轰簡MySQL绨囨彁渚涚殑浜嬩欢鏃ュ織鐨勭被鍨嬶紝浠ュ強璁板綍鐨勪簨浠剁被鍨嬨

MySQL绨囨彁渚涗簡涓ょ浜嬩欢鏃ュ織銆傚畠浠槸cluster lognode logscluster log锛堢皣鏃ュ織锛夊寘鎷敱鎵鏈夌皣鑺傜偣鐢熸垚鐨勪簨浠讹紝node logs锛堣妭鐐规棩蹇楋級浠呰褰曟瘡涓暟鎹妭鐐圭殑鏈湴浜嬩欢銆

鐢辩皣浜嬩欢鏃ュ織鍔熻兘鐢熸垚鐨勮緭鍑哄彲浠ユ湁澶氫釜鐩殑鍦帮紝鍖呮嫭鏂囦欢銆佺鐞嗘湇鍔″櫒鎺у埗鍙扮獥鍙c佹垨syslog銆傜敱鑺傜偣浜嬩欢鏃ュ織鍔熻兘鐢熸垚鐨勮緭鍑哄皢琚啓鍏ユ暟鎹妭鐐圭殑鎺у埗鍙扮獥鍙c

鍙互瀵硅繖涓ょ被浜嬩欢鏃ュ織杩涜璁剧疆锛屼娇涔嬭褰曚笉鍚岀殑浜嬩欢瀛愰泦銆

娉ㄩ噴锛绨囨棩蹇楁槸涓哄ぇ澶氭暟浣跨敤鍦哄悎鎺ㄨ崘鐨勬棩蹇楋紝杩欐槸鍥犱负瀹冨湪1涓枃浠朵腑鎻愪緵浜嗗叧浜庢暣涓皣鐨勬棩蹇椾俊鎭傝妭鐐规棩蹇椾粎搴斿湪搴旂敤绋嬪簭鐨勫紑鍙戣繃绋嬩腑浣跨敤锛屾垨鐢ㄤ簬璋冭瘯搴旂敤绋嬪簭浠g爜銆

鍙牴鎹笁绉嶄笉鍚岀殑鍒ゆ嵁璇嗗埆姣忎釜鍊煎緱閫氭姤鐨勪簨浠讹細

         Category锛堢被鍒級锛氬彲浠ユ槸涓嬭堪鍊间箣涓锛STARTUP, SHUTDOWN, STATISTICS, CHECKPOINT, NODERESTART, CONNECTION, ERROR,INFO

         Priority锛堜紭鍏堢骇锛夛細鐢变粠115鐨勬暟瀛楄〃绀猴紝鈥1鈥濊〃绀衡滄渶閲嶈鈥濓紝鈥15鈥濊〃绀衡滄渶涓嶉噸瑕佲濄

         Severity Level锛堜弗閲嶇骇鍒級锛氬彲浠ユ槸涓嬭堪鍊间箣涓锛ALERT, CRITICAL, ERROR, WARNING, INFO, DEBUG

鏃犺鏄皣鏃ュ織杩樻槸鑺傜偣鏃ュ織锛岄兘鑳芥牴鎹繖浜涘睘鎬ц繘琛岃繃婊ゃ

17.6.3.1. 鐧昏绠$悊鍛戒护

涓嬭堪绠$悊鍛戒护涓庣皣鏃ュ織鏈夊叧锛

         CLUSTERLOG ON

鎵撳紑绨囨棩蹇椼

         CLUSTERLOG OFF

鍏抽棴绨囨棩蹇椼

         CLUSTERLOG INFO

鍏充簬绨囨棩蹇楄缃殑淇℃伅銆

         node_id CLUSTERLOG category=threshold

鐢ㄥ皬浜庢垨绛変簬threshold鐨勪紭鍏堢骇灏category浜嬩欢璁板綍鍒扮皣鏃ュ織銆

         CLUSTERLOG FILTER severity_level

灏嗙皣浜嬩欢鏃ュ織鍒囨崲涓烘寚瀹氱殑severity_level

鍦ㄤ笅琛ㄤ腑锛屼粙缁嶄簡绨囨棩蹇楃被鍒槇鍊肩殑榛樿璁剧疆锛堝浜庢墍鏈夋暟鎹妭鐐癸級銆傚鏋滀簨浠剁殑浼樺厛绾у间綆浜庢垨绛変簬浼樺厛绾ч槇鍊硷紝灏变細鍦ㄧ皣鏃ュ織涓褰曘

娉ㄦ剰锛屼簨浠舵槸鎸夋暟鎹妭鐐归氭姤鐨勶紝鍙湪涓嶅悓鐨勮妭鐐逛笂璁剧疆涓嶅悓鐨勯槇鍊笺

绫诲埆

榛樿闃堝硷紙鎵鏈夋暟鎹妭鐐癸級

STARTUP

7

SHUTDOWN

7

STATISTICS

7

CHECKPOINT

7

NODERESTART

7

CONNECTION

7

ERROR

15

INFO

7

闃堝肩敤浜庤繃婊ゆ瘡绉嶇被鍒腑鐨勪簨浠躲備緥濡傦紝瀵逛簬浼樺厛绾т负3STARTUP浜嬩欢锛涓嶄細灏嗗叾璁板綍鍒版棩蹇椾腑锛岄櫎闈炲皢STARTUP鐨勯槇鍊兼洿鏀逛负3鎴栨洿灏忋傚鏋滈槇鍊间负3锛屼粎鍙戦佷紭鍏堢骇绛変簬鎴栧皬浜3鐨勪簨浠躲

涓嬮潰缁欏嚭浜嗕簨浠剁殑涓ラ噸绾у埆锛堟敞閲婏細瀹冧滑涓Unixsyslog绾у埆瀵瑰簲锛涗絾LOG_EMERGLOG_NOTICE闄ゅ锛屾湭浣跨敤鎴栨湭鏄犲皠瀹冧滑锛夛細

1

ALERT

搴旂珛鍒绘洿姝g殑鐘跺喌锛屽鎹熷潖鐨勭郴缁熸暟鎹簱銆

2

CRITICAL

涓寸晫鐘跺喌锛屽璁惧閿欒鎴栬祫婧愪笉瓒炽

3

ERROR

搴斾簣浠ユ洿姝g殑鐘跺喌锛屽閰嶇疆閿欒绛夈

4

WARNING

涓嶈兘绉板叾涓洪敊璇殑鐘跺喌锛屼絾浠嶉渶瑕佺壒鍒鐞嗐

5

INFO

閫氭姤鎬ф秷鎭

6

DEBUG

璋冭瘯娑堟伅锛岀敤浜NDB绨囧紑鍙戙

鍙互鎵撳紑鎴栧叧闂簨浠朵弗閲嶇骇鍒傚鏋滄墦寮浜嗕簨浠朵弗閲嶇骇鍒紝閭d箞浼樺厛绾х瓑浜庢垨浣庝簬绫诲埆闃堝肩殑浜嬩欢鍧囧皢琚褰曘傚鏋滃叧闂簡浜嬩欢涓ラ噸绾у埆锛岄偅涔堝皢涓嶈褰曞睘浜庤涓ラ噸绾у埆鐨勪换浣曚簨浠躲

17.6.3.2. 鏃ュ織浜嬩欢

浜嬩欢鏃ュ織涓褰曠殑浜嬩欢鎶ュ憡閲囩敤涓嬭堪鏍煎紡锛datetime [string] severitymessage銆備緥濡傦細

09:19:30 2005-07-24 [NDB] INFO -- Node 4 Start phase 4 completed

鏈妭璁ㄨ浜嗘墍鏈夊煎緱閫氭姤鐨勪簨浠讹紝鎸夌被鍒互鍙婃瘡涓绫诲埆涓殑涓ラ噸绾у埆鎺掑簭銆

CONNECTION浜嬩欢

杩欑被浜嬩欢涓庣皣鑺傜偣涔嬮棿鐨勮繛鎺ユ湁鍏炽

浜嬩欢

浼樺厛绾

涓ラ噸绾у埆

鎻忚堪

DB鑺傜偣宸茶繛鎺

8

INFO

鏁版嵁鑺傜偣宸茶繛鎺

DB鑺傜偣鏂紑杩炴帴

8

INFO

鏁版嵁鑺傜偣鏂紑杩炴帴

閫氫俊鍏抽棴

8

INFO

SQL鑺傜偣鎴栨暟鎹妭鐐圭殑杩炴帴宸插叧闂

閫氫俊鎵撳紑

8

INFO

SQL鑺傜偣鎴栨暟鎹妭鐐圭殑杩炴帴宸叉墦寮

CHECKPOINT浜嬩欢

涓嬮潰缁欏嚭鐨勬棩蹇楁秷鎭笌妫鏌ョ偣鏈夊叧銆

锛堟敞閲婏細GCP =鍏ㄥ眬妫鏌ョ偣锛LCP =鏈湴妫鏌ョ偣锛夈

浜嬩欢

浼樺厛绾

涓ラ噸绾у埆

鎻忚堪

calc keep GCI涓紝LCP宸插仠姝

0

ALERT

LCP宸插仠姝

鏈湴妫鏌ョ偣鐗囨瀹屾垚

11

INFO

鐗囨涓婄殑LCP宸插畬鎴

鍏ㄥ眬妫鏌ョ偣瀹屾垚

10

INFO

GCP瀹屾垚

鍏ㄥ眬妫鏌ョ偣鍚姩

9

INFO

鍚姩GCP锛氬皢REDO鏃ュ織鍐欏叆纾佺洏

鏈湴妫鏌ョ偣瀹屾垚

8

INFO

LCP宸叉甯稿畬鎴

鏈湴妫鏌ョ偣鍚姩

7

INFO

鍚姩LCP锛氬皢鏁版嵁鍐欏叆纾佺洏

鎶ュ憡undo鏃ュ織宸插皝闂

7

INFO

UNDO鏃ュ織宸插皝闂細缂撳啿蹇婧㈠嚭

STARTUP浜嬩欢

涓嬭堪浜嬩欢鏄湪鎴愬姛鎴栧け璐ョ殑鑺傜偣鍚姩鎴栫皣鍚姩鏃剁敓鎴愮殑銆傚畠浠繕鎻愪緵浜嗕笌鍚姩杩涚▼杩涘睍鐘跺喌鏈夊叧鐨勪俊鎭紝鍖呮嫭涓庢棩蹇楁椿鍔ㄦ湁鍏崇殑淇℃伅銆

浜嬩欢

浼樺厛绾

涓ラ噸绾у埆

鎻忚堪

鏀跺埌鍐呴儴鍚姩淇″彿STTORRY

15

INFO

閲嶅惎瀹屾垚鍚庢敹鍒扮殑淇℃伅鍧

Undo璁板綍宸叉墽琛

15

INFO

 

鏂扮殑REDO鏃ュ織宸插惎鍔

10

INFO

GCI淇濇寔X锛屾渶鏂扮殑鍙仮澶GCI Y

鏂版棩蹇楀凡鍚姩

10

INFO

鏃ュ織閮ㄥ垎X锛屽惎鍔MB Y锛屽仠姝MB Z

鎷掔粷灏嗚妭鐐圭撼鍏ョ皣涓

8

INFO

鐢变簬閰嶇疆閿欒銆佹棤娉曞缓绔嬮氫俊銆佹垨鍏朵粬闂锛屼笉鑳藉皢鑺傜偣鍖呭惈鍦ㄧ皣涓

DB鑺傜偣閭诲眳

8

INFO

鏄剧ず闄勮繎鐨勬暟鎹妭鐐广

DB鑺傜偣鍚姩闃舵X瀹屾垚

4

INFO

鏁版嵁鑺傜偣鍚姩闃舵宸插畬鎴愩

鑺傜偣宸茶绨囨垚鍔熸帴绾

3

INFO

鏄剧ず鑺傜偣锛岀鐞嗚妭鐐癸紝浠ュ強鍔ㄦID

DB鑺傜偣鍚姩闃舵宸插紑濮

1

INFO

NDB绨囪妭鐐规鍦ㄥ惎鍔ㄣ

DB鑺傜偣鐨勬墍鏈夊惎鍔ㄩ樁娈靛凡瀹屾垚

1

INFO

NDB绨囪妭鐐瑰凡鍚姩銆

DB鑺傜偣鍏抽棴鎿嶄綔宸插惎鍔

1

INFO

鏁版嵁鑺傜偣鐨勫叧闂搷浣滃凡寮濮

DB鑺傜偣鍏抽棴鎿嶄綔澶辫触

1

INFO

鏃犳硶姝e父鍏抽棴鏁版嵁鑺傜偣銆

NODERESTART浜嬩欢

涓嬭堪浜嬩欢鏄湪閲嶅惎鑺傜偣鏃朵骇鐢熺殑锛屽苟涓庤妭鐐归噸鍚繘绋嬬殑鎴愬姛鎴栧け璐ョ浉鍏炽

浜嬩欢

浼樺厛绾

涓ラ噸绾у埆

鎻忚堪

鑺傜偣澶辫触闃舵瀹屾垚

8

ALERT

閫氭姤鑺傜偣澶辫触闃舵鐨勫畬鎴

鑺傜偣澶辫触锛岃妭鐐圭姸鎬佷负X

8

ALERT

閫氭姤鑺傜偣宸插け璐

閫氭姤浠茶绋嬪簭缁撴灉

2

ALERT

瀵逛簬浠茶灏濊瘯锛屾湁8绉嶄笉鍚岀殑鍙兘缁撴灉锛

         浠茶妫鏌ュけ璐ワ紝鍓╀綑鑺傜偣灏戜簬1/2

         浠茶妫鏌ユ垚鍔燂紝鑺傜偣缁勫鏁

         浠茶妫鏌ュけ璐ワ紝涓㈠け鑺傜偣缁

         缃戠粶鍒嗗尯锛岃姹備徊瑁

         浠茶鎴愬姛锛屾潵鑷妭鐐X鐨勬闈㈠洖搴

         浠茶澶辫触锛屾潵鑷妭鐐X鐨勮礋闈㈠洖搴

         缃戠粶鍒嗗尯锛屾棤鍙敤鐨勪徊瑁佺▼搴

         缃戠粶鍒嗗尯锛屾湭閰嶇疆浠茶绋嬪簭

瀹屾垚浜嗙墖娈靛鍒

10

INFO

 

瀹屾垚浜嗙洰褰曚俊鎭鍒

8

INFO

 

瀹屾垚浜嗗垎閰嶄俊鎭鍒

8

INFO

 

寮濮嬪鍒剁墖娈

8

INFO

 

瀹屾垚浜嗘墍鏈夌墖娈电殑澶嶅埗

8

INFO

 

GCP鎺ユ敹宸插惎鍔

7

INFO

 

GCP鎺ユ敹宸插畬鎴

7

INFO

 

LCP鎺ユ敹宸插惎鍔

7

INFO

 

LCP鎺ユ敹宸插畬鎴愶紙鐘舵= X

7

INFO

 

閫氭姤鏄惁鍙戠幇浜嗕徊瑁佺▼搴

6

INFO

鎼滅储浠茶绋嬪簭鏃讹紝鏈7绉嶅彲鑳界殑缁撴灉锛

         绠$悊鏈嶅姟鍣ㄩ噸鍚徊瑁佺嚎绋[state=X]

         鍑嗗浠茶绋嬪簭鑺傜偣X [ticket=Y]

         鎺ユ敹浠茶绋嬪簭鑺傜偣X [ticket=Y]

         鍚姩浠茶绋嬪簭鑺傜偣X [ticket=Y]

         涓㈠け浜嗕徊瑁佺▼搴忚妭鐐X 鈥 杩涚▼澶辫触 [state=Y]

         涓㈠け浜嗕徊瑁佺▼搴忚妭鐐X 鈥 杩涚▼閫鍑 [state=Y]

         涓㈠け浜嗕徊瑁佺▼搴忚妭鐐X <error msg> [state=Y]

STATISTICS浜嬩欢

涓嬭堪浜嬩欢鍏锋湁缁熻鐗规с傚畠浠彁渚涗簡鐩稿簲鐨勪俊鎭紝濡備簨鍔″拰鍏朵粬鎿嶄綔鐨勬暟鐩紝浣庢祿搴﹁妭鐐瑰彂閫佹垨鎺ユ敹鐨勬暟鎹噺锛屼互鍙婂唴瀛樹娇鐢ㄧ巼绛夈

浜嬩欢

浼樺厛绾

涓ラ噸绾у埆

鎻忚堪

閫氭姤浣滀笟鏃ョ▼缁熻

9

INFO

骞冲潎鐨勫唴閮ㄤ綔涓氭棩绋嬬粺璁

鍙戦佺殑瀛楄妭鏁

9

INFO

鍙戦佽嚦鑺傜偣X鐨勫钩鍧囧瓧鑺傛暟

鎺ユ敹鐨勮嚜宸#

9

INFO

浠庤妭鐐X鎺ユ敹鐨勫钩鍧囧瓧鑺傛暟

閫氭姤浜嬪姟缁熻

8

INFO

浜嬪姟鏁扮洰锛屾彁浜ゆ鏁帮紝璇诲彇娆℃暟锛岀畝鍗曡鍙栨鏁帮紝鍐欏叆娆℃暟锛屽苟鍙戞搷浣滄暟鐩傚睘鎬т俊鎭紝浠ュ強鏀惧純娆℃暟

閫氭姤鎿嶄綔

8

INFO

鎿嶄綔鏁扮洰

閫氭姤琛ㄥ垱寤

7

INFO

 

鍐呭瓨浣跨敤

5

INFO

鏁版嵁鍐呭瓨鍜岀储寮曞唴瀛樼殑浣跨敤鐜囷紙80%90%100%

ERROR浜嬩欢

杩欎簺浜嬩欢涓庣皣閿欒鍜屽憡璀︽湁鍏筹紝濡傛灉鍑虹幇1涓垨澶氫釜杩欑被浜嬩欢锛岃〃鏄庡嚭鐜颁簡閲嶅ぇ鏁呴殰鎴栧け璐ャ

浜嬩欢

浼樺厛绾

涓ラ噸绾у埆

鎻忚堪

鍥犲け鍘诲績璺宠屾浜

8

ALERT

鍥犲け鍘诲績璺宠屽0鏄庤妭鐐X姝讳骸銆

浼犺緭鍣ㄩ敊璇

2

ERROR

 

浼犺緭鍣ㄥ憡璀

8

WARNING

 

澶卞幓蹇冭烦

8

WARNING

鑺傜偣X澶卞幓蹇冭烦#Y

涓鑸у憡璀︿簨浠

2

WARNING

 

INFO浜嬩欢

杩欎簺浜嬩欢缁欏嚭浜嗗叧浜庣皣鐘舵佸拰绨囩淮鎶ゆ椿鍔ㄧ殑涓鑸俊鎭紝濡傛棩蹇楀拰蹇冭烦浼犺緭绛夈

浜嬩欢

浼樺厛绾

涓ラ噸绾у埆

鎻忚堪

鍙戝嚭蹇冭烦

12

INFO

灏嗗績璺冲彂閫佽嚦鑺傜偣X

鍒涘缓鏃ュ織瀛楄妭

11

INFO

鏃ュ織閮ㄥ垎锛屾棩蹇楁枃浠讹紝MB

涓鑸俊鎭簨浠

2

INFO

 

17.6.4. 鍗曠敤鎴锋ā寮

閲囩敤鍗曠敤鎴锋ā寮忥紝鏁版嵁搴撶鐞嗗憳鑳藉灏嗗鏁版嵁搴撶郴缁熺殑璁块棶闄愬埗鍦1MySQL鏈嶅姟鍣紙SQL鑺傜偣锛夈傝繘鍏ュ崟鐢ㄦ埛妯″紡鏃讹紝涓庢墍鏈夊叾浠MySQL鏈嶅姟鍣ㄧ殑鎵鏈夎繛鎺ュ潎灏嗘伆褰撳叧闂紝鑰屼笖鎵鏈夋鍦ㄨ繍琛岀殑浜嬪姟鍧囧皢琚斁寮冦備笉鍏佽鍚姩浠讳綍鏂颁簨鍔°

涓鏃︾皣杩涘叆鍗曠敤鎴锋ā寮忥紝鍙湁鎸囧畾鐨SQL鑺傜偣鎵嶆湁鏉冭闂暟鎹簱銆備娇鐢ALL STATUS鍛戒护锛屽彲鏌ョ湅绨囪繘鍏ュ崟鐢ㄦ埛妯″紡鐨勬椂闂淬

绀轰緥锛

NDB> ENTER SINGLE USER MODE 5

鎵ц璇ュ懡浠よ屼笖绨囪繘鍏ュ崟鐢ㄦ埛妯″紡鍚庯紝鑺傜偣ID5SQL鑺傜偣灏嗘垚涓虹皣涓敮涓鍏佽鐨勭敤鎴枫

涓婅堪鍛戒护涓寚瀹氱殑鑺傜偣蹇呴』鏄MySQL鏈嶅姟鍣ㄨ妭鐐癸紝濡傛灉鎸囧畾浠讳綍鍏朵粬绫诲瀷鐨勮妭鐐癸紝灏嗚鎷掔粷銆

娉ㄩ噴锛鎵ц涓婅堪鍛戒护鏃讹紝鎸囧畾鑺傜偣涓婃墍鏈夋鍦ㄨ繍琛岀殑浜嬪姟鍧囧皢琚斁寮冿紝杩炴帴鍏抽棴锛岃屼笖蹇呴』閲嶅惎鏈嶅姟鍣ㄣ

浣跨敤EXIT SINGLE USER MODE鍛戒护锛岃兘澶熷皢绨囨暟鎹妭鐐圭殑鐘舵佷粠鍗曠敤鎴锋ā寮忔洿鏀逛负姝e父妯″紡銆傚浜庣瓑寰呰繛鎺ョ殑MySQL鏈嶅姟鍣紙鍗筹紝瀵逛簬鍗冲皢鍑嗗灏辩华骞跺彲鐢ㄧ殑绨囷級锛岀幇鍦ㄥ厑璁歌繘琛岃繛鎺ャ傚湪鐘舵佸彉鍖栨湡闂村拰鍙樺寲涔嬪悗锛屾寚瀹氫负鍗曠敤鎴SQL鑺傜偣鐨MySQL鏈嶅姟鍣ㄥ皢缁х画杩愯锛堝鏋滀粛杩炴帴鐨勮瘽锛夈

绀轰緥锛

NDB> EXIT SINGLE USER MODE

杩愯鍦ㄥ崟鐢ㄦ埛妯″紡涓嬫椂锛屽鏋滆妭鐐瑰け璐ワ紝鎺ㄨ崘鐨勫鐞嗘柟娉曟槸锛

  •  

1.    缁撴潫鎵鏈夌殑鍗曠敤鎴锋ā寮忎簨鍔°

2.    鍙戝嚭EXIT SINGLE USER MODE鍛戒护銆

3.    閲嶅惎绨囩殑鏁版嵁鑺傜偣銆

         杩涘叆鍗曠敤鎴锋ā寮忎箣鍓嶉噸鍚暟鎹簱銆

17.6.5. MySQL绨囩殑鑱旀満澶囦唤

鍦ㄦ湰鑺備腑锛屼粙缁嶄簡鍒涘缓澶囦唤鐨勬柟娉曪紝浠ュ強浠庡浠芥仮澶嶆暟鎹簱鐨勬柟娉曘

17.6.5.1. 绨囧浠芥蹇

澶囦唤鎸囩殑鏄湪缁欏畾鏃堕棿瀵规暟鎹簱鐨勫揩鐓с傚浠藉寘鍚笁涓富瑕侀儴鍒嗭細

         Metadata锛堝厓鏁版嵁锛夛細鎵鏈夋暟鎹簱琛ㄧ殑鍚嶇О鍜屽畾涔夈

         Table records锛堣〃璁板綍锛夛細鎵ц澶囦唤鏃跺疄闄呬繚瀛樺湪鏁版嵁搴撹〃涓殑鏁版嵁銆

         Transaction log锛堜簨鍔℃棩蹇楋級锛氭寚鏄庡浣曚互鍙婁綍鏃跺皢鏁版嵁淇濆瓨鍦ㄦ暟鎹簱涓殑杩炵画璁板綍銆

姣忎竴閮ㄥ垎鍧囦細淇濆瓨鍦ㄥ弬涓庡浠界殑鎵鏈夎妭鐐逛笂銆傚湪澶囦唤杩囩▼涓 锛屾瘡涓妭鐐瑰潎浼氬皢杩欎笁涓儴鍒嗕繚瀛樺湪纾佺洏涓婄殑涓変釜鏂囦欢涓細

         BACKUP-backup_id.node_id.ctl

鍖呭惈鎺у埗淇℃伅鍜屽厓鏁版嵁鐨勬帶鍒舵枃浠躲傛瘡涓妭鐐瑰潎浼氬皢鐩稿悓鐨勮〃瀹氫箟锛堝浜庣皣涓殑鎵鏈夎〃锛変繚瀛樺湪鑷繁鐨勮鏂囦欢涓

         BACKUP-backup_id-0.node_id.data

鍖呭惈琛ㄨ褰曠殑鏁版嵁鏂囦欢锛屽畠鏄寜鐗囨淇濆瓨鐨勶紝涔熷氨鏄锛屽湪澶囦唤杩囩▼涓紝涓嶅悓鐨勮妭鐐逛細淇濆瓨涓嶅悓鐨勭墖娈点傛瘡涓妭鐐逛繚瀛樼殑鏂囦欢浠ユ寚鏄庝簡璁板綍鎵灞炶〃鐨勬爣棰樺紑濮嬨傚湪璁板綍娓呭崟鍚庨潰鏈変竴涓寘鍚叧浜庢墍鏈夎褰曟牎楠屽拰鐨勮剼娉ㄣ

         BACKUP-backup_id.node_id.log

鍖呭惈宸叉彁浜や簨鍔$殑璁板綍鐨勬棩蹇楁枃浠躲傚湪鏃ュ織涓紝浠呬繚瀛樺凡鍦ㄥ浠戒腑淇濆瓨鐨勮〃涓婄殑浜嬪姟銆傚弬涓庡浠界殑鑺傜偣灏嗕繚瀛樹笉鍚岀殑璁板綍锛岃繖鏄洜涓猴紝涓嶅悓鐨勮妭鐐瑰绾充簡涓嶅悓鐨勬暟鎹簱鐗囨銆

鍦ㄤ笂闈㈡墍鍒楃殑鍐呭涓紝backup_id鎸囩殑鏄浠IDnode_id鏄垱寤烘枃浠剁殑鑺傜偣鐨勫敮涓ID

17.6.5.2. 浣跨敤绠$悊鏈嶅姟鍣ㄥ垱寤哄浠

寮濮嬪浠藉墠锛岃纭繚宸蹭负澶囦唤鎿嶄綔鎭板綋鍦伴厤缃簡绨囥傦紙璇峰弬瑙17.6.5.4鑺傦紝鈥滅皣澶囦唤鐨勯厤缃锛夈

浣跨敤绠$悊鏈嶅姟鍣ㄥ垱寤哄浠藉寘鍚互涓嬫楠わ細

1.    鍚姩绠$悊鏈嶅姟鍣(ndb_mgm)

2.    鎵ц鍛戒护START BACKUP

3.    绠$悊鏈嶅姟鍣ㄥ皢鐢ㄦ秷鎭滄寚绀哄浠藉紑濮嬧濅綔鍑哄簲绛斻傝繖鎰忓懗鐫绠$悊鏈嶅姟鍣ㄥ皢璇锋眰鎻愪氦缁欎簡绨囷紝浣嗗皻鏈敹鍒颁换浣曞洖搴斻

4.    绠$悊鏈嶅姟鍣ㄥ洖澶嶁澶囦唤backup_id寮濮锛屽叾涓紝backup_id鏄澶囦唤鐨勫敮涓ID锛堝鏋滄湭浣滃叾浠栭厤缃紝璇ID杩樺皢淇濆瓨鍦ㄧ皣鏃ュ織涓級銆傝繖鎰忓懗鐫绨囧凡鏀跺埌骞跺紑濮嬪鐞嗗浠借姹傘傚畠涓嶈〃绀哄浠藉凡瀹屾垚銆

5.    绠$悊鏈嶅姟鍣ㄥ彂鍑烘秷鎭澶囦唤backup_id瀹屾垚鈥濓紝閫氱煡澶囦唤鎿嶄綔宸茬粨鏉熴

瑕佹兂鏀惧純姝e湪澶勭悊鐨勫浠斤細

1.    鍚姩绠$悊鏈嶅姟鍣ㄣ

2.    鎵ц鍛戒护ABORT BACKUP backup_idbackup_id鏄綋澶囦唤寮濮嬫椂鍖呭惈鍦ㄧ鐞嗘湇鍔″櫒搴斿ぇ涓殑澶囦唤ID锛堝湪娑堟伅鈥滃浠backup_id鍚姩涓級銆

3.    绠$悊鏈嶅姟鍣ㄧ敤娑堟伅鈥滄斁寮冩寚绀虹殑澶囦唤backup_id鈥濈‘璁ゆ斁寮冭姹傦紝娉ㄦ剰锛屽皻鏈敹鍒板璇ヨ姹傜殑瀹為檯鍥炲簲銆

4.    涓鏃︽斁寮冧簡澶囦唤锛岀鐞嗘湇鍔″櫒灏嗛氭姤鈥滃浠backup_idXYZ鑰屾斁寮鈥濄傝繖鎰忓懗鐫绨囦腑姝簡澶囦唤锛屽苟浠庣皣鏂囦欢绯荤粺涓垹闄や簡涓庤澶囦唤鏈夊叧鐨勬墍鏈夋枃浠躲

鍦ㄧ郴缁shell涓娇鐢ㄤ笅杩板懡浠わ紝涔熻兘鏀惧純姝e湪鎵ц鐨勫浠斤細

shell> ndb_mgm -e "ABORT BACKUP backup_id"

娉ㄩ噴锛鎵ц鏀惧純鎿嶄綔鏃讹紝濡傛灉娌℃湁IDbackup_id鐨勫浠斤紝绠$悊鏈嶅姟鍣ㄤ笉浼氱粰鍑轰换浣曟槑纭洖搴斻備絾鏄紝鎵鍙戝嚭鐨勬棤鏁堟斁寮冨懡浠ゅ皢鍦ㄧ皣鏃ュ織涓粰鍑恒

17.6.5.3. 濡備綍鎭㈠绨囧浠

绨囨仮澶嶇▼搴忔槸浣滀负鍗曠嫭鐨勫懡浠よ瀹炵敤宸ュ叿ndb_restore瀹炵幇鐨勶紝瀹冨皢璇诲彇鐢卞浠藉垱寤虹殑鏂囦欢锛屽苟灏嗕繚瀛樼殑淇℃伅鎻掑叆鏁版嵁搴撱傚繀椤讳负姣忕粍澶囦唤鏂囦欢鎵ц鎭㈠绋嬪簭锛屼篃灏辨槸璇达紝鎵ц娆℃暟涓庡垱寤哄浠芥椂杩愯鐨勬暟鎹簱鑺傜偣鏁扮浉鍚屻

棣栨鎵ц鎭㈠绋嬪簭鏃讹紝杩橀渶瑕佹仮澶嶅厓鏁版嵁銆傛崲鍙ヨ瘽璁诧紝蹇呴』閲嶆柊鍒涘缓鏁版嵁搴撹〃锛堟敞鎰忥紝寮濮嬫墽琛屾仮澶嶆搷浣滄椂锛岀皣涓簲鏈変竴涓┖鏁版嵁搴擄級銆傛仮澶嶇▼搴忓浜庣皣鏉ヨ鐩稿綋浜API锛屽洜姝わ紝闇瑕佷竴涓┖闂茶繛鎺ワ紝浠ヤ究涓庣皣鐩歌繛銆傚彲浣跨敤ndb_mgm鍛戒护SHOW锛堝湪绯荤粺shell涓嬩娇鐢ndb_mgm -e SHOW鍗冲彲瀹屾垚璇ユ搷浣滐級杩涜楠岃瘉銆傚彲浠ヤ娇鐢ㄥ紑鍏斥-c connectstring鈥濇潵纭畾MGM鑺傜偣鐨勪綅缃傦紙鍏充簬杩炴帴瀛楃涓茬殑鏇村淇℃伅锛岃鍙傝17.4.4.2鑺傦紝鈥淢ySQL绨囪繛鎺ュ瓧绗︿覆銆傚浠芥枃浠跺繀椤讳綅浜庢仮澶嶇▼搴忓弬閲忕粰瀹氱殑鐩綍涓嬨

鑳藉浣跨敤涓庡垱寤烘槸鎵鐢ㄩ厤缃笉鍚岀殑閰嶇疆灏嗗浠芥仮澶嶅埌鏁版嵁搴撱備緥濡傦紝瀵逛簬澶囦唤ID12鐨勫浠斤紝璇ュ浠芥槸鍦ㄥ叿鏈変袱涓暟鎹簱鑺傜偣锛堣妭鐐ID鏃犳伓23锛夌殑绨囦腑鍒涘缓鐨勶紝鍙互灏嗗叾鎭㈠鍒板叿鏈4涓妭鐐圭殑绨囦腑銆傝繖鏍凤紝ndb_restore蹇呴』杩愯涓ゆ锛屼负鍒涘缓澶囦唤鏃剁殑姣忎釜鏁版嵁搴撹妭鐐硅繍琛屼竴娆°

娉ㄩ噴锛瀵逛簬蹇熸仮澶嶏紝鑳藉浠ュ苟琛屾柟寮忔仮澶嶆暟鎹紝浣嗗繀椤绘湁瓒冲鐨勫彲鐢ㄧ皣杩炴帴銆傜劧鑰岋紝鏁版嵁鏂囦欢蹇呴』濮嬬粓鍓嶄簬鏃ュ織鏂囦欢銆

17.6.5.4. 绨囧浠界殑閰嶇疆

4涓敤浜庡浠界殑鍩烘湰閰嶇疆鍙傛暟锛

         BackupDataBufferSize

灏嗘暟鎹啓鍏ョ鐩樹箣鍓嶇敤浜庡鏁版嵁杩涜缂撳啿澶勭悊鐨勫唴瀛橀噺銆

         BackupLogBufferSize

灏嗘棩蹇楄褰曞啓鍏ョ鐩樹箣鍓嶇敤浜庡鍏惰繘琛岀紦鍐插鐞嗙殑鍐呭瓨閲忋

         BackupMemory

鍦ㄦ暟鎹簱鑺傜偣涓负澶囦唤鍒嗛厤鐨勬诲唴瀛樸傚畠搴旀槸鍒嗛厤缁欏浠芥暟鎹紦鍐茬殑鍐呭瓨鍜屽垎閰嶇粰澶囦唤鏃ュ織缂撳啿鐨勫唴瀛樹箣鍜屻

         BackupWriteSize

鍐欏叆纾佺洏鐨勫潡澶у皬銆傚畠閫傜敤浜庡浠芥暟鎹紦鍐插拰澶囦唤鏃ュ織缂撳啿

鍏充簬杩欎簺鍙傛暟鐨勬洿澶氱粏鑺傦紝璇峰弬瑙17.4鑺傦紝鈥淢ySQL绨囩殑閰嶇疆鈥

17.6.5.5. 澶囦唤鏁呴殰璇婃柇涓庢帓闄

濡傛灉鍦ㄥ彂鍑哄浠借姹傛椂杩斿洖浜嗛敊璇唬鐮侊紝鏈鍙兘鐨勫師鍥犳槸鍐呭瓨涓嶈冻锛屾垨纾佺洏绌洪棿涓嶈冻銆傚簲妫鏌ユ槸鍚︿负澶囦唤鍒嗛厤浜嗚冻澶熺殑鍐呭瓨銆傛澶栵紝杩樺簲妫鏌ュ湪澶囦唤鐩爣鐨勭‖鐩樺垎鍖轰笂鏄惁鏈夎冻澶熺殑绌洪棿銆

NDB涓嶆敮鎸侀噸澶嶇殑璇诲彇鎿嶄綔锛屽浜庢仮澶嶈繘绋嬶紝杩欑被鎿嶄綔浼氬鑷撮棶棰樸傚敖绠″浠借繘绋嬧hot鈥濓紝浣嗕粠澶囦唤鎭㈠MySQL绨囧苟涓嶆槸100锛呪hot鈥濈殑杩涚▼銆傚叾鍘熷洜鍦ㄤ簬锛屽湪鎭㈠杩涚▼鎵ц鏈熼棿锛屾鍦ㄨ繍琛岀殑浜嬪姟浼氫粠宸叉仮澶嶇殑鏁版嵁涓幏鍙栦笉鍙噸澶嶇殑璇汇傝繖鎰忓懗鐫锛屽綋鎭㈠姝e湪杩涜鏃讹紝鏁版嵁鐨勭姸鎬佹槸涓嶄竴鑷寸殑銆

17.7. 浣跨敤涓嶮ySQL绨囩殑楂橀熶簰杩

鍗充娇鍦1996骞村紑濮NDB绨囩殑璁捐涔嬪墠锛屽湪鍒涘缓骞惰鏁版嵁搴撶殑杩囩▼涓亣鍒扮殑涓涓富瑕侀棶棰樻樉鐒舵槸缃戠粶涓妭鐐逛箣闂寸殑閫氫俊闂銆傛鍥犱负濡傛锛屼粠寮濮嬭璁℃椂锛NDB绨囧氨鍏佽浣跨敤澶氱涓嶅悓鐨勬暟鎹紶杈撴満鍒躲傚湪鏈墜鍐屼腑锛屾垜浠娇鐢ㄤ簡鏈浼犺緭鍣

鐩墠锛MySQL绨囦唬鐮佸簱鍖呭惈瀵瑰洓绉嶄笉鍚屼紶杈撳櫒鐨勬敮鎸併傜洰鍓嶇殑澶у鏁扮敤鎴烽噰鐢ㄧ殑鏄互澶綉涓婄殑TCP/IP锛岃繖鏄洜涓哄畠鏃犲涓嶅湪銆傚畠涔熸槸杩勪粖涓烘鍦MySQL绨囦腑缁忚繃鏈浣虫祴璇曠殑浼犺緭鍣ㄣ

鎴戜滑姝e湪鍔姏锛屼互纭繚涓ndbd杩涚▼鐨勯氫俊鏄敖鍙兘澶х殑鈥滅粍鍧椻濓紝杩欐槸鍥犱负锛屽畠鏈夊埄浜庢墍鏈夌殑鏁版嵁浼犺緭绫诲瀷銆

瀵逛簬闇瑕佸畠鐨勭敤鎴凤紝涔熻兘浣跨敤绨囦簰鑱斾互杩涗竴姝ュ寮烘ц兘銆傚疄鐜板畠鐨勬柟寮忔湁涓ょ锛氭垨浣跨敤鑳藉鐞嗚鎯呭喌鐨勫畾鍒朵紶杈撳櫒锛屾垨浣跨敤鑳界粫杩TCP/IP鍫嗘爤鐨勫鎺ュ瓧瀹炴柦鏂规銆傛垜浠娇鐢ㄧ敱Dolphin寮鍙戠殑SCI锛堣妯″彲鎵╁睍鐨勮绠楁満杩炴帴鎺ュ彛锛夋妧鏈紝瀵硅繖涓ょ被鎶鏈繘琛屼簡璇曢獙銆

17.7.1. 閰嶇疆MySQL绨囦互浣跨敤SCI濂楁帴瀛

鍦ㄦ湰鑺備腑锛屾垜浠皢浠嬬粛濡備綍鏀圭紪涓哄父瑙TCP/IP閫氫俊閰嶇疆鐨勭皣锛屼互浣跨敤SCI濂楁帴瀛椼傛湰鏂囨。鍩轰簬2004101鏃ュ彂甯冪殑SCI濂楁帴瀛2.3.0鐗堛

鍓嶆彁鏉′欢

瀵逛簬浠讳綍鎵撶畻浣跨敤SCI濂楁帴瀛楃殑鏈哄櫒锛岄兘蹇呴』閰嶅SCI鍗°

鑳藉涓庝换浣曠増鏈殑MySQL绨囦竴璧蜂娇鐢SCI濂楁帴瀛椼備笉闇瑕佺壒娈婂垱寤猴紝杩欐槸鍥犱负瀹冮噰鐢ㄤ簡MySQL绨囦腑宸叉彁渚涚殑姝e父濂楁帴瀛楄皟鐢ㄣ備絾鏄紝鐩墠浠呭湪Linux 2.42.6鍐呮牳涓婃墠鏀寔SCI濂楁帴瀛椼傚敖绠″埌鐩墠涓烘鎴戜滑浠呭湪Linux 2.4涓婃牳瀹炰簡杩欑偣锛屽湪涓浜涘叾浠栨搷浣滅郴缁熶笂涔熸垚鍔熸祴璇曚簡SCI浼犺緭鍣ㄣ

瀵逛簬SCI濂楁帴瀛楋紝鏈夊洓绉嶅熀鏈姹傦細

1.    鍒涘缓SCI濂楁帴瀛楀簱銆

2.    瀹夎SCI濂楁帴瀛楀唴鏍稿簱銆

3.    瀹夎1涓垨2涓厤缃枃浠躲

4.    蹇呴』涓烘暣涓満鍣ㄦ垨鍚姩MySQL绨囪繘绋嬬殑shell鍚敤SCI濂楁帴瀛楀簱銆

瀵逛簬鎵撶畻灏SCI濂楁帴瀛楃敤浜庤妭鐐归棿鐨勯氫俊鐨勭皣锛岄渶瑕佷负绨囦腑鐨勬瘡鍙版満鍣ㄩ噸澶嶈杩涚▼銆

瑕佹兂浣SCI濂楁帴瀛楀伐浣滐紝闇瑕佽幏寰椾袱涓蒋浠跺寘锛

1.    鍖呭惈鐢ㄤ簬SCI濂楁帴瀛楀簱鐨DIS鏀寔搴撶殑婧愮爜杞欢鍖呫

2.    鐢ㄤ簬SCI濂楁帴瀛楀簱鏈韩鐨勬簮鐮佽蒋浠跺寘銆

鐩墠锛屼粎浠ユ簮鐮佹牸寮忔彁渚涗簡瀹冧滑銆傜紪鍐欐湰鏂囨。鏃跺彲鐢ㄧ殑鏈鏂扮増鏈殑杞欢鍖呭垎鍒槸DIS_GPL_2_5_0_SEP_10_2004.tar.gzSCI_SOCKET_2_3_0_OKT_01_2004.tar.gz銆傚湪涓嬭堪绔欑偣锛屽彲鎵惧埌瀹冧滑锛堜篃鍙兘鎵惧埌鏇存柊鐨勭増鏈級锛http://www.dolphinics.no/support/downloads.html

杞欢鍖呭畨瑁

鑾峰緱搴撹蒋浠跺寘鍚庯紝鎺ヤ笅鏉ュ簲灏嗗畠浠В鍖呭埌鎭板綋鐨勭洰褰曚笅锛屽皢SCI濂楁帴瀛楀簱瑙e寘鍒DIS浠g爜涓嬬殑鐩綍涓傜劧鍚庯紝闇瑕佸垱寤哄簱銆傚湪涓嬮潰鐨勭ず渚嬩腑锛岀粰鍑轰簡鍦Linux/x86骞冲彴涓婃墽琛岃浠诲姟鎵闇鐨勫懡浠わ細

shell> tar xzf DIS_GPL_2_5_0_SEP_10_2004.tar.gz
shell> cd DIS_GPL_2_5_0_SEP_10_2004/src/
shell> tar xzf ../../SCI_SOCKET_2_3_0_OKT_01_2004.tar.gz
shell> cd ../adm/bin/Linux_pkgs
shell> ./make_PSB_66_release

鑳藉涓64浣嶅鐞嗗櫒鍒涘缓杩欎簺搴撱傝鎯充负浣跨敤64浣嶆墿灞曠殑Opteron CPU鍒涘缓杩欎簺搴擄紝璇疯繍琛make_PSB_66_X86_64_release鑰屼笉鏄make_PSB_66_release銆傚鏋滃垱寤哄伐浣滄槸鍦Itanium鏈哄櫒涓婅繘琛岀殑锛屽簲浣跨敤make_PSB_66_IA64_releaseX86-64鍙樹綋搴旇兘涓Intel EM64T浣撶郴缁撴瀯涓璧峰伐浣滐紝浣嗚繖鐐瑰皻鏈祴璇曪紙灏辨垜浠墍鐭ワ級銆

瀹屾垚鍒涘缓杩涚▼鍚庯紝鍦zipped tar鏂囦欢涓彲鍙戠幇宸茬紪璇戝ソ鐨勫簱锛屾枃浠剁殑鍚嶇О绗﹀悎DIS-<operating-system>-time-date銆傜幇鍦紝鍙皢杞欢鍖呭畨瑁呭埌鎭板綋浣嶇疆銆傚湪鏈緥涓紝鎴戜滑浣跨敤鐨勫畨瑁呯洰褰曟槸/opt/DIS锛堟敞閲婏細浣犲緢鍙兘闇瑕佷互绯荤粺鏍圭敤鎴风殑韬唤杩愯涓嬭堪鍛戒护锛夛細

shell> cp DIS_Linux_2.4.20-8_181004.tar.gz /opt/
shell> cd /opt
shell> tar xzf DIS_Linux_2.4.20-8_181004.tar.gz
shell> mv DIS_Linux_2.4.20-8_181004 DIS

缃戠粶閰嶇疆

鑷虫锛屾墍鏈夌殑搴撳拰浜岃繘鍒舵枃浠跺潎宸插畨瑁呭埌浜嗘伆褰撶殑浣嶇疆锛岃繕闇纭繚SCI鍗″湪SCI鐨勫湴鍧绌洪棿鑼冨洿鍐呮嫢鏈夋伆褰撶殑鑺傜偣ID

杩涜鍚庨潰鐨勬搷浣滃墠锛岃繕闇纭畾缃戠粶缁撴瀯銆傚浜庤鎯呭舰锛屾湁涓夌鍙娇鐢ㄧ殑缃戠粶缁撴瀯锛

         涓缁村崟鐜綉缁溿

         1涓垨澶氫釜SCI浜ゆ崲鍣紝姣忎釜浜ゆ崲鍣ㄧ鍙f湁1涓幆褰㈢綉銆

         2缁存垨3缁寸幆闈㈢綉銆

姣忕被鎷撴墤缁撴瀯鍧囨湁鑷繁鐨勩佺敤浜庢彁渚涜妭鐐ID鐨勬柟娉曘備笅闈㈢粰鍑轰簡绠瑕佽璁恒

鍗曠幆缃戦噰鐢ㄧ殑鑺傜偣ID4鐨勯潪0鍊嶆暟锛4812鈥︺

涓嬩竴涓彲琛岀殑閫夋嫨鏄SCI浜ゆ崲鍣ㄣ1SCI浜ゆ崲鍣ㄦ湁8涓鍙o紝姣忎釜绔彛閮借兘鏀寔1涓幆褰㈢綉銆傛湁蹇呰纭繚涓嶅悓鐨勭幆褰㈢綉浣跨敤浜嗕笉鍚岀殑鑺傜偣ID绌洪棿銆傚浜庡吀鍨嬬殑閰嶇疆锛岀1涓鍙d娇鐢ㄧ殑鑺傜偣ID浣庝簬64460锛夛紝鎺ヤ笅鏉ョ殑64涓妭鐐ID68124锛夋寚瀹氱粰涓嬩竴涓鍙o紝渚濇绫绘帹锛岃妭鐐ID 452508灏嗚鎸囧畾缁欑8涓鍙c

瀵逛簬2缁存垨3缁寸幆闈㈢綉缁撴瀯锛屾瘡涓妭鐐逛綅浜庡悇缁翠腑锛屽湪绗1缁翠腑锛屽悇鑺傜偣鐨勫閲忎负4锛屽湪绗2缁翠腑锛屽閲忎负64锛屽湪绗3缁翠腑锛堝鏋滈傜敤鐨勮瘽锛夛紝澧為噺涓1024銆傚叧浜庢洿璇﹀敖鐨勬枃妗o紝璇峰弬瑙Dolphin鐨勭綉绔

鍦ㄦ垜浠殑娴嬭瘯涓紝閲囩敤浜嗕氦鎹㈠櫒鏂瑰紡锛屼絾澶у鏁板ぇ鍨嬬皣瀹夎搴旂敤浣跨敤鐨勬槸2缁存垨3缁寸幆闈㈢綉缁撴瀯銆傞噰鐢ㄤ氦鎹㈠櫒鏂瑰紡鍏锋湁鐨勪紭鐐规槸锛氫娇鐢ㄥ弻SCI鍗″拰鍙屼氦鎹㈠櫒锛岃兘澶熺浉瀵瑰鏄撳湴鍒涘缓鍐椾綑缃戠粶锛SCI缃戠粶涓婄殑骞冲潎鏁呴殰鍒囨崲鏃堕棿鍦100姣閲忕骇銆傚浜SCI濂楁帴瀛楀疄鏂斤紝MySQl绨囦腑鐨SCI浼犺緭鍣ㄦ敮鎸佽缁撴瀯锛岃屼笖瀹冧篃澶勪簬鍙戝睍褰撲腑銆

瀵逛簬2D/3D鐜潰缃戯紝鏁呴殰鍒囨崲涔熸槸鍙兘鐨勶紝浣嗛渶瑕佸悜鎵鏈夎妭鐐瑰彂閫佸彂鍑烘柊鐨勮矾鐢辩储寮曘傜劧鑰岋紝杩欎粎闇瑕100姣宸﹀彸灏辫兘瀹屾垚锛屽浜庡ぇ澶氭暟楂樺彲鐢ㄦф儏褰紝杩欐槸鍙帴鍙楃殑銆

閫氳繃灏嗙皣鏁版嵁鑺傜偣鎭板綋鍦扮疆浜庝氦鎹㈠紡浣撶郴缁撴瀯涓紝鑳藉浣跨敤2涓氦鎹㈠櫒鏉ユ瀯寤虹粨鏋勶紝灏16鍙拌绠楁満浜掕仈鍦ㄤ竴璧凤紝浠讳綍鍗曠偣鏁呴殰鍧囦笉浼氬Θ纰1鍙颁互涓婄殑璁$畻鏈恒傚浜32鍙拌绠楁満鍜2鍙颁氦鎹㈠櫒锛屼篃鑳戒互杩欐牱鐨勬柟寮忛厤缃皣锛屼换浣曞崟鐐规晠闅滃潎涓嶄細瀵艰嚧2涓互涓婄殑鑺傜偣涓㈠け锛屽湪姝ゆ儏鍐典笅锛屼篃鑳界煡閬撻偅涓瀵硅妭鐐规敹鍒板奖鍝嶃傚洜姝わ紝閫氳繃灏嗕袱涓妭鐐圭疆浜庝笉鍚岀殑鑺傜偣缁勶紝灏辫兘鍒涘缓鈥滃畨鍏ㄧ殑鈥MySQL绨囥

瑕佹兂涓SCI鍗¤缃妭鐐ID锛屽彲浣跨敤/opt/DIS/sbin鐩綍涓殑涓嬭堪鍛戒护銆傚湪鏈緥涓紝-c 1鈥鎸囩殑鏄SCI鍗$殑缂栧彿锛堝鏋滃湪鏈哄櫒涓婂彧鏈1鍧楀崱锛屽畠鎬讳负1锛夛紝鈥-a 0鈥鎸囩殑鏄傞厤鍣068鈥鏄妭鐐ID

shell> ./sciconfig -c 1 -a 0 -n 68

濡傛灉鍦ㄥ悓涓鍙版満鍣ㄤ笂鏈夊鍧SCI鍗★紝浣跨敤涓嬭堪鍛戒护锛堝亣瀹氬綋鍓嶇殑宸ヤ綔鐩綍鏄/opt/DIS/sbin锛夛紝鍙‘瀹氬摢鍧楀崱浣跨敤鍝釜鎻掓Ы锛

shell> ./sciconfig -c 1 -gsn

瀹冨皢缁欏嚭SCI鍗$殑搴忓垪鍙枫傜劧鍚庣敤鈥-c 2閲嶅璇ユ楠わ紝渚濇绫绘帹锛堝鏈哄櫒涓婄殑姣忓潡鍗★級銆備竴鏃﹀皢姣忓潡鍗′笌1涓彃妲藉尮閰嶅悗锛屽彲涓烘墍鏈夊崱璁剧疆鑺傜偣ID

瀹夎浜嗗繀瑕佺殑搴撳拰浜岃繘鍒舵枃浠讹紝骞惰缃簡SCI鑺傜偣ID鍚庯紝涓嬩竴姝ユ槸璁剧疆浠庝富鏈哄悕锛堟垨IP鍦板潃锛夊埌SCI鑺傜偣ID鐨勬槧灏勩傝浠诲姟鍙湪SCI濂楁帴瀛楅厤缃枃浠朵腑瀹屾垚锛岃鏂囦欢搴旇淇濆瓨涓/etc/sci/scisock.conf銆傚湪璇ユ枃浠朵腑锛岄氳繃鎭板綋鐨SCI鍗″皢SCI鑺傜偣鏄犲皠鍒颁笌涔嬮氫俊鐨勪富鏈哄悕鎴IP鍦板潃銆傝繖閲岀粰鍑轰簡涓涓緢绠鍗曠殑閰嶇疆鏂囦欢绀轰緥锛

#host           #nodeId
alpha           8
beta            12
192.168.10.20   16

涔熻兘瀵归厤缃繘琛岄檺鍒讹紝浣垮叾浠呭簲鐢ㄥ湪杩欎簺涓绘満鐨勫彲鐢ㄧ鍙e瓙闆嗕笂銆備篃鑳戒娇鐢ㄩ澶栫殑閰嶇疆鏂囦欢/etc/sci/scisock_opt.conf瀹屾垚璇ヨ缃紝濡備笅鎵绀猴細

#-key                        -type        -values
EnablePortsByDefault                yes
EnablePort                  tcp           2200
DisablePort                 tcp           2201
EnablePortRange             tcp           2202 2219
DisablePortRange            tcp           2220 2231

椹卞姩绋嬪簭瀹夎

鍒涘缓濂戒簡閰嶇疆鏂囦欢鍚庯紝鍙畨瑁呴┍鍔ㄧ▼搴忋

棣栧厛搴斿畨瑁呭簳灞傞┍鍔紝鐒跺悗瀹夎SCI濂楁帴瀛楅┍鍔細

shell> cd DIS/sbin/
shell> ./drv-install add PSB66
shell> ./scisocket-install add

濡傛灉鎰挎剰锛屽彲璋冪敤鑴氭湰鏉ユ牳瀹SCI濂楁帴瀛楅厤缃枃浠朵腑鐨勬墍鏈夎妭鐐规槸鍚﹀潎鑳借闂紝閫氳繃璇ユ柟寮忔鏌ュ畨瑁咃細

shell> cd /opt/DIS/sbin/
shell> ./status.sh

濡傛灉鍙戠幇閿欒骞堕渶瑕佹洿鏀SCI濂楁帴瀛楅厤缃紝闇瑕佷娇鐢ksocketconfig鏉ュ畬鎴愯浠诲姟锛

shell> cd /opt/DIS/util
shell> ./ksocketconfig -f

娴嬭瘯璁剧疆

涓轰簡纭繚SCI濂楁帴瀛楀凡瀹為檯浣跨敤锛屽彲浣跨敤latency_bench娴嬭瘯绋嬪簭銆備娇鐢ㄨ瀹炵敤宸ュ叿鐨勬湇鍔″櫒缁勪欢锛屽鎴风鑳藉杩炴帴鏈嶅姟鍣ㄤ互娴嬭瘯杩炴帴鐨勭瓑寰呮椂闂达紝閫氳繃瑙傚療绛夊緟鏃堕棿锛屽彲鏂逛究鍦板垽瀹氭槸鍚﹀惎鐢ㄤ簡SCI銆傦紙娉ㄩ噴锛氫娇鐢latency_bench涔嬪墠锛岄渶瑕佽缃幆澧冨彉閲LD_PRELOAD锛岃鍙傝鏈妭鍚庨潰鐨勪粙缁嶏級銆

瑕佹兂璁剧疆鏈嶅姟鍣紝鍙娇鐢ㄤ笅杩板懡浠わ細

shell> cd /opt/DIS/bin/socket
shell> ./latency_bench -server

瑕佹兂杩愯瀹㈡埛绔紝鍐嶆浣跨敤latency_bench锛屼絾姝ゆ椂閲囩敤鈥-client鈥閫夐」锛

shell> cd /opt/DIS/bin/socket
shell> ./latency_bench -client server_hostname

鍒扮洰鍓嶄负姝紝搴斿畬鎴愪簡SCI濂楁帴瀛楅厤缃紝鑰屼笖MySQL绨囧凡鍋氬ソ浜嗕娇鐢SCI濂楁帴瀛楀拰SCI浼犺緭鍣ㄧ殑鍑嗗锛堣鍙傝17.4.4.10鑺傦紝鈥淢ySQL绨嘢CI浼犺緭杩炴帴鈥锛夈

鍚姩绨

璇ヨ繘绋嬫帴涓嬫潵鐨勬楠ゆ槸鍚姩MySQL绨囥傝鎯冲惎鐢SCI濂楁帴瀛楋紝鍦ㄥ惎鍔ndbdmysqldndb_mgmd涔嬪墠锛岄渶瑕佽缃幆澧冨彉閲LD_PRELOAD銆傝鍙橀噺搴旀寚鍚戠敤浜SCI濂楁帴瀛楃殑鍐呮牳搴撱

瑕佹兂鍦bash shell涓嬪惎鍔ndbd锛屽彲鎵ц涓嬭堪鍛戒护锛

bash-shell> export LD_PRELOAD=/opt/DIS/lib/libkscisock.so
bash-shell> ndbd

tcsh鐜涓嬶紝鍙娇鐢ㄤ笅杩板懡浠ゅ畬鎴愮浉鍚岀殑浠诲姟锛

tcsh-shell> setenv LD_PRELOAD=/opt/DIS/lib/libkscisock.so
tcsh-shell> ndbd

娉ㄩ噴锛MySQL绨囧彲浠ヤ粎浣跨敤SCI濂楁帴瀛楃殑鍐呮牳鍙樹綋銆

17.7.2. 鐞嗚В绨囦簰杩炵殑褰卞搷

ndbd杩涚▼鏈夊緢澶氱畝鍗曠殑缁撴瀯锛屽畠浠彲鐢ㄤ簬璁块棶MySQL绨囦腑鐨勬暟鎹傛垜浠垱寤轰簡涓涓崄鍒嗙畝鍗曠殑鍩哄噯娴嬭瘯鏉ユ鏌ュ畠浠殑鎬ц兘锛屼互鍙婂悇绉嶄簰鑱旀柟寮忓鍏舵ц兘鐨勫奖鍝嶃

鏈夊洓绉嶈闂柟娉曪細

         涓婚敭璁块棶

閫氳繃鍏朵富閿畝鍗曞湴璁块棶璁板綍銆傚湪鏈绠鍗曠殑鎯呭喌涓嬶紝涓娆′粎璁块棶涓鏉¤褰曪紝杩欐剰鍛崇潃璇ュ崟涓璇锋眰闇璐熸媴璁剧疆浼楀TCP/IP娑堟伅鐨勫叏閮ㄥ紑閿浠ュ強浼楀鐨勫満鏅垏鎹㈠紑閿銆傚浜庡湪涓鎵逛腑鍙戝嚭澶氫釜涓婚敭璁块棶璇锋眰鐨勬儏鍐碉紝杩欎簺璁块棶璇锋眰灏嗗垎鎷呰缃繀瑕TCP/IP娑堟伅鍜屽満鏅垏鎹㈢殑寮閿銆傚鏋TCP/IP娑堟伅鏄潰鍚戜笉鍚岀洰鏍囩殑锛岃繕椤昏缃澶栫殑TCP/IP娑堟伅銆

         鍞竴閿闂

鍞竴閿闂笌涓婚敭璁块棶绫讳技锛屽樊鍒湪浜庯紝鍞竴閿闂槸浣滀负鍦ㄧ储寮曡〃涓婄殑璇诲彇鎿嶄綔鎵ц鐨勶紝鐒跺悗鏄綔鐢ㄥ湪琛ㄤ笂鐨勪富閿闂備絾鏄紝MySQL鏈嶅姟鍣ㄤ粎鍙戦佷竴鏉¤姹傦紝鑰屼笖瀵圭储寮曡〃鐨勮鍙栨槸鐢ndbd璐熻矗澶勭悊鐨勩傝繖绫昏姹備篃鍙楃泭浜庢壒澶勭悊娉曘

         鍏ㄨ〃鎵弿

瀵逛簬琛ㄦ煡璇紝褰撲笉瀛樺湪绱㈠紩鏃讹紝灏嗘墽琛屽叏琛ㄦ壂鎻忋傝繖灏嗕綔涓哄崟涓璇锋眰琚彂閫佽嚦ndbd杩涚▼锛岃杩涚▼闅忓悗灏嗚〃鎵弿鍒嗕负鍦ㄦ墍鏈夌皣ndbd杩涚▼涓婅繘琛岀殑涓缁勫苟琛屾壂鎻忋傚湪鏈潵鐨MySQL绨囩増鏈腑锛SQL鑺傜偣鑳藉杩囨护鏌愪簺鎵弿銆

         浣跨敤鏈夊簭绱㈠紩鐨勮寖鍥存壂鎻

浣跨敤鏈夊簭绱㈠紩鏃讹紝瀹冨皢浣跨敤涓庡叏琛ㄦ壂鎻忕浉鍚岀殑鏂瑰紡鎵ц鎵弿锛屼笉鍚屼箣澶勫湪浜庯紝瀹冧粎鎵弿浣嶄簬MySQL鏈嶅姟鍣紙SQL鑺傜偣锛夋墍浼犺緭鏌ヨ浣跨敤鐨勮寖鍥村唴鐨勮褰曘傚綋鎵鏈夌粦瀹氱殑绱㈠紩灞炴у寘鍚垎鍖 閿腑鐨勬墍鏈夊睘鎬ф椂锛屽皢浠ュ苟琛屾柟寮忔壂鎻忔墍鏈夊垎鍖恒

涓轰簡妫鏌ヨ繖浜涜闂柟娉曠殑鍩烘湰鎬ц兘锛屾垜浠紑鍙戜簡涓缁勫熀鍑嗐備綔涓鸿繖绫诲熀鍑嗕箣涓锛testReadPerf鑳藉娴嬭瘯绠鍗曠殑鍜屾壒澶勭悊寮忎富閿拰鍞竴閿闂傞氳繃鍙戝嚭杩斿洖鍗曚竴璁板綍鐨勬壂鎻忚姹傦紝璇ュ熀鍑嗚繕鑳芥祴閲忚寖鍥存壂鎻忕殑璁剧疆寮閿銆傛澶栵紝杩樻湁1涓鍩哄噯鐨勫彉浣擄紝瀹冮噰鐢ㄤ簡鑼冨洿鎵弿鏉ヨ幏鍙栨壒閲忚褰曘

杩欐牱锛屾垜浠氨鑳界‘瀹氬崟閿闂殑寮閿锛屼互鍙婂崟璁板綍鎵弿璁块棶鐨勫紑閿锛屽苟鑳芥牴鎹熀鏈闂柟娉曟祴閲忛氫俊濯掍粙鐨勫奖鍝嶃

鍦ㄦ垜浠繘琛岀殑娴嬭瘯涓紝涓洪噰鐢TCP/IP濂楁帴瀛楃殑姝e父浼犺緭鍣ㄥ拰浣跨敤SCI濂楁帴瀛楃殑绫讳技璁剧疆杩涜浜嗗熀鏈缃備笅闈㈢粰鍑虹殑鏁板瓧鏄叧浜庡皯閲忚闂殑锛屾瘡娆¤闂20鏉¤褰曘備娇鐢2KB鐨勮褰曟椂锛屼覆琛岃闂拰鎵瑰紡璁块棶涔嬮棿鐨勫樊寮傚皢闄嶄綆34鍊嶃傚浜2KB鐨勮褰曪紝鏈祴璇SCI濂楁帴瀛椼傛祴璇曟槸鍦ㄤ笅杩扮皣涓婅繘琛岀殑锛岃绨囨湁涓や釜鏁版嵁鑺傜偣锛岃繖涓や釜鏁版嵁鑺傜偣杩愯鍦2鍙板弻CPU鏈哄櫒涓婏紝澶勭悊鍣ㄤ负AMD MP1900+

Access type:         TCP/IP sockets           SCI Socket
Serial pk access:    400 microseconds         160 microseconds
Batched pk access:    28 microseconds          22 microseconds
Serial uk access:    500 microseconds         250 microseconds
Batched uk access:    70 microseconds          36 microseconds
Indexed eq-bound:   1250 microseconds         750 microseconds
Index range:          24 microseconds          12 microseconds

鎴戜滑杩樻墽琛屼簡鍙︿竴缁勬祴璇曪紝浠ユ鏌SCI濂楁帴瀛楃殑鎬ц兘浠ュ強SCI浼犺緭鍣ㄧ殑鎬ц兘锛屽苟灏嗚繖涓よ呬笌TCP/IP浼犺緭鍣ㄧ殑鎬ц兘杩涜浜嗘瘮杈冦傛墍鏈夋祴璇曞潎閲囩敤浜嗕富閿闂柟娉曪紝鎴栭噰鐢ㄤ覆琛屽绾跨▼鏂瑰紡锛屾垨閲囩敤澶氱嚎绋嬫壒鏂瑰紡銆

娴嬭瘯缁撴灉琛ㄦ槑锛SCI濂楁帴瀛楁瘮TCP/IP绾﹀揩100锛呫備笌SCI濂楁帴瀛楃浉姣旓紝鍦ㄥぇ澶氭暟鎯呭喌涓嬶紝SCI浼犺緭鍣ㄧ殑閫熷害鏇村揩銆傚湪鍏锋湁寰堝绾跨▼鐨勬祴璇曠▼搴忎腑鍑虹幇浜1涓煎緱鍏虫敞鐨勬儏鍐碉紝瀹冭〃鏄庯紝涓mysqld杩涚▼涓璧蜂娇鐢ㄦ椂锛SCI浼犺緭鍣ㄧ殑鎵ц鎬ц兘骞朵笉寰堝ソ銆

鎴戜滑寰楀嚭鐨勬讳綋缁撹鏄紝瀵逛簬澶у鏁板熀鍑嗭紝涓TCP/IP鐩告瘮锛岄櫎浜嗙綍瑙佺殑閫氫俊鎬ц兘涓嶆垚鍏朵负鍏虫敞浜嬪疁鐨勬儏鍐靛锛屼娇鐢SCI濂楁帴瀛楄兘灏嗘ц兘鎻愬崌绾100锛呫傚綋鎵弿杩囨护鍣ㄥ崰鐢ㄥぇ澶氭暟澶勭悊鏃堕棿锛屾垨褰撴墽琛屽ぇ閲忕殑涓婚敭璁块棶锛屽氨浼氬嚭鐜拌鎯呭喌銆傚湪杩欑被鎯呭喌涓嬶紝ndbd杩涚▼涓殑CPU澶勭悊鎿嶄綔灏嗗崰鐢ㄥ紑閿鐨勭浉褰撳ぇ閮ㄥ垎銆

瀵逛簬浣跨敤SCI浼犺緭鍣ㄦ潵鍙栦唬SCI濂楁帴瀛楋紝瀹冧粎瀵ndbd杩涚▼涔嬮棿鐨勯氫俊鏈夋剰涔夈傚鏋CPU鑳戒笓闂ㄧ敤浜ndbd杩涚▼锛屼娇鐢SCI浼犺緭鍣ㄤ篃涔熷緢鏈夋剰涔夛紝杩欐槸鍥犱负SCI浼犺緭鍣ㄨ兘纭繚璇ヨ繘绋嬫案涓嶄紤鎭傚彟涓涓噸瑕佺壒鎬ф槸锛屽畠鑳界‘淇濆ndbd杩涚▼鐨勪紭鍏堢骇杩涜鐗瑰畾鐨勮缃紝鍗充娇杩愯浜嗗緢闀跨殑鏃堕棿锛屽叾浼樺厛绾т篃涓嶄細涓уけ锛屽氨鍍忓湪Linux 2.6涓氳繃灏嗚繘绋嬮攣瀹氬埌CPU鑰岃兘瀹炵幇鐨勯偅鏍枫傚鏋滆繖绫婚厤缃槸鍙兘鐨勶紝涓庝娇鐢SCI濂楁帴瀛楃浉姣旓紝ndbd杩涚▼灏嗚幏寰1070锛呯殑鎬ц兘鎻愬崌锛堟墽琛屾洿鏂颁互鍙婂彲鑳界殑骞惰鎵弿鎿嶄綔鏃讹紝鎬ц兘鎻愬崌杈冨ぇ锛夈傘

瀵逛簬璁$畻鏈虹皣锛岃繕鏈夋暟绉嶅叾浠栫殑浼樺寲濂楁帴瀛楀疄鏂芥柟妗堬紝鍖呮嫭Myrinet銆佸悏姣旂壒浠ュお缃戙Infiniband锛堟棤闄愬甫瀹斤級鍜VIA鎺ュ彛銆傝縿浠婁负姝紝鎴戜滑浠呬笌SCI濂楁帴瀛椾竴璧锋祴璇曚簡MySQL绨囥傛垜浠繕鎻愪緵浜嗕笂杩版枃妗o紝鍏朵腑锛屼粙缁嶄簡濡備綍浣跨敤閽堝MySQL绨囩殑甯歌TCP/IP鏉ヨ缃SCI濂楁帴瀛楃殑鏂规硶銆

17.8. MySQL绨囩殑宸茬煡闄愬埗

鍦ㄦ湰鑺備腑锛屾垜浠垪鍑轰簡5.1.x绯诲垪涓MySQL绨囩殑涓浜涘凡鐭ラ檺鍒讹紝骞朵笌浣跨敤MyISAMInnoDB瀛樺偍寮曟搸鏃跺彲鐢ㄧ殑鐗规ц繘琛屼簡姣旇緝銆傜洰鍓嶏紝灏氫笉鎵撶畻鍦ㄥ嵆灏嗘帹鍑虹殑MySQL 5.1鐗堟湰涓鐞嗚繖浜涢棶棰橈紝浣嗘槸锛屾垜浠皢鍦ㄥ悗缁殑鐗堟湰绯诲垪涓紝鎻愪緵杩欐柟闈㈢殑琛ヤ竵鍜屼慨姝c傚鏋滀綘妫鏌ヤ簡MySQL缂洪櫡鏁版嵁搴擄紙http://bugs.mysql.com锛変腑鐨勨滅皣鈥濈被鍒紝鍙彂鐜版垜浠墦绠楀湪鍗冲皢鎺ㄥ嚭鐨MyAQL 5.1鐗堜腑鏇存鐨勫凡鐭ョ己闄凤紙濡傛灉鏍囪涓衡5.1鈥濈殑璇濓級銆

锛堟敞閲婏細鍦ㄦ湰鑺傛湯灏撅紝鍒楀嚭浜嗗湪褰撳墠鐗堟湰涓凡瑙e喅鐨MySQL 5.0绨囦腑鐨勪竴浜涗簨瀹滐級銆

         璇硶涓殑涓嶅吋瀹规锛堣繍琛屽凡鏈夌殑搴旂敤绋嬪簭鏃跺鑷撮敊璇級锛

o        涓嶆敮鎸佹枃鏈储寮曘

o        涓嶆敮鎸Geometry鏁版嵁绫诲瀷锛WKTWKB锛夈

         闄愬埗鎴栬涓轰腑鐨勪笉鍏煎鎬锛堣繍琛屽凡鏈夌殑搴旂敤绋嬪簭鏃跺彲鑳藉鑷撮敊璇級锛

o        娌℃湁浜嬪姟鐨勯儴鍒嗗洖婊氬姛鑳姐傞噸澶嶉敭鎴栫被浼奸敊璇細瀵艰嚧鏁翠釜浜嬪姟鐨勫洖婊氥

o        瀛樺湪寰堝鍙厤缃殑纭檺鍒讹紝浣嗚兘浣跨敤绨囦腑鐨勫彲鐢ㄤ富鍐呭瓨璁剧疆闄愬埗銆傚叧浜庨厤缃弬鏁扮殑瀹屾暣娓呭崟锛岃鍙傝17.4.4鑺傦紝鈥滈厤缃枃浠垛銆傚ぇ澶氭暟閰嶇疆鍙傛暟鍙湪绾垮崌绾с傝繖浜涚‖闄愬埗鍖呮嫭锛

         鏁版嵁搴撳唴瀛樺ぇ灏忓拰绱㈠紩鍐呭瓨澶у皬锛堝垎鍒槸DataMemoryIndexMemory锛夈

         瀵逛簬鑳藉鎵ц鐨勬渶澶т簨鍔℃暟锛屽彲浣跨敤閰嶇疆鍙傛暟MaxNoOfConcurrentOperations杩涜璁剧疆銆傛敞鎰忔壒閲忓姞杞斤紝TRUNCATE TABLEALTER TABLE鏄氳繃杩愯澶氫釜浜嬪姟浣滀负鐗规畩鎯呭喌杩涜澶勭悊鐨勶紝鍥犺屼笉鍙楄闄愬埗鐨勭害鏉熴

         涓庤〃鍜岀储寮曟湁鍏崇殑涓嶅悓闄愬埗銆備緥濡傦紝姣忚〃鐨勬渶澶ф湁搴忕储寮曟暟鏄敱MaxNoOfOrderedIndexes纭畾鐨勩

o        NDB琛ㄤ腑锛屾暟鎹簱鍚嶇О銆佽〃鍚嶇О鍜屽睘鎬у悕绉颁笉鑳戒笌鍏朵粬琛ㄥ鐞嗙▼搴忎腑鐨勪竴鏍烽暱銆傚睘鎬у悕绉板皢琚埅鐭嚦31涓瓧绗︼紝鎴煭鍚庡鏋滀笉鏄敮涓鐨勶紝灏嗗鑷撮敊璇傛暟鎹簱鍚嶇О鍜岃〃鍚嶇殑鎬绘渶澶ч暱搴︿负122涓瓧绗︼紙涔熷氨鏄锛NDB绨囪〃鍚嶇殑鏈澶ч暱搴︿负122涓瓧绗﹀噺鍘昏琛ㄦ墍灞炵殑鏁版嵁搴撶殑鍚嶇О涓殑瀛楃鏁帮級銆

o        鎵鏈夌殑绨囪〃琛屽叿鏈夊浐瀹氶暱搴︺傝繖鎰忓懗鐫锛堜緥濡傦級锛屽鏋滆〃涓湁浠呭寘鍚浉瀵硅緝灏忓肩殑1涓垨澶氫釜VARCHAR瀛楁锛屼笌浣跨敤MyISAM寮曟搸鐨勭浉鍚岃〃鍜屾暟鎹浉姣旓紝浣跨敤NDB瀛樺偍寮曟搸鏃堕渶瑕佹洿澶氱殑鍐呭瓨鍜岀鐩樼┖闂淬傛崲鍙ヨ瘽璁诧紝瀵逛簬VARCHAR鍒楋紝瀹冩墍闇鐨勫瓨鍌ㄧ┖闂翠笌鍏锋湁鐩稿悓澶у皬鐨CHAR鍒楁墍闇鐨勭浉鍚屻

o        绨囨暟鎹簱涓殑鏈澶ц〃鏁扮洰闄愬埗涓1792

o        姣忚〃鐨勬渶澶у睘鎬ф暟闄愬埗涓128

o        浠讳竴琛岀殑鏈澶у厑璁稿ぇ灏忎负8K涓嶅寘鎷繚瀛樺湪BLOB鍒椾腑鐨勬暟鎹

o        姣忛敭鐨勬渶澶у睘鎬ф暟涓32

         涓嶆敮鎸佺殑鐗规锛堜笉浼氬鑷撮敊璇紝浣嗕笉琚敮鎸佹垨寮哄埗锛夛細

o        澶栭敭缁撴瀯灏嗚蹇界暐锛屽氨鍍忓湪MyISAM琛ㄤ腑閭f牱銆

o        淇濆瓨鐐逛互鍙婂淇濆瓨鐐圭殑鍥炴粴灏嗚蹇界暐锛屽氨鍍忓湪MyISAM涓偅鏍枫

         鎬ц兘浠ュ強涓庨檺鍒舵湁鍏崇殑浜嬪疁

o        鐢变簬瀵NDB瀛樺偍寮曟搸鐨勮繛缁闂紝瀛樺湪鏌ヨ鎬ц兘闂锛屼笌MyISAMInnoDB鐨勬儏褰㈢浉姣旓紝鎵ц寰堝鑼冨洿鎵弿鏃讹紝寮閿鐩稿鏄傝吹銆

o        涓嶆敮鎸佽寖鍥寸粺璁′腑鐨勮褰曪紝鍦ㄦ煇浜涙儏鍐典笅锛岃繖浼氶犳垚闈炴渶浼樻煡璇㈣鍒掋傚彲閲囩敤USE INDEXFORCE INDEX瑙勯伩璇ラ棶棰樸

o        瀵逛簬浣跨敤USING HASH鍒涘缓鐨勫敮涓鎬у搱甯岀储寮曪紝濡傛灉NULL鏄敭鐨勪竴閮ㄥ垎锛屼笉鑳戒娇鐢ㄨ繖绫荤储寮曡闂〃銆

o        MySQL绨囦笉鏀寔纾佺洏涓婄殑鎸佺画鎻愪氦銆傛彁浜ゅ皢琚鍒讹紝浣嗕笉淇濊瘉鍦ㄦ彁浜ゆ椂浼氬皢鏃ュ織鍐欏叆纾佺洏銆

         涓㈠け鐗规э細

o        鍞竴鏀寔鐨勯殧绂荤骇鍒槸READ_COMMITTEDInnoDB鏀寔READ_COMMITTEDREAD_COMMITTEDREPEATABLE_READSERIALIZABLE锛夈傚叧浜庡叾濡備綍褰卞搷绨囨暟鎹簱澶囦唤鍜屾仮澶嶇殑鏇村淇℃伅锛岃鍙傝17.6.5.5鑺傦紝鈥滃浠芥晠闅滆瘖鏂笌鎺掗櫎鈥

o        涓嶆敮鎸佺鐩樹笂鐨勬寔缁彁浜ゃ傛彁浜ゅ皢琚鍒讹紝浣嗕笉淇濊瘉鍦ㄦ彁浜ゆ椂浼氬皢鏃ュ織鍐欏叆纾佺洏銆

         涓庡MySQL鏈嶅姟鍣ㄦ湁鍏崇殑闂锛堜笌MyISAMInnoDB鏃犲叧锛夛細

o        杩愯澶氫釜MySQL鏈嶅姟鍣ㄦ椂锛ALTER TABLE鏈畬鍏ㄩ攣瀹氾紙鏃犲垎甯冨紡琛ㄩ攣瀹氾級銆

o        濡傛灉鍦ㄥ涓MySQL鏈嶅姟鍣ㄤ笂杩涜浜嗘洿鏂帮紝MySQL澶嶅埗鍔熻兘涓嶈兘姝g‘澶勭悊銆備絾鏄紝濡傛灉鏁版嵁搴撳垎鍖烘柟妗堟槸鍦ㄥ簲鐢ㄧ骇鍒笂瀹屾垚鐨勶紝鑰屼笖鍦ㄨ繖浜涘垎鍖轰笂闈炲彂鐢熶簨鍔★紝閭d箞鍙娇澶嶅埗鍔熻兘姝g‘宸ヤ綔銆

o        瀵逛簬璁块棶鐩稿悓MySQL绨囩殑澶MySQL鏈嶅姟鍣紝涓嶆敮鎸佹暟鎹簱鐨勮嚜鍔ㄥ彂鐜帮紙autodiscovery锛夊姛鑳姐備絾鏄紝鍦ㄦ儏鍐典笅锛屾敮鎸佸琛ㄧ殑鑷姩鍙戠幇锛autodiscovery锛夊姛鑳姐傝繖鎰忓懗鐫锛屽垱寤轰簡鍚嶄负db_name鐨勬暟鎹簱鍚庯紝鎴栦娇鐢1MySQL鏈嶅姟鍣ㄥ鍏ヤ簡璇ユ暟鎹簱鍚庯紝搴斿湪璁块棶鐩稿悓MySQL绨囩殑姣忎釜棰濆MySQL鏈嶅姟鍣ㄤ笂鍙戝嚭CREATE DATABASE db_name璇彞锛堜粠MySQL 5.0.2寮濮嬶紝浣犺繕鑳戒娇鐢CREATE SCHEMA db_name;锛夈備竴鏃﹀缁欏畾MySQL鏈嶅姟鍣ㄥ畬鎴愪簡璇ユ搷浣滐紝鏈嶅姟鍣ㄥ簲鑳芥娴嬪埌鏁版嵁搴撹〃锛岃屼笉浜х敓閿欒銆

         浠呬笌MySQL绨囨湁鍏崇殑浜嬪疁锛堜笌MyISAMInnoDB鏃犲叧锛夛細

o        绨囦腑浣跨敤鐨勬墍鏈夋満鍣ㄥ繀椤诲叿鏈夌浉鍚岀殑浣撶郴缁撴瀯锛屼篃灏辨槸璇达紝鎵鏈夋壙杞借妭鐐圭殑鏈哄櫒蹇呴』鏄big-endianlittle-endian锛屼笉鑳芥贩鍚堜娇鐢ㄨ繖涓よ呫備緥濡傦紝涓嶈兘鐢ㄨ繍琛屽湪PPC涓婄殑绠$悊鑺傜偣鎸囨尌杩愯鍦x86鏈哄櫒涓婄殑鏁版嵁鑺傜偣銆傝闄愬埗涓嶉傜敤浜庣畝鍗曡繍琛mysql鎴栧叾浠栧鎴风锛堝彲鑳戒細璁块棶绨囩殑SQL鑺傜偣锛夌殑鏈哄櫒銆

o        涓嶈兘鍍忎娇鐢ALTER TABLECREATE INDEX瀹屾垚鐨勯偅鏍鎵ц鍦ㄧ嚎鏂规鏇存敼锛岃繖鏄洜涓NDB绨囦笉鏀寔杩欑被鍙樻洿鐨勮嚜鍔ㄦ娴嬶紙浣嗘槸锛鑳藉瀵煎叆鎴栧垱寤轰娇鐢ㄤ笉鍚屽瓨鍌ㄥ紩鎿庣殑琛紝鐒跺悗浣跨敤鈥ALTER TABLE tbl_name ENGINE=NDBCLUSTER;鈥濆皢鍏惰浆鎹负NDB銆傚湪杩欑被鎯呭喌涓嬶紝闇瑕佸彂鍑FLUSH TABLES鍛戒护锛寮哄埗绨囧彂鐜板彉鍖栵級銆

o        涓嶈兘鍦ㄧ嚎澧炲姞鎴栬垗寮冭妭鐐癸紙姝ゆ椂蹇呴』閲嶅惎绨囷級銆

o        浣跨敤澶氫釜绠$悊鏈嶅姟鍣ㄦ椂锛

         蹇呴』鍦ㄨ繛鎺ュ瓧绗︿覆涓槑纭负鑺傜偣鎸囧畾ID锛岃繖鏄洜涓猴紝鍦ㄥ涓鐞嗘湇鍔″櫒涓婏紝鑷姩鍒嗛厤鐨勮妭鐐ID涓嶈兘姝e父宸ヤ綔銆

         蹇呴』鍗佸垎灏忓績锛岀‘淇濇墍鏈夌殑绠$悊鏈嶅姟鍣ㄥ叿鏈夌浉鍚岀殑閰嶇疆銆傜皣瀵规鏂归潰涓嶈繘琛屼换浣曠壒娈婃鏌ワ紝

         瑕佹兂浣跨鐞嗚妭鐐硅兘鍙戠幇褰兼鐨勫瓨鍦紝鍒涘缓浜嗙皣鍚庡繀椤婚噸鍚墍鏈夌殑鏁版嵁鑺傜偣锛堣缁嗚В閲婅鍙傝Bug #13070锛夈

o        涓嶆敮鎸佺敤浜庢暟鎹妭鐐圭殑澶氫釜缃戠粶鎺ュ彛銆傚鏋滀娇鐢ㄤ簡杩欑被鎺ュ彛锛屽緢瀹规槗瀵艰嚧闂锛屽師鍥犲湪浜庯紝鍦ㄥ嚭鐜版煇涓鏁版嵁鑺傜偣澶辫触鐨勬儏鍐典笅锛SQL鑺傜偣灏嗙瓑寰呬互纭璇ユ暟鎹妭鐐规槸鍚﹀嚭鐜伴棶棰橈紝浣嗙敱浜庤鏁版嵁鑺傜偣鐨勫彟涓璺緞浠嶄繚鎸佹墦寮鐘舵侊紝SQL鑺傜偣姘歌繙涓嶄細鏀跺埌璇ョ‘璁や俊鎭傝繖浼氬鑷寸皣鏃犳硶宸ヤ綔銆

o        鏁版嵁鑺傜偣鐨勬渶澶ф暟鐩负48

o        MySQL绨囦腑鎬荤殑鏈澶ц妭鐐规暟涓63銆傚湪璇ユ暟鍊间腑鍖呮嫭鎵鏈夌殑MySQL鏈嶅姟鍣紙SQL鑺傜偣锛夛紝鏁版嵁鑺傜偣鍜岀鐞嗘湇鍔″櫒銆

鑰冭檻鍒版湰鑺傚紑濮嬫椂璁惧畾鐨勬潯浠讹紝鎴戜滑鍔涘浘浣夸笂闈㈠垪鍑虹殑淇℃伅灏藉彲鑳藉畬鍏ㄣ備綘鍙互灏嗕换浣曢亣鍒扮殑宸紓閫氭姤鍒MySQL缂洪櫡鏁版嵁搴擄紝http://bugs.mysql.com/銆傚鏋滄垜浠笉鎵撶畻鍦MySQL 5.1涓洿姝h闂锛屾垜浠細灏嗗叾娣诲姞鍒板垪琛ㄤ腑銆

17.9.聽MySQL绨囧彂灞曠殑閲嶈鍘嗙▼

鍦ㄦ湰鑺傦紝鎴戜滑璁ㄨ浜MySQL 5.1MySQL绨囧疄鏂戒腑鐨勪竴浜涘彉鍖栵紝骞朵笌MySQL 5.0杩涜浜嗘瘮杈冦傛垜浠繕灏嗚璁哄MySQL绨囩殑杩涗竴姝ラ噸澶ф敼杩涳紝鐩墠鏄负MySQL 5.2瑙勫垝鐨勩

MySQL 5.05.1涓紝NDB绨囧瓨鍌ㄥ紩鎿庡疄鏂芥柟妗堜箣闂寸殑鍙樺寲鐩稿杈冨皯锛屽洜姝ゅ叾鍗囩骇鐩稿蹇嵎鍜岀畝鍗曘

MySQL绨囧紑鍙戠殑涓昏鏂扮壒鎬у潎褰掑叆浜MySQL 5.1鏍戙傚湪鏈妭涓紝鎴戜滑杩樻彁渚涗簡涓浜涙彁绀猴紝浠嬬粛浜嗗湪MySQL 5.1涓皣鐗规у彲鑳藉寘鍚殑鏂归潰锛堣鍙傝17.9.2鑺傦紝鈥滃叧浜嶮ySQL绨囩殑MySQL 5.1鍙戝睍鍘嗙▼鈥锛夈

17.9.1.聽MySQL 5.0涓殑MySQL绨囧彉鍖

MySQL 5.0.3-beta浠ュ強鏇存柊鐨勭増鏈寘鍚竴浜涙湁瓒g殑鏂扮壒鎬э細

         涓嬫帹鏉′欢锛涓绉嶆煡璇紝濡傦細

                SELECT * FROM t1 WHERE non_indexed_attribute = 1;

瀹冨皢浣跨敤鍏ㄨ〃鎵弿锛屽苟浼氬湪绨囩殑鏁版嵁鑺傜偣鍐呰瘎浼版潯浠躲傚洜姝わ紝涓嶉渶瑕佸湪缃戠粶涓彂閫佺敤浜庤瘎浼扮殑璁板綍锛堜篃灏辨槸璇达紝閲囩敤鍑芥暟浼犺緭鑰屼笉鏄暟鎹紶杈擄級銆傚浜庤繖绉嶆煡璇㈢被鍨嬶紝鍏堕熷害蹇510鍊嶃傝娉ㄦ剰锛屾ā鐩墠璇ョ壒鎬ф槸榛樿绂佹鐨勶紙鏈夊緟鏇村交搴曠殑娴嬭瘯锛夛紝浣嗗湪鏌愪簺鎯呭喌涓嬩篃鑳借壇濂藉伐浣溿備娇鐢ㄥ懡浠もSET engine-condition-pushdown=On; command鈥濆彲鍚敤璇ョ壒鎬с備綔涓哄彲閫夋柟寮忥紝浣犱篃鍙互鐢ㄦ柊鐨勨--engine-condition-pushdown鈥濋夐」鏍囧織鍚姩MySQL鏈嶅姟鍣紝杩愯鍚敤浜嗚鐗规х殑mysqld

鍙互浣跨敤EXPLAIN鏉ュ垽瀹氬湪浣曟椂浣跨敤浜嗕笅鎺ㄦ潯浠躲

璇ュ彉鍖栫殑涓椤逛富瑕佷紭鐐瑰湪浜庯紝鑳藉浠ュ苟琛屾柟寮忔墽琛屾煡璇€傝繖鎰忓懗鐫锛屼笌浠ュ線鐩告瘮锛屽闈炵储寮曞垪鐨勬煡璇㈣蹇510鍊嶏紝涔樹互鏁版嵁鑺傜偣鐨勬暟鐩傚師鍥犲湪浜庯紝澶氫釜CPU鑳戒互骞惰鏂瑰紡鎵ц鏌ヨ銆

         闄嶄綆浜IndexMemory浣跨敤锛MySQL 5.1涓紝姣忔潯璁板綍绾︽秷鑰25瀛楄妭鐨勭储寮曞唴瀛橈紝姣忎釜鍞竴绱㈠紩姣忚褰曞皢浣跨敤25瀛楄妭鐨勭储寮曞唴瀛橈紙涓嶅惈鏌愪簺鏁版嵁鍐呭瓨锛岃繖鏄洜涓哄畠浠繚瀛樺湪鍗曠嫭琛ㄤ腑锛夈傝繖鏄洜涓哄湪绱㈠紩鍐呭瓨涓紝涓嶅啀闇瑕佷繚瀛樹富閿

         MySQL绨囧惎鐢ㄤ簡鏌ヨ楂橀熺紦鍐诧細鍏充簬閰嶇疆鍜屼娇鐢ㄦ煡璇㈤珮閫熺紦鍐茬殑鏇村淇℃伅锛岃鍙傝5.13鑺傦紝鈥淢ySQL鏌ヨ楂橀熺紦鍐测

         鏂扮殑浼樺寲锛氭湁涓涓渶瑕佺粰浜堢壒鍒叧娉ㄧ殑浼樺寲锛屽嵆锛岀洰鍓嶅湪鏌愪簺鏌ヨ涓娇鐢ㄤ簡鎵瑰紡璇诲彇鎺ュ彛銆備緥濡傦紝鑰冭檻涓嬭堪鏌ヨ锛

                SELECT * FROM t1 WHERE primary_key IN (1,2,3,4,5,6,7,8,9,10);

涓庝互寰鐨MySQL绨囩増鏈浉姣旓紝璇ユ煡璇㈢殑鎵ц閫熷害蹇23鍊嶏紝鍘熷洜鍦ㄤ簬锛屽叏閮10涓 閿煡鎵炬槸鍦1涓壒娆′腑鍙戝嚭鐨勶紝鑰屼笉鏄竴娆″彂閫佷竴涓

         闄愬埗鍏冩暟鎹璞$殑鏁扮洰锛MySQL 4.1涓紝姣忎釜绨囨暟鎹簱鏈澶氬彲鑳藉寘鍚1600涓厓鏁版嵁瀵硅薄锛屽寘鎷暟鎹簱琛紝绯荤粺琛紝绱㈠紩鍜BLOB銆傚湪MySQL 5.0涓紝鎴戜滑甯屾湜灏嗚鏁板煎鍔犲埌20320銆傛垜浠墦绠楀湪2005骞村勾涓彂甯冪殑MySQL 5.0.6 beta鐗堜腑瀹炵幇璇ュ寮虹壒鎬с

17.9.2. 鍏充簬MySQL绨囩殑MySQL 5.1鍙戝睍鍘嗙▼

杩欓噷鎵浠嬬粛鐨勫唴瀹规槸涓浠界姸鎬佹姤鍛婏紝瀹冨熀浜庢渶杩戞彁浜ゅ埌MySQL 5.1婧愮爜鏍戠殑鍐呭銆傝娉ㄦ剰锛屾墍鏈夌殑5.1寮鍙戞椿鍔ㄥ潎鍙兘闅忔椂鍙樺寲銆

鐩墠锛屾湁鍥涚涓MySQL 5.1寮鍙戠殑涓昏鏂扮壒鎬э細

1.    MySQL绨囬泦鎴愬埌浜MySQL澶嶅埗涓細杩欐牱锛屽氨鑳戒粠绨囦腑鐨勪换浣MySQL鏈嶅姟鍣ㄦ墽琛屾洿鏂帮紝骞剁敱绨囦腑鐨1MySQL鏈嶅姟鍣ㄥ鐞MySQL澶嶅埗锛屽苟淇濇寔浜嗕粠鏈嶅姟鍣ㄧ瀹夎鐨勪竴鑷存с

2.    鏀寔鍩轰簬纾佺洏鐨勮褰曪細灏嗘敮鎸佺鐩樹笂鐨勮褰曘傚浜庡寘鍚富閿搱甯岀储寮曠殑鏈夌储寮曞瓧娈碉紝蹇呴』浠嶄繚瀛樺湪RAM涓紝浣嗗彲浠ュ皢鎵鏈夊叾浠栧瓧娈典繚瀛樺湪纾佺洏涓娿

3.    澶у皬鍙彉鐨勮褰曪細瀹氫箟涓VARCHAR(255)鐨勫垪鐩墠浣跨敤260瀛楄妭鐨勫瓨鍌ㄧ┖闂达紝涓庝换浣曠壒瀹氳褰曚腑淇濆瓨鐨勫唴瀹规棤鍏炽MySQL 5.1绨囪〃涓紝鍙繚瀛樿璁板綍瀹為檯鍗犵敤鐨勫瓧娈甸儴鍒嗐傝繖鏍凤紝鍦ㄥ緢澶氭儏鍐典笅锛岃兘澶熷皢杩欑被鍒楃殑绌洪棿闇姹傞噺闄嶄綆5鍊嶃

4.    鐢ㄦ埛瀹氫箟鐨勫垎鍖哄姛鑳斤細鐢ㄦ埛鑳藉鏍规嵁涓诲叧閿殑瀛楁閮ㄥ垎瀹氫箟鍒嗗尯銆MySQL鏈嶅姟鍣ㄨ兘澶熷彂鐜版槸鍚﹁兘灏嗘煇浜涘垎鍖轰粠WHERE瀛愬彞涓垹闄ゃ傝兘澶熸牴鎹KEYHASHRANGELIST澶勭悊绋嬪簭鎵ц鍒嗗尯鎿嶄綔鍜屽瓙鍒嗗尯鎿嶄綔銆傚浜庡緢澶氬叾浠栧鐞嗙▼搴忥紝涔熷簲鑳戒娇鐢ㄨ鐗规с

姝ゅ锛屽浜庣皣琛ㄤ腑鍖呭惈闄BLOBTEXT澶栫殑鍒楃被鍨嬬殑琛岋紝鎴戜滑姝e噯澶囧澶8K鐨勫ぇ灏忛檺鍒跺笺傝繖鏄洜涓猴紝琛岀洰鍓嶅叿鏈夊浐瀹氱殑澶у皬锛岄〉澶у皬涓32768瀛楄妭锛堝噺鍘荤敤浜庤鏍囬鐨128瀛楄妭锛夈傚湪鐩墠锛岃繖鎰忓懗鐫锛屽鏋滃厑璁告瘡璁板綍鍗犵敤鐨勫ぇ灏忚秴杩8K锛屽墿浣欑殑绌洪棿灏嗕负绌猴紙澶氳揪14000瀛楄妭锛夈傚湪MySQL 5.1涓紝鎴戜滑鎵撶畻鏇存璇ラ檺鍒讹紝浠庤屼娇寰楀湪缁欏畾琛屼腑浣跨敤8K浠ヤ笂鐨勭┖闂翠笉浼氬鑷撮〉鍓╀綑閮ㄥ垎鐨勬氮璐广

17.10.聽MySQL绨囧父瑙侀棶棰樿В绛

         浣跨敤绨囦笌浣跨敤澶嶅埗鐨勫尯鍒槸浠涔堬紵

鍦ㄥ鍒惰缃腑锛屼富MySQL鏈嶅姟鍣ㄨ礋璐f洿鏂1涓垨澶氫釜浠庢湇鍔″櫒銆備簨鍔℃寜椤哄簭鎻愪氦锛岃緝鎱㈢殑浜嬪姟浼氬鑷翠粠鏈嶅姟鍣ㄦ粸鍚庝簬涓绘湇鍔″櫒銆傝繖鎰忓懗鐫锛屽鏋滀富鏈嶅姟鍣ㄥけ璐ワ紝浠庢湇鍔″櫒鍙兘鏃犳硶璁板綍鏈杩戠殑灏戞暟浜嬪姟銆傚鏋滀娇鐢ㄤ簡浜嬪姟瀹夊叏寮曟搸锛屽InnoDB锛岃鏈槸鍦ㄤ粠鏈嶅姟鍣ㄤ笂瀹屾垚浜嬪姟锛岃鏈槸鏍规湰灏变笉璁板綍浜嬪姟锛屼絾澶嶅埗涓嶄繚璇佷富鏈嶅姟鍣ㄥ拰浠庢湇鍔″櫒涓婄殑鎵鏈夋暟鎹湪浠讳綍鏃跺欓兘鏄竴鑷寸殑銆傚湪MySQL绨囦腑锛屾墍鏈夌殑鏁版嵁鑺傜偣淇濇寔鍚屾锛屼换浣曚竴涓暟鎹妭鐐规彁浜ょ殑浜嬪姟灏嗚鎻愪氦缁欐墍鏈夌殑鏁版嵁鑺傜偣銆傚綋鏌愪竴鏁版嵁鑺傜偣澶辫触鏃讹紝鎵鏈夊墿浣欑殑鏁版嵁鑺傜偣浠嶈兘淇濇寔涓鑷寸殑鐘舵併

绠鑰岃█涔嬶紝灏界鏍囧噯鐨MySQL澶嶅埗鏄紓姝ョ殑锛屼絾MySQL绨囨槸鍚屾鐨勩

鎴戜滑璁″垝鍦MySQL 5.1涓负绨囧疄鐜帮紙寮傛锛夊鍒跺姛鑳姐傚寘鎷湪涓や釜绨囦箣闂达紝浠ュ強MySQL绨囧拰闈炵皣绫MySQL鏈嶅姟鍣ㄤ箣闂寸殑澶嶅埗鑳藉姏銆

         涓轰簡杩愯绨囷紝鎴戞槸鍚﹂渶瑕佽繘琛岀壒娈婄殑缁勭綉鍛紵锛堢皣涓殑璁$畻鏈烘槸濡備綍閫氫俊鐨勶紵锛

MySQL绨囨槸涓洪珮甯﹀鐜涓嬬殑浣跨敤鑰岃璁$殑锛岃绠楁満閫氳繃TCP/IP鐩歌繛銆傚叾鎬ц兘鐩存帴鍙栧喅浜庣皣璁$畻鏈轰箣闂寸殑杩炴帴閫熷害銆傚浜庣皣锛屾渶浣庤繛鎺ヨ姹傚寘鎷細鍏稿瀷鐨100MB浠ュお缃戠綉缁滄垨绛夋晥缃戠粶銆傚鏋滃彲鑳斤紝寤鸿浣跨敤GB浠ュお缃戙

涔熸敮鎸佹洿蹇殑SCI 鍗忚锛屼絾闇瑕佺壒娈婄‖浠躲傚叧浜SCI鐨勬洿澶氫俊鎭紝璇峰弬瑙17.7鑺傦紝鈥滀娇鐢ㄤ笌MySQL绨囩殑楂橀熶簰杩炩

         杩愯绨囬渶瑕佸灏戝彴璁$畻鏈猴紵涓轰粈涔堬紵

瑕佹兂杩愯鍙鐨勭皣锛屾渶灏戦渶瑕3鍙拌绠楁満銆備絾鍦MySQL绨囦腑锛屾帹鑽愮殑鏈浣庤绠楁満鏁扮洰涓41鍙拌礋璐h繍琛岀鐞嗚妭鐐癸紝1鍙拌礋璐h繍琛SQL鑺傜偣锛2鍙扮敤浣滃瓨鍌ㄨ妭鐐广備娇鐢2涓暟鎹妭鐐圭殑鐩殑鏄负浜嗘彁渚涘啑浣欐э紝绠$悊鑺傜偣蹇呴』杩愯鍦ㄥ崟鐙殑鏈哄櫒涓婏紝杩欐牱锛屽綋1涓暟鎹妭鐐瑰け璐ユ椂锛屼粛鑳戒繚璇佽繛缁殑浠茶鏈嶅姟銆

         绨囦腑涓嶅悓璁$畻鏈烘墍璐熻矗鐨勪换鍔℃槸浠涔堬紵

MySQL绨囧寘鍚墿鐞嗗拰閫昏緫缁撴瀯锛岃绠楁満鏄叾鐗╃悊閮ㄤ欢銆傜皣鐨勯昏緫鎴栧姛鑳介儴浠剁О涓鸿妭鐐癸紝瀹圭撼绨囪妭鐐圭殑璁$畻鏈烘湁鏃朵篃绉颁负绨囦富鏈恒傚湪鐞嗘兂鎯呭喌涓嬶紝姣忓彴绨囦富鏈哄皢鏈1涓妭鐐癸紝浣嗗湪鍗曚釜绨囦富鏈轰笂鍙繍琛屽涓妭鐐广傜皣涓湁涓夌鑺傜偣锛屾瘡涓绉嶈妭鐐瑰潎瀵瑰簲鐗瑰畾鐨勮鑹层傚畠浠槸锛

1.    绠$悊鑺傜偣锛MGM鑺傜偣锛夛細涓烘暣涓皣鎻愪緵绠$悊鏈嶅姟锛屽寘鎷惎鍔ㄣ佸仠姝€佸浠姐佷互鍙婁负鍏朵粬鑺傜偣閰嶇疆鏁版嵁銆傜鐞嗚妭鐐规湇鍔″櫒鏄綔涓哄簲鐢ㄧ▼搴ndb_mgmd瀹炵幇鐨勶紝鐢ㄤ簬閫氳繃MGM鑺傜偣鎺у埗MySQL绨囩殑绠$悊瀹㈡埛绔槸ndb_mgm

2.    鏁版嵁鑺傜偣锛淇濆瓨鍜屽鍒舵暟鎹傛暟鎹妭鐐圭殑鍔熻兘鐢NDB鏁版嵁鑺傜偣杩涚▼ndbd鐨勫疄渚嬭礋璐e鐞嗐

3.    SQL鑺傜偣锛杩欐槸鐢ㄢ--ndb-cluster鈥濋夐」鍚姩鐨MySQL鏈嶅姟鍣紙mysqld锛夌殑涓涓疄渚嬨

         鐢ㄤ粈涔堟搷浣滅郴缁熸墠鑳戒娇鐢ㄧ皣鍛紵

MySQL 5.1涓紝鍦LinuxMac OS XSolaris骞冲彴涓婂潎姝e紡鏀寔MySQL绨囥傛垜浠鍦ㄥ姫鍔涗负鍏朵粬骞冲彴澧炲姞绨囨敮鎸侊紝鍖呮嫭Windows锛屾垜浠殑鐩爣鏄紝鏈缁堝湪鏀寔MySQL鏈韩鐨勬墍鏈夊钩鍙颁笂瀹炵幇MySQL绨囥

鍦ㄥ叾浠栨搷浣滅郴缁熶笂杩愯绨囦篃鏄彲鑳界殑銆傜敤鎴峰憡璇夋垜浠紝浠栦滑鍦FreeBSD骞冲彴涓婅秴杩囪繍琛屼簡绨囥備絾鏄紝闄や簡鍓嶉潰浠嬬粛鐨勪笁绉嶆搷浣滅郴缁熷锛屽湪鍏朵粬骞冲彴涓婅繍琛岀殑绨囧簲琚涓alpha杞欢锛堟渶濂芥儏鍐碉級锛屼笉淇濊瘉鍦ㄧ敓浜х幆澧冧笅鐨勫彲闈犳э紝鑰屼笖涓嶈MySQL AB鏀寔

         杩愯MySQL绨囩殑纭欢瑕佹眰鏄粈涔堬紵

鍦ㄧ皣杩愯鐨勪换浣曞钩鍙颁笂锛屽簲鍏锋湁鍏峰NDB鍔熻兘鐨勪簩杩涘埗鏂囦欢銆傛樉鑰屾槗瑙侊紝鏇村揩鐨CPU鍜屾洿澶氱殑鍐呭瓨鑳藉鏀瑰杽鎬ц兘锛64CPU鐨勬晥鐜囧緢鍙兘楂樹簬32浣嶅鐞嗗櫒銆傚湪鐢ㄤ簬鏁版嵁鑺傜偣鐨勬満鍣ㄤ笂蹇呴』鏈夎冻澶熺殑鍐呭瓨锛屼互渚垮绾冲悇鑺傜偣鍏变韩鐨勬暟鎹簱閮ㄥ垎銆傦紙鏇村淇℃伅锛岃鍙傝鎴戦渶瑕佸灏戝唴瀛橈紵锛夈傝妭鐐硅兘閫氳繃鏍囧噯鐨TCP/IP缃戠粶鍜岀‖浠惰繘琛岄氫俊銆傚浜SCI鏀寔锛岄渶瑕佺壒娈婄殑缁勭綉纭欢銆

         鐢变簬MySQL绨囦娇鐢ㄤ簡TCP/IP锛岃繖鏄惁鎰忓懗鐫鎴戣兘鍦Internet涓婅繍琛1涓垨澶氫釜鑺傜偣浣嶄簬杩滅▼浣嶇疆鐨勭皣锛

璇疯浣忥紝鍦MySQL绨囦腑锛岃妭鐐归棿鐨勯氫俊骞朵笉瀹夊叏锛岃繖鐐规瀬鍏堕噸瑕侊紝杩欑被閫氫俊鏈姞瀵嗭紝涔熸湭閲囩敤浠讳綍闃叉姢鏈哄埗銆傚浜庣皣锛屾渶瀹夊叏鐨勯厤缃槸浣嶄簬闃茬伀澧欏悗鐨勪笓鐢ㄧ綉缁滐紝涓嶈兘浠庡閮ㄧ洿鎺ヨ闂换浣曠皣鏁版嵁鎴栫鐞嗚妭鐐癸紙瀵逛簬SQL鑺傜偣锛屽簲閲囧彇鐩稿悓鐨勯槻鎶ゆ帾鏂斤紝灏卞儚鍦MySQL鏈嶅姟鍣ㄧ殑鍏朵粬瀹炰緥涓偅鏍凤級銆

鏃犺鏄换浣曟儏鍐碉紝鍦ㄨ繖绫绘潯浠朵笅绨囩殑鍙潬杩愯鍗佸垎浠や汉鎬鐤戯紝杩欐槸鍥犱负璁捐鍜屽疄鏂MySQL绨囨椂锛屽亣瀹氬畠杩愯鍦ㄨ兘淇濊瘉涓撶敤楂橀熻繛閫氭х殑鏉′欢涓嬶紝濡備娇鐢100MBGB浠ュお缃戠殑LAN涓紙鏇村惧悜浜庡悗鑰咃級銆傚浜庝綆浜庤瑕佹眰鐨勪换浣曠幆澧冿紝鎴戜滑鏈綔浠讳綍娴嬭瘯锛屼篃涓嶄繚璇佸叾鎬ц兘銆

         瑕佹兂浣跨敤绨囷紝鎴戞槸鍚︿笉寰椾笉瀛︿範鏂扮殑缂栫▼璇█鎴栨煡璇㈣瑷锛

涓嶃傚敖绠′娇鐢ㄤ簡涓浜涗笓鐢ㄥ懡浠ゆ潵绠$悊鍜岄厤缃皣鏈韩锛屼絾瀵逛簬涓嬭堪鎿嶄綔锛屼粎闇瑕佹爣鍑嗙殑(My)SQL鏌ヨ鍜屽懡浠わ細

o        鍒涘缓銆佹洿鏀瑰拰鎾ら攢琛ㄣ

o        鎻掑叆銆佹洿鏂板拰鍒犻櫎琛ㄦ暟鎹

o        鍒涘缓銆佹洿鏀瑰拰鎾ら攢涓荤储寮曞拰鍞竴绱㈠紩銆

o        閰嶇疆鍜岀鐞SQL鑺傜偣锛MySQL鏈嶅姟鍣級銆

         浣跨敤绨囨椂锛屽浣曚簡瑙i敊璇垨璀﹀憡娑堟伅鐨勫惈涔夊憿锛

鏈変袱绉嶅畬鎴愬畠鐨勬柟寮忥細

1.    鍑虹幇閿欒鎴栧憡璀︾姸鍐垫椂锛屽湪MySQL鐩戣鍣ㄥ唴锛岀珛鍒讳娇鐢SHOW ERRORSSHOW WARNINGS銆備篃鑳藉湪MySQL Query Browser锛堟煡璇㈡祻瑙堝櫒锛変腑鏄剧ず瀹冧滑銆

2.    鍦ㄧ郴缁shell鎻愮ず绗︿笅锛屼娇鐢perror --ndb error_code

         MySQL绨囨槸浜嬪姟瀹夊叏鐨勫悧锛熸敮鎸佷粈涔堥殧绂荤骇鍒紵

銆傚浜庣敤NDB瀛樺偍寮曟搸鍒涘缓鐨勮〃锛屾敮鎸佷簨鍔°MySQL 5.1涓紝绨囦粎鏀寔READ_COMMITTED浜嬪姟闅旂绾у埆銆

         绨囨敮鎸佺殑琛ㄧ被鍨嬫槸浠涔堬紵

NDB鏄粎鏈夌殑鏀寔绨囧姛鑳界殑MySQL瀛樺偍寮曟搸銆

锛堣兘澶熶娇鐢ㄥ叾浠栧瓨鍌ㄥ紩鎿庡湪鐢ㄤ簬绨囩殑MySQL鏈嶅姟鍣ㄤ笂鍒涘缓琛紝濡MyISAMInnoDB锛屼絾杩欑被闈NDB琛ㄤ笉鍦ㄧ皣涓锛夈

         NDB鈥濈殑鍚箟鏄粈涔堬紵

瀹冩槸鈥Network Database鈥濓紙缃戠粶鏁版嵁搴擄級鐨勭缉鍐欍

         鍝簺鐗堟湰鐨MySQL杞欢鏀寔绨囷紵鎴戝繀椤讳粠婧愮爜缂栬瘧鍚楋紵

5.1绯诲垪鐨勬墍鏈MySQL-max浜岃繘鍒剁増鏈腑鍧囨敮鎸佺皣锛屼絾涓嬮潰浠嬬粛鐨勯櫎澶栥備娇鐢ㄥ懡浠SHOW VARIABLES LIKE 'have_%';SHOW ENGINES;锛屽彲妫鏌ヤ綘鐨勬湇鍔″櫒鏄惁鏀寔NDB锛堟洿澶氫俊鎭紝璇峰弬瑙5.1.2鑺傦紝鈥渕ysqld-max鎵╁睍MySQL鏈嶅姟鍣ㄢ锛夈

Linux鐢ㄦ埛璇锋敞鎰忥紝NDB鏈寘鍚湪鏍囧噯鐨MySQL鏈嶅姟鍣RPM涓傚浜NDB瀛樺偍寮曟搸浠ュ強鎵闄勭殑绠$悊宸ュ叿鍜屽叾浠栧伐鍏凤紝鏈夊崟鐙殑RPM杞欢鍖呫傝鍙傝MySQL 5.1涓嬭浇椤典笂鐨NDB RPM涓嬭浇閮ㄥ垎锛堜互鍓嶏紝浣犲繀椤讳娇鐢ㄤ互.tar.gz妗f鏂瑰紡鎻愪緵鐨鈥-max鈥浜岃繘鍒舵枃浠躲傜洰鍓嶄粛鑳借繖鏍凤紝浣嗗嵈涓嶆槸蹇呴』鐨勶紝濡傛灉鎰挎剰锛屽彲浣跨敤Linux鍒嗗彂鐗堢殑RPM绠$悊鍣級銆傞氳繃浠庢簮鐮佺紪璇-max浜岃繘鍒舵枃浠讹紝涔熻兘鑾峰緱NDB鏀寔锛屼絾浣跨敤MySQL绨囨椂锛屼笉闇瑕佽繖鏍枫傝鎯冲彧涓嬭浇鏈鏂扮殑MySQL 5.1绯诲垪鐨勪簩杩涘埗鐗堟湰銆RPM銆佹垨婧愮爜鍒嗗彂鐗堬紝璇疯闂http://dev.mysql.com/downloads/mysql/5.1.html

         鎴戦渶瑕佸灏RAM锛熸槸鍚﹁兘鍏ㄩ儴浣跨敤纾佺洏鍐呭瓨锛

鍦ㄧ洰鍓嶏紝绨囨槸浠呪滃唴瀛樹腑鈥濈殑銆傝繖鎰忓懗鐫鎵鏈夌殑琛ㄦ暟鎹紙鍖呮嫭绱㈠紩锛夊潎淇濆瓨鍦RAM涓傚洜姝わ紝濡傛灉浣犵殑鏁版嵁鍗犵敤浜1GB鐨勭┖闂达紝鑰屼笖鎵撶畻鍦ㄧ皣涓皢瀹冨鍒1娆★紝闇瑕2GB鐨勫唴瀛樸傝繕搴斿姞涓婃搷浣滅郴缁熶互鍙婂湪绨囪绠楁満涓婅繍琛岀殑搴旂敤绋嬪簭鎵闇鐨勫唴瀛樸

鍙互浣跨敤涓嬭堪鍏徃绮楃暐浼拌绨囦腑姣忎釜鏁版嵁鑺傜偣鎵闇鐨RAM閲忥細

(SizeofDatabase * NumberOfReplicas * 1.1 ) / NumberOfDataNodes

瑕佹兂鏇村噯纭湴璁$畻鍐呭瓨闇姹傞噺锛岄渶瑕佷负绨囨暟鎹簱涓殑姣忎釜琛ㄧ‘瀹氭瘡琛屾墍闇鐨勫瓨鍌ㄧ┖闂达紙璇︽儏璇峰弬瑙11.5鑺傦紝鈥滃垪绫诲瀷瀛樺偍闇姹傗锛夛紝鐒跺悗涔樹互鍗犺鏁般傝繕蹇呴』瀵瑰垪绱㈠紩杩涜璁$畻锛屾柟寮忓涓嬶細

o        瀵逛簬涓NDB绨囪〃鍒涘缓鐨勬瘡涓富閿储寮曟垨鍝堝笇绱㈠紩锛屾瘡璁板綍闇瑕21-25瀛楄妭銆傝繖绫荤储寮曚娇鐢IndexMemory锛堢储寮曞唴瀛橈級銆

o        姣忎釜鏈夊簭绱㈠紩姣忚褰曢渶瑕10瀛楄妭鐨勫瓨鍌ㄧ┖闂达紝浣跨敤DataMemory锛堟暟鎹唴瀛橈級銆

o        鍒涘缓涓婚敭鎴栧敮涓绱㈠紩鏃讹紝杩樹細鍒涘缓1涓湁搴忕储寮曪紝闄ら潪璇ョ储寮曟槸浣跨敤USING HASH鍒涘缓鐨勩傛崲鍙ヨ瘽璁诧紝濡傛灉鏈娇鐢USING HASH鍒涘缓瀹冧滑锛屽浜绨囪〃涓婄殑姣忎釜閿鍥犳垨鍞竴绱㈠紩锛屽湪MySQL 5.1涓紝姣忚褰曞崰鐢31-35瀛楄妭銆

娉ㄦ剰锛屼娇鐢USING HASH涓烘墍鏈変富閿拰鍞竴绱㈠紩鍒涘缓MySQL绨囪〃鏃讹紝閫氬父杩樿兘浣胯〃鐨勬洿鏂伴熷害鏇村揩銆傝繖鏄洜涓猴紝瀹冮渶瑕佽緝灏戠殑鍐呭瓨锛堝洜鏈垱寤烘湁搴忕储寮曪級锛屽CPU鐨勫崰鐢ㄤ篃杈冧綆锛堜粎闇璇诲彇鎴栨洿鏂拌緝灏戠殑绱㈠紩锛夈

璇疯浣忥紝鎵鏈夌殑MySQL绨囪〃蹇呴』鏈変富閿紝杩欑偣鏋佸叾閲嶈銆傚鏋滄湭瀹氫箟锛NDB瀛樺偍寮曟搸灏嗚嚜鍔ㄥ垱寤轰富閿紝鑰屼笖璇ヤ富閿槸鍦ㄦ湭浣跨敤USING HASH鐨勬潯浠朵笅鍒涘缓鐨勩

寰堥毦鍑嗙‘纭畾绨囩储寮曞湪浠讳綍缁欏畾鏃堕棿鐢ㄤ簬瀛樺偍鐨勫唴瀛橀噺锛屼絾鏄紝褰撳彲鐢DataMemory/IndexMemory鐨勪娇鐢ㄧ巼鍒拌揪80锛呮椂锛屼細灏嗚鍛婃秷鎭啓鍏ョ皣鏃ュ織锛屽埌杈80锛呫90锛呯瓑鏃讹紝涔熶細鍐欏叆绨囨棩蹇椼

鎴戜滑缁忓父閬囧埌鐢ㄦ埛閫氭姤鐨勪笅杩伴棶棰橈紝褰撲粬浠鍥惧~鍏呯皣鏁版嵁搴撴椂锛屽姞杞借繘绋嬫彁鍓嶇粓姝紝骞舵樉绀轰笅杩伴敊璇秷鎭細

閿欒1114锛氳〃'my_cluster_table'宸叉弧銆

鍑虹幇璇ユ儏鍐垫椂锛屽緢鍙兘鏄洜涓哄湪浣犵殑璁剧疆涓湭涓烘墍鏈夌殑琛ㄦ暟鎹拰绱㈠紩鎻愪緵瓒冲鐨RAM鍖呮嫭NDB瀛樺偍寮曟搸鎵闇鐨勪富閿紝浠ュ強琛ㄥ畾涔変腑涓嶅寘鍚富閿畾涔夋椂鑷姩鍒涘缓鐨勪富閿

姝ゅ杩樺簲娉ㄦ剰锛屾墍鏈夌殑鏁版嵁鑺傜偣搴斿叿鏈夌浉鍚岀殑RAM閲忥紝杩欐槸鍥犱负锛岀皣涓换浣曟暟鎹妭鐐规墍鑳戒娇鐢ㄧ殑鍐呭瓨鍧囦笉瓒呰繃浠绘剰鍗曠嫭鏁版嵁鑺傜偣鐨勬渶浣庡彲鐢ㄥ唴瀛樸傛崲鍙ヨ瘽璁诧紝濡傛灉鏈変笁鍙拌繍琛岀皣鏁版嵁鑺傜偣鐨勮绠楁満锛屽湪鍏朵腑涓ゅ彴璁$畻鏈轰笂锛屾湁3GB鐢ㄤ簬淇濆瓨绨囨暟鎹殑RAM锛屽彟涓鍙拌绠楁満鍙湁1GB RAM锛岄偅涔堟瘡涓暟鎹妭鐐逛粎鑳戒负绨囪础鐚1GB

         鍑虹幇鐏鹃毦鎬ф晠闅滄椂锛屼緥濡傛暣涓煄甯傛柇鐢佃屼笖鎴戠殑UPS涔熷嚭鐜版晠闅滐紝鎴戜細涓㈠け鎵鏈夌殑鏁版嵁鍚楋紵

鎵鏈夊凡鎻愪氦鐨勪簨鍔″皢琚褰曘傚洜姝わ紝鍦ㄥ嚭鐜扮伨闅剧殑鎯呭喌涓嬶紝鏌愪簺鏁版嵁鍙兘浼氫涪澶憋紝浣嗙浉褰撴湁闄愩傞氳繃鍑忓皯姣忎簨鍔$殑鎿嶄綔鏁帮紝鑳藉杩涗竴姝ュ噺灏戞暟鎹崯澶憋紙鍦ㄤ换浣曟儏褰笅锛屽湪姣忎簨鍔′笂鎵ц澶ч噺鎿嶄綔閮戒笉鏄竴涓ソ涓绘剰锛夈

         鑳藉涓庣皣涓璧蜂娇鐢FULLTEXT绱㈠紩鍚楋紵

FULLTEXT绱㈠紩鍔熻兘鐩墠涓嶈NDB瀛樺偍寮曟搸鏀寔锛屼篃涓嶈闄MyISAM涔嬪鐨勪换浣曞瓨鍌ㄥ紩鎿庢敮鎸併傛垜浠墦绠楀湪鏈潵鐨勭増鏈腑澧炲姞璇ュ姛鑳姐

         鎴戣兘鍦ㄤ竴鍙拌绠楁満涓婅繍琛屽涓妭鐐瑰悧锛

鍙互锛屼絾涓嶅缓璁繖鏍枫傝繍琛岀皣鐨勪富瑕佸師鍥犱箣涓鏄彁渚涘啑浣欙紝涓轰簡鑾峰緱鍐椾綑鎬х殑鍏ㄩ儴浼樼偣锛屾瘡涓妭鐐瑰簲浣嶄簬鍗曠嫭鐨勮绠楁満涓娿傚鏋滃皢澶氫釜鑺傜偣缃簬鍚屼竴鍙版満鍣紝褰撹鏈哄櫒鍑虹幇鏁呴殰鏃讹紝鎵鏈夎妭鐐瑰潎灏嗕涪澶便傝冭檻鍒MySQL绨囪兘杩愯鍦ㄥ父瑙佺殑纭欢涓婂苟鍒╃敤寤変环鐨勬搷浣滅郴缁燂紙鎴栦笉闇璐圭敤锛夛紝涓轰簡纭繚浠诲姟鍏抽敭鍨嬫暟鎹殑瀹夊叏锛屽煎緱涓洪澶栫殑鏈哄櫒鎴疯姳璐瑰紑閿銆傛澶栬繕椤绘敞鎰忥紝瀵硅繍琛岀鐞嗚妭鐐圭殑绨囦富鏈虹殑瑕佹眰鏈浣庯紝浣跨敤200 MHz Pentium CPU锛屾搷浣滅郴缁熸墍闇鐨勮冻澶RAM锛屼互鍙婄敤浜ndb_mgmdndb_mgm杩涚▼鐨勫皯閲忓紑閿锛屽氨鑳藉畬鎴愯浠诲姟銆

         鎴戣兘鍦ㄤ笉閲嶅惎鐨勬儏鍐典笅涓虹皣澧炲姞鑺傜偣鍚楋紵

鐩墠涓嶈銆傚浜庡湪绨囦腑娣诲姞鏂扮殑MGMSQL鑺傜偣鏉ヨ锛岀畝鍗曠殑閲嶅惎灏辨槸鎵闇鐨勪竴鍒囥傛坊鍔犳暟鎹妭鐐规椂锛岃繘绋嬬暐寰鏉備簺锛岄渶瑕侀噰鍙栦笅杩版楠わ細

o        瀵规墍鏈夌皣鏁版嵁杩涜瀹屾暣澶囦唤銆

o        褰诲簳鍏抽棴绨囧拰鎵鏈夌殑绨囪妭鐐硅繘绋嬨

o        浣跨敤鈥鈥攊nitial鈥鍚姩閫夐」閲嶅惎绨囥

o        浠庡浠戒腑鎭㈠鎵鏈夌皣鏁版嵁銆

鍦ㄦ湭鏉ョ殑MySQL绨囩増鏈腑锛屾垜浠笇鏈涗负MySQL绨囧疄鐜扳滅儹鈥濋噸閰嶇疆鍔熻兘锛屼互渚胯兘澶熷皢娣诲姞鏂拌妭鐐规椂閲嶅惎绨囩殑瑕佹眰闄嶈嚦鏈浣庯紙濡傛灉涓嶈兘娑堥櫎鐨勮瘽锛夈

         浣跨敤绨囨椂鏈夐渶瑕佹垜浜嗚В鐨勯檺鍒跺悧锛

MySQL涓殑NDB琛ㄦ湇浠庝笅杩伴檺鍒讹細

o        骞堕潪鎵鏈夌殑瀛楃闆嗗拰鏍″鍧囪鏀寔銆

o        涓嶆敮鎸FULLTEXT绱㈠紩鍜屽墠缂绱㈠紩銆鍙兘涓哄畬鏁寸殑鍒楄缃储寮曘備笉鏀寔绗19绔狅細MySQL涓殑绌洪棿鎵╁睍涓粙缁嶇殑绌洪棿鎵╁睍銆

o        浠呮敮鎸佸浜嬪姟鐨勫畬鏁村洖婊氥備笉鏀寔閮ㄥ垎鍥炴粴浠ュ強鍥炴粴鑷充繚瀛樼偣銆

o        姣忚〃鍏佽鐨勬渶澶у睘鎬ф暟涓128锛岃屼笖灞炴у悕绉颁笉寰楄秴杩31涓瓧绗︺傚浜庢瘡涓〃锛岃〃鍜屾暟鎹簱鍚嶇О鐨勬渶澶х粍鍚堥暱搴︿负122涓瓧绗︺

o        琛ㄨ鐨勬渶澶уぇ灏忎负8KB锛屼笉鍖呮嫭BLOB銆傚浜庢瘡琛ㄤ腑鐨勮鏁版病鏈夐檺鍒讹紝琛ㄧ殑澶у皬闄愬埗鍙栧喅浜庡绉嶅洜绱狅紝灏ゅ叾鏄瘡涓暟鎹妭鐐瑰彲鐢ㄧ殑RAM閲忋

o        NDB寮曟搸涓嶆敮鎸佸閿害鏉熴傚氨鍍MyISAM琛ㄤ竴鏍凤紝杩欎簺绾︽潫灏嗚蹇界暐銆

o        涓嶆敮鎸佹煡璇㈤珮閫熺紦鍐插姛鑳姐

鍏充簬绨囬檺鍒剁殑鏇村淇℃伅锛岃鍙傝17.8鑺傦紝鈥淢ySQL绨囩殑宸茬煡闄愬埗鈥

         鎬庢牱灏嗗凡鏈夌殑MySQL鏁版嵁搴撳鍏ュ埌绨囦腑锛

鍙互灏嗘暟鎹簱瀵煎叆鍒MySQL绨囦腑锛屽氨鍍忕敤鍏朵粬鐗堟湰鐨MySQL閭f牱銆傞櫎浜嗗墠涓闂鎵鎻愬埌鐨勯檺鍒跺锛屼粎鏈夌殑鐗规畩瑕佹眰鏄紝鍑嗗鍖呭惈鍒扮皣涓殑浠讳綍琛ㄥ繀椤讳娇鐢NDB瀛樺偍寮曟搸銆傝繖鎰忓懗鐫锛岃〃蹇呴』鏄敤ENGINE=NDBENGINE=NDBCLUSTER鍒涘缓鐨勩備娇鐢ALTER TABLE锛岃兘澶熷皢浣跨敤鍏朵粬瀛樺偍寮曟搸鐨勭幇鏈夎〃杞崲涓NDB绨囪〃锛屼絾闇瑕侀噰鍙栭澶栭伩瑙勬帾鏂斤紝璇︽儏璇峰弬瑙17.8鑺傦紝鈥淢ySQL绨囩殑宸茬煡闄愬埗鈥

         绨囪妭鐐规槸鎬庢牱褰兼閫氫俊鐨勶紵

绨囪妭鐐硅兘澶熼氳繃涓嬭堪涓夌鍗忚涓殑浠讳綍涓绉嶈繘琛岄氫俊锛TCP/IPSHM锛堝叡浜唴瀛橈級鍜SCI锛堣妯″彲鎵╁睍鐨勮绠楁満杩炴帴鎺ュ彛锛夈傚湪閫傜敤鐨勫満鍚堬紝瀵逛簬浣嶄簬鐩稿悓绨囦富鏈轰笂鐨勮妭鐐归棿閫氫俊锛岄粯璁ゅ崗璁负SHMSCI鏄珮閫燂紙姣忕1GB鎴栨洿楂橈級銆侀珮鍙敤鎬у崗璁紝鐢ㄤ簬鍒涘缓鍙墿灞曠殑澶氬鐞嗗櫒绯荤粺锛屽畠闇瑕佺壒娈婄‖浠跺拰椹卞姩銆傚叧浜庝娇鐢SCI浣滀负绨囦腑浼犺緭鏈哄埗鐨勬洿澶氫俊鎭紝璇峰弬瑙17.7鑺傦紝鈥滀娇鐢ㄤ笌MySQL绨囩殑楂橀熶簰杩炩

         浠涔堟槸鈥arbitrator鈥濓紙浠茶绋嬪簭锛

濡傛灉绨囦腑鐨1涓垨澶氫釜鑺傜偣澶辫触锛屽苟闈炴墍鏈夌殑绨囪妭鐐瑰潎涓嶈兘褰兼鈥滅湅鍒扳濓紝杩欐槸鍙兘鐨勩備簨瀹炰笂锛岃兘澶熷湪缃戠粶鍒嗗尯涓皢涓や釜鑺傜偣闆嗗悎褰兼闅旂锛屼篃绉颁负鈥滃垎瑁傚ぇ鑴戔濄傝繖绫绘儏褰㈠苟涓嶅彈娆㈣繋锛岃繖鏄洜涓猴紝姣忎竴涓妭鐐归泦鍚堥兘璇曞浘琛ㄧ幇涓轰唬琛ㄦ暣涓皣銆

褰撶皣鑺傜偣鍑虹幇闂鏃讹紝鏈変袱绉嶅彲鑳芥с傚鏋滃墿浣欒妭鐐圭殑50锛呬互涓婅兘澶熷郊姝ら氫俊锛岄偅涔堣繖灏辨槸鎴戜滑鏈夋椂绉颁箣涓虹殑鈥滃鏁版敮閰嶁濇儏褰紝璇ヨ妭鐐归泦鍚堝皢琚涓虹皣銆傚綋鑺傜偣鏁板潎绛夋椂锛屼徊瑁佺▼搴忓皢浠嬪叆锛氬湪璇ユ儏褰笅锛屼徊瑁佺▼搴忔墍灞炵殑鑺傜偣闆嗗悎灏嗚褰撲綔绨囷紝涓嶅睘浜庤鑺傜偣闆嗗悎鐨勮妭鐐瑰皢琚叧闂

涓婅堪鎻忚堪鐣ヤ负绠鍖栵紝鏇村畬鏁寸殑瑙i噴闇瑕佽冭檻涓嬮潰浠嬬粛鐨勮妭鐐圭粍锛

褰撹嚦灏戜竴涓妭鐐圭粍涓殑鎵鏈夎妭鐐瑰潎鏈夋晥鏃讹紝缃戠粶鍒嗗尯涓嶆槸闂锛岃繖鏄洜涓猴紝绨囦腑鐨勪换涓涓儴鍒嗗潎涓嶈兘鏋勬垚1涓姛鑳芥х殑绨囥傚綋娌℃湁涓涓妭鐐圭粍鐨勬墍鏈夋垚鍛樺潎鏄湁鏁堢殑鏃讹紝闂浜х敓锛屽湪璇ユ儏鍐典笅锛岀綉缁滃垎鍖猴紙鈥滃垎瑁傚ぇ鑴戔濇儏褰級鎴愪负鍙兘銆傞殢鍚庡氨闇瑕佷徊瑁佺▼搴忋傛墍鏈夌殑绨囪妭鐐瑰皢鐩稿悓鐨勮妭鐐硅涓轰徊瑁佺▼搴忥紝閫氬父鏄鐞嗘湇鍔″櫒銆備絾鏄紝涔熻兘灏嗙皣涓殑浠讳綍MySQL鏈嶅姟鍣ㄩ厤缃负浠茶绋嬪簭銆備徊瑁佺▼搴忔帴鍙楃涓涓笌鍏舵帴瑙︾殑绨囪妭鐐归泦鍚堬紝骞堕氱煡鍓╀綑鐨勯泦鍚堝叧闂傚浜MySQL鏈嶅姟鍣ㄥ拰绠$悊鏈嶅姟鍣ㄨ妭鐐癸紝浠茶绋嬪簭鐨勯夋嫨鏄敱ArbitrationRank閰嶇疆鍙傛暟鎺у埗鐨锛堣鎯呰鍙傝17.4.4.4鑺傦紝鈥滃畾涔塎ySQL绨囩鐞嗘湇鍔″櫒鈥锛夈傛澶栬繕搴旀敞鎰忥紝浠茶绋嬪簭涓嶄細瀵规寚瀹氫富鏈烘柦鍔犺繃澶氱殑瑕佹眰锛屽洜姝わ紝浠茶绋嬪簭涓绘満涓嶉渶瑕佺壒鍒潡鎴栨嫢鏈夌敤浜庤鐩殑鐨勯澶栧唴瀛樸

         MySQL绨囨敮鎸佺殑鍒楃被鍨嬫槸浠涔堬紵

MySQL绨囨敮鎸佹墍鏈夐氬父鐨MySQL鍒楃被鍨嬶紝浣嗕笌MySQL绌洪棿鎵╁睍鏈夊叧鐨勪緥澶栵紙璇峰弬瑙绗19绔狅細MySQL涓殑绌洪棿鎵╁睍锛夈傛澶栵紝瀵逛簬绱㈠紩锛屽綋涓NDB琛ㄤ竴璧蜂娇鐢ㄦ椂瀛樺湪涓浜涘樊鍒娉ㄩ噴锛MySQL绨囪〃锛堝嵆鐢ENGINE=NDBCLUSTER鍒涘缓鐨勮〃锛浠呮湁鍥哄畾瀹藉害鍒椼傝繖鎰忓懗鐫锛堜緥濡傦級鍚湁VARCHAR(255)鍒楃殑姣忎竴鏉¤褰曢渶瑕256瀛楄妭鏉ヤ繚瀛樺垪锛屾棤璁哄垪涓繚瀛樼殑鏁版嵁澶у皬鏄灏戙傚湪鏈潵鐨MySQL鐗堟湰涓紝璁″垝鏇存瀹冦

鍏充簬杩欎簺鏂归潰鐨勬洿澶氫俊鎭紝璇峰弬瑙17.8鑺傦紝鈥淢ySQL绨囩殑宸茬煡闄愬埗鈥

         濡備綍鍚姩鍜屽仠姝MySQL绨囷紵

闇瑕佹寜鐓т笅杩伴『搴忓垎鍒惎鍔ㄧ皣涓殑姣忎釜鑺傜偣锛

1.    ndb_mgmd鍛戒护鍚姩绠$悊鑺傜偣銆

2.    ndbd鍛戒护鍚姩姣忎釜鏁版嵁鑺傜偣銆

3.    浣跨敤mysqld_safe --user=mysql &锛屽惎鍔ㄦ瘡涓MySQL鏈嶅姟鍣紙SQL鑺傜偣锛夈

瀵逛簬杩欑被鍛戒护涓殑姣忎竴涓紝蹇呴』鍦ㄥ彈褰卞搷鑺傜偣鎵鍦ㄦ満鍣ㄤ笂鐨勭郴缁shell涓墽琛屻傚湪瀹圭撼MGM鑺傜偣鐨勬満鍣ㄤ笂鍚姩绠$悊瀹㈡埛绔ndb_mgm锛屽彲楠岃瘉绨囨槸鍚︽鍦ㄨ繍琛屻

         褰撶皣鍏抽棴鏃讹紝浼氬绨囨暟鎹湁浠涔堝奖鍝嶏紵

鐢辩皣鏁版嵁鑺傜偣淇濆瓨鍦ㄥ唴瀛樹腑鐨勬暟鎹皢琚啓鍏ョ鐩橈紝骞跺湪涓嬩竴娆″惎鍔ㄧ皣鏃堕噸鏂拌鍏ュ唴瀛樸

瑕佹兂鍏抽棴绨囷紝璇峰湪MGM鑺傜偣鎵鍦ㄧ殑鏈哄櫒涓娿佸湪shell涓嬭緭鍏ヤ笅杩板懡浠わ細

shell> ndb_mgm -e shutdown

杩欐牱灏辫兘鎭板綋鍦颁腑姝ndb_mgmndb_mgm銆佷互鍙婁换浣ndbd杩涚▼銆傚浜庣敤浣滅皣SQL鑺傜偣鐨MySQL鏈嶅姟鍣紝鍙娇鐢mysqladmin shutdown鍋滄瀹冦

鏇村淇℃伅锛岃鍙傝17.6.2鑺傦紝鈥滅鐞嗗鎴风鈥濅腑鐨勫懡浠17.3.6鑺傦紝鈥滃畨鍏ㄥ叧闂拰閲嶅惎鈥

         绨囦腑鏈1涓互涓婄殑绠$悊鑺傜偣鏄惁鏈夌敤锛

瀵逛簬鍙潬鎬ф潵璇村畠纭湁甯姪銆傚湪浠讳綍缁欏畾鐨勬椂闂达紝浠呴渶1MGM鑺傜偣鏉ユ帶鍒剁皣锛屼絾鑳藉灏1MGM閰嶇疆涓轰富鑺傜偣锛屽苟閰嶇疆1涓垨澶氫釜棰濆鐨勭鐞嗚妭鐐癸紝浠ヤ究鍦ㄤ富MGM鑺傜偣鍑虹幇鏁呴殰鏃跺彇浠e畠銆

         鍦ㄧ皣涓兘娣峰悎浣跨敤涓嶅悓鐨勭‖浠跺拰鎿嶄綔绯荤粺鍚楋紵

鏄傚彧瑕佹墍鏈夌殑鏈哄櫒鍜屾搷浣滅郴缁熷潎鏄浉鍚岀殑endian銆備篃鑳藉湪涓嶅悓鐨勮妭鐐逛笂浣跨敤涓嶅悓鐨MySQL绨囩増鏈紝浣嗘槸锛屾垜浠缓璁粎搴斿皢鍏朵綔涓烘粴鍔ㄥ崌绾х殑涓閮ㄥ垎浣跨敤銆

         鎴戣兘鍦ㄥ崟鍙颁富鏈轰笂杩愯涓や釜鏁版嵁鑺傜偣鍚楋紵涓や釜SQL鑺傜偣锛

鏄紝鑳藉杩欐牱銆傚湪鏈夊涓暟鎹妭鐐圭殑鎯呭喌涓嬶紝姣忎釜鑺傜偣蹇呴』浣跨敤涓嶅悓鐨勬暟鎹洰褰曘傚鏋滄墦绠楀湪涓鍙版満鍣ㄤ笂杩愯澶氫釜SQL鑺傜偣锛岄偅涔堟瘡涓mysqld瀹炰緥蹇呴』浣跨敤涓嶅悓鐨TCP/IP绔彛銆

         鎴戣兘涓MySQL绨囦竴璧蜂娇鐢ㄤ富鏈哄悕鍚楋紵

鏄紝瀵逛簬绨囦富鏈猴紝鑳藉浣跨敤DNSDHCP銆備絾鏄紝濡傛灉浣犵殑搴旂敤绋嬪簭瑕佹眰鈥99.999锛呪濈殑鍙敤鎬э紝寤鸿浣跨敤鍥哄畾鐨IP鍦板潃銆傝繖鏄洜涓猴紝渚濊禆璇ユ湇鍔$殑绨囪妭鐐归棿鐨勯氫俊浼氬紩鍏ラ澶栫殑鏁呴殰鐐癸紝鏁呴殰鐐硅秺灏戣秺濂姐

17.11.聽MySQL绨囨湳璇〃

涓嬮潰缁欏嚭鐨勬湳璇鐞嗚ВMySQL绨囨湁鎵甯姪锛岃屼笖鍦ㄤ笌MySQL绨囦竴璧蜂娇鐢ㄦ椂鏈変竴瀹氱殑鐗规畩鍚箟銆

         绨囷細

鎸夌収閫氬父鐨勭悊瑙o紝绨囨槸涓涓绠楁満闆嗗悎锛屽叾鍔熻兘鐩稿綋浜1涓崟浣嶏紝涓璧峰伐浣滀互瀹屾垚鍗曚竴浠诲姟銆

NDB绨囷細

杩欐槸MySQL涓娇鐢ㄧ殑瀛樺偍寮曟搸锛岀敤浜庡疄鐜版暟鎹瓨鍌ㄣ佹绱€佷互鍙婂涓绠楁満闂村垎甯冨紡绠$悊銆

MySQL绨囷細

鎸囩殑鏄娇鐢NDB瀛樺偍寮曟搸涓璧峰伐浣滅殑涓缁勮绠楁満锛屼互渚垮湪浣跨敤鈥滃唴瀛樹腑鈥濆瓨鍌ㄧ殑闈炲叡浜綋绯荤粨鏋勪腑鏀寔鍒嗗竷寮MySQL鏁版嵁搴撱

         閰嶇疆鏂囦欢锛

鍖呭惈涓庣皣銆佸叾涓绘満鍜岃妭鐐规湁鍏崇殑鎸囦护鍜屼俊鎭殑鏂囨湰鏂囦欢銆傚綋绨囧惎鍔ㄦ椂锛岃繖绫绘枃浠剁敱绨囩殑绠$悊鑺傜偣璐熻矗璇诲彇銆傝鎯呰鍙傝17.4.4鑺傦紝鈥滈厤缃枃浠垛

         澶囦唤锛

鎵鏈夌皣鏁版嵁銆佷簨鍔″拰鏃ュ織鐨勫畬鏁存嫹璐濓紝淇濆瓨鍦ㄧ鐩樹笂鎴栧叾浠栭暱鏈熷瓨鍌ㄤ粙璐ㄤ笂銆

         鎭㈠锛

灏嗙皣杩斿洖浠ュ墠鐨勭姸鎬侊紝涓庝繚瀛樺湪澶囦唤涓殑鐩稿悓銆

         妫鏌ョ偣锛

浠庡箍涔変笂璁诧紝灏嗘暟鎹繚瀛樺埌纾佺洏鏃讹紝鍗宠揪鍒颁簡妫鏌ョ偣銆傚叿浣撳浜庣皣鏉ヨ锛屽畠鏄皢鎵鏈夊凡鎻愪氦浜嬪姟淇濆瓨鍒扮鐩樼殑鏃堕棿鐐广傚浜NDB瀛樺偍寮曟搸锛屾湁涓ょ涓璧峰伐浣滅殑妫鏌ョ偣锛屼互纭繚缁存姢绨囨暟鎹殑涓鑷存э細

o        鏈湴妫鏌ョ偣锛LCP锛夛細

杩欐槸涓撻棬閽堝鍗曚竴鑺傜偣鐨勬鏌ョ偣锛屼絾鏄紝LCP涔熶細鍦ㄧ皣涓殑鎵鏈夎妭鐐瑰彂鐢燂紝鍚屾鎬ф垨寮烘垨寮便LCP鍖呮嫭灏嗚妭鐐圭殑鎵鏈夋暟鎹繚瀛樺埌纾佺洏锛岄氬父姣忓嚑鍒嗛挓鍑虹幇涓娆°傚噯纭殑鏃堕棿闂撮殧浼氬嚭鐜板彉鍖栵紝鍏蜂綋鎯呭喌鍙栧喅浜庤妭鐐逛笂淇濆瓨鐨勬暟鎹噺锛岀皣娲诲姩鐨勭骇鍒紝浠ュ強鍏朵粬鍥犵礌銆

o        鍏ㄥ眬妫鏌ョ偣锛GCP锛夛細

GCP姣忔暟绉掑嚭鐜颁竴娆★紝姝ゆ椂锛屽皢瀵规墍鏈夎妭鐐圭殑浜嬪姟杩涜鍚屾鍖栧鐞嗭紝骞跺皢redo鏃ュ織淇濆瓨鍒扮鐩樸

         绨囦富鏈猴細

鏋勬垚MySQL绨囩粍鎴愰儴鍒嗙殑璁$畻鏈恒傜皣鍏锋湁鐗╃悊缁撴瀯鍜岄昏緫缁撴瀯銆備粠鐗╃悊鎰忎箟涓婅锛岀皣鐢卞涓绠楁満鏋勬垚锛岃繖浜涜绠楁満涔熺О涓虹皣涓绘満锛堟垨涓绘満锛夊彟璇峰弬瑙佷笅闈㈢殑鑺傜偣鑺傜偣缁

         鑺傜偣锛

瀹冩寚鐨勬槸MySQL绨囩殑閫昏緫鎴栧姛鑳芥у崟鍏冿紝鏈夋椂涔熺О涓虹皣鑺傜偣銆傚浜MySQL绨囷紝鎴戜滑浣跨敤鏈鈥滆妭鐐光濊〃绀鸿繘绋嬭屼笉鏄皣鐨勭墿鐞嗛儴浠躲傚疄鏂芥湁鏁堢殑MySQL绨囬渶瑕佷笁绉嶈妭鐐广傚畠浠槸锛

o        绠$悊锛MGM锛夎妭鐐癸細

璐熻矗绠$悊绨囦腑鐨勫叾浠栬妭鐐广傚畠涓哄叾浠栬妭鐐规彁渚涗簡閰嶇疆鏁版嵁锛岃礋璐e惎鍔ㄥ拰鍋滄鑺傜偣锛屽鐞嗙綉缁滃垎鍖轰簨瀹滐紝鍒涘缓澶囦唤鍜屼粠澶囦唤鎭㈠锛岀瓑绛夈

o        SQLMySQL鏈嶅姟鍣級鑺傜偣锛

MySQL鏈嶅姟鍣ㄧ殑瀹炰緥锛岀敤浣滅皣鏁版嵁鑺傜偣鎵淇濆瓨鏁版嵁鐨勫墠绔傛墦绠椾繚瀛樸佹绱㈡垨鏇存柊鏁版嵁鐨勫鎴风鍙闂SQL鑺傜偣锛屽氨鍍忚闂叾浠MySQL鏈嶅姟鍣ㄤ竴鏍凤紝閲囩敤閫氬父鐨勯壌瀹氭柟娉曞拰API锛岃妭鐐圭粍涔嬮棿鐨勫熀鏈暟鎹垎閰嶅鐢ㄦ埛鍜屽簲鐢ㄧ▼搴忔潵璇存槸閫忔槑鐨勩SQL鑺傜偣璁块棶浣滀负鏁翠綋鐨勭皣鏁版嵁搴擄紝鑰屼笉绠℃暟鎹湪涓嶅悓鏁版嵁鑺傜偣鎴栫皣涓绘満涓婄殑鍒嗗竷鎯呭喌銆

o        鏁版嵁鑺傜偣锛

杩欎簺鑺傜偣璐熻矗淇濆瓨瀹為檯鏁版嵁銆傝〃鏁版嵁鐗囨淇濆瓨鍦ㄨ妭鐐圭粍闆嗗悎涓紝姣忎釜鑺傜偣缁勪繚瀛樿〃鏁版嵁鐨勪笉鍚屽瓙闆嗐傛瀯鎴愯妭鐐圭粍鐨勬瘡涓妭鐐瑰潎淇濆瓨浜嗚鑺傜偣缁勬墍璐熻矗鐗囨鐨勫壇鏈傜洰鍓嶏紝1涓皣鑳芥敮鎸佹绘暟涓48鐨勬暟鎹妭鐐广

1涓互涓婄殑鑺傜偣鑳藉叡瀛樹簬鍗曞彴鏈哄櫒涓婏紙浜嬪疄涓婏紝鑳藉鍦ㄤ竴鍙版満鍣ㄤ笂璁剧疆瀹屾垚鐨勭皣锛屼絾鍦ㄧ敓浜х幆澧冧笅鍑犱箮娌′汉浼氳繖鏍峰仛锛夈傝璁颁綇锛屼娇鐢MySQL绨囨椂锛屾湳璇滀富鏈衡濇寚鐨勬槸绨囩殑鐗╃悊閮ㄤ欢锛岃屸滆妭鐐光濇寚鐨勬槸閫昏緫鎴栧姛鑳介儴浠讹紙鍗宠繘绋嬶級锛岃繖寰堟湁甯姪銆

鍏充簬杩囨椂鏈鐨勬敞閲婏細MySQL绨囨枃妗g殑鏃╂湡鐗堟湰涓紝鏁版嵁鑺傜偣鏈夋椂涔熺О涓衡滄暟鎹簱鑺傜偣鈥濄佲DB鑺傜偣鈥濄佹垨鍋跺皵浣跨敤鐨勨瀛樺偍鑺傜偣鈥濄傛澶栵紝SQL鑺傜偣鏈夋椂涔熺О涓衡滃鎴风鑺傜偣鈥濇垨鈥API鑺傜偣鈥濄備负浜嗗皢娣锋穯闄嶈嚦鏈浣庯紝杩欑被鏃╂湡鏈宸茶鏀惧純锛屼负姝わ紝搴旈伩鍏嶄娇鐢ㄥ畠浠

         鑺傜偣缁勶細

鏁版嵁鑺傜偣鐨勯泦鍚堛備綅浜庤妭鐐圭粍鍐呯殑鎵鏈夋暟鎹妭鐐瑰寘鍚浉鍚岀殑鏁版嵁锛堢墖娈碉級锛岃屼笖鍗曚釜缁勫唴鐨勬墍鏈夎妭鐐瑰簲浣嶄簬涓嶅悓鐨勪富鏈轰笂銆傝兘澶熷鍝釜鑺傜偣鏈鍝釜鑺傜偣缁勮繘琛屾帶鍒躲

         鑺傜偣澶辫触锛

MySQL绨囧苟涓嶄粎鍙栧喅浜庢瀯鎴愭瀯鎴愮皣鐨勪换涓鑺傜偣鐨勫姛鑳斤紝濡傛灉1涓垨澶氫釜鑺傜偣澶辫触锛岀皣浠嶈兘杩愯銆傜粰瀹氱皣鑳藉蹇嶇殑澶辫触鑺傜偣鐨勫噯纭暟鐩彇鍐充簬鑺傜偣鐨勬暟鐩拰绨囩殑閰嶇疆銆

         鑺傜偣閲嶅惎锛

閲嶅惎澶辫触绨囪妭鐐圭殑杩涚▼銆

         棣栨鑺傜偣閲嶅惎锛

涓嶄笌鍏舵枃浠剁郴缁熶竴璧峰惎鍔ㄧ皣鑺傜偣鐨勮繘绋嬨傛湁鏃剁敤浜庤蒋浠跺崌绾ф垨鍏朵粬鐗规畩鍦哄悎銆

         绯荤粺宕╂簝锛堟垨绯荤粺澶辫触锛夛細

褰撳緢澶氱皣鑺傜偣澶辫触骞舵棤娉曚繚璇佺皣鐨勭姸鎬佹椂锛屽氨浼氬嚭鐜拌鎯呭喌銆

         绯荤粺閲嶅惎锛

閲嶅惎绨囧苟鏍规嵁纾佺洏鏃ュ織鍜屾鏌ョ偣閲嶆柊鍒濆鍖栫皣鐘舵佺殑杩涚▼銆傚湪绨囩殑璁″垝鍏抽棴鎴栭潪璁″垝鍏抽棴鍚庯紝閫氬父闇瑕佹墽琛岃杩涚▼銆

         鐗囨锛

鏁版嵁搴撹〃鐨勪竴閮ㄥ垎锛屽湪NDB瀛樺偍寮曟搸涓紝灏嗚〃鍒嗕负浼楀鐗囨锛屽苟浠ョ墖娈垫柟寮忎繚瀛樸傜墖娈垫湁鏃朵篃绉颁负鈥滃垎鍖衡濓紝浣嗏滅墖娈碘濇槸鏇村彲鍙栫殑鏈銆傚湪MySQL绨囦腑锛屽琛ㄨ繘琛屼簡鐗囨鍖栧鐞嗭紝浠庤岀畝鍖栦簡鏈哄櫒鍜岃妭鐐归棿鐨勮礋杞藉钩琛°

         鍓湰锛

NDB瀛樺偍寮曟搸涓嬶紝姣忎釜琛ㄧ墖娈靛潎鏈夊涓壇鏈紝杩欎簺鍓湰淇濆瓨鍦ㄥ叾浠栨暟鎹妭鐐逛笂锛屼互鎻愪緵鍐椾綑鎬с傜洰鍓嶏紝姣忕墖娈垫渶澶氭湁4涓壇鏈

         浼犺緭鍣細

鎻愪緵鑺傜偣闂存暟鎹紶杈撶殑鍗忚銆MySQL绨囩洰鍓嶆彁渚涗簡鍥涚涓嶅悓鐨勪紶杈撳櫒杩炴帴锛

o        TCP/IP锛堟湰鍦帮級

褰撶劧锛岃繖鏄箍涓轰汉鐭ョ殑缃戠粶鍗忚锛屽畠鏄InternetHTTPFTP绛夌殑鍩虹銆

o        TCP/IP锛堣繙绋嬶級

鍚屼笂锛屼絾鐢ㄤ簬杩滅▼閫氫俊銆

o        SCI

SCI锛堣妯″彲鎵╁睍鐨勮绠楁満杩炴帴鎺ュ彛锛夋槸涓绉嶉珮閫熷崗璁紝鐢变簬鏋勫缓澶氬鐞嗗櫒绯荤粺鍜屽苟琛屽鐞嗗簲鐢ㄧ▼搴忋備笌MySQL绨囦竴璧蜂娇鐢SCI鏃讹紝闇瑕佷笓闂ㄧ殑纭欢锛屽叿浣撹璁鸿鍙傝17.7.1鑺傦紝鈥滈厤缃甅ySQL绨囦互浣跨敤SCI濂楁帴瀛椻銆傚叧浜SCI鐨勫熀鏈粙缁嶏紝璇峰弬瑙dolphinics.com涓婄殑鏂囩珷銆

o        SHM

Unix椋庢牸鍏变韩鍐呭瓨锛SHM锛夋銆傚湪浠讳綍鏀寔鐨勫満鍚堜笅锛屽皢鑷姩浣跨敤SHM鏉ヨ繛鎺ヨ繍琛屽湪鐩稿悓涓绘満涓婄殑鑺傜偣銆傝鎯充簡瑙h繖鏂归潰鐨勬洿澶氫俊鎭紝璇峰弬瑙鍏充簬shmop(2)鐨刄nix鎵嬪唽椤

娉ㄩ噴锛绨囦紶杈撳櫒鏄皣鍐呴儴鐨勩備娇鐢MySQL绨囩殑搴旂敤绋嬪簭涓SQL鑺傜偣杩涜閫氫俊锛屽氨鍍忎笌鍏朵粬鐗堟湰鐨MySQL鏈嶅姟鍣ㄨ繘琛岄氫俊涓鏍凤紙閫氳繃TCP/IP銆佹垨浣跨敤Unix濂楁帴瀛椼佹垨Windows鍛藉悕绠¢亾锛夈傚彲浠ヤ娇鐢ㄦ爣鍑嗙殑MySQL API鍙戝嚭鏌ヨ骞舵绱㈢粨鏋溿

         NDB

瀹冩槸缃戠粶鏁版嵁搴擄紙Network Database锛夌殑缂╁啓锛岃屼笖鎸囩殑鏄敤浜庡惎鐢MySQL绨囩殑瀛樺偍寮曟搸銆NDB瀛樺偍寮曟搸鏀寔鎵鏈夐氬父鐨MySQL鍒楃被鍨嬪拰SQL璇彞锛鑰屼笖鏄ACID鍏煎鐨勩傝寮曟搸杩樻彁渚涗簡瀵逛簨鍔$殑瀹屾暣鏀寔锛堟彁浜ゅ拰鍥炴粴锛夈

         鏃犲叡浜綋绯荤粨鏋勶細

鐢ㄤ簬MySQL绨囩殑鐞嗘兂浣撶郴缁撴瀯銆傚湪鐪熸鐨勬棤鍏变韩璁剧疆涓嬶紝姣忎釜鑺傜偣杩愯鍦ㄥ崟鐙殑涓绘満涓娿傝繖绫诲畨鎺掔殑浼樼偣鍦ㄤ簬锛屽崟涓富鏈烘垨鑺傜偣涓嶄細閫犳垚鍗曠偣鏁呴殰锛屼篃涓嶄細鎴愪负绯荤粺鏁翠綋鐨勬ц兘鐡堕銆

         鍐呭瓨涓瓨鍌細

淇濆瓨鍦ㄦ瘡涓暟鎹妭鐐逛腑鐨勬暟鎹潎淇濆瓨鍦ㄨ妭鐐瑰涓昏绠楁満鐨勫唴瀛樹腑銆傚浜庣皣涓殑姣忎釜鏁版嵁鑺傜偣锛屽繀椤绘彁渚涜冻澶熺殑RAM锛屾墍闇鐨RAM閲忎负锛氭暟鎹簱鐨勫ぇ灏忎箻浠ュ壇鏈暟鐩紝鐒跺悗闄や互鏁版嵁鑺傜偣鐨勬暟鐩傚洜姝わ紝濡傛灉鏁版嵁搴撳崰鐢1GB鐨勫唴瀛橈紝鑰屼笖浣犳墦绠楄缃叿鏈4涓壇鏈拰8涓暟鎹妭鐐圭殑绨囷紝姣忚妭鐐规墍闇鐨勬渶灏忓唴瀛樹负500 MB銆傛敞鎰忥紝杩樺簲鍔犱笂鎿嶄綔绯荤粺鎵闇鐨勫唴瀛樹互鍙婅繍琛屽湪涓绘満涓婄殑搴旂敤绋嬪簭鎵闇鐨勫唴瀛樸

         琛細

涓庡叧鑱旀暟鎹簱涓嬬殑閫氬父鎯呭喌涓鏍凤紝鏈鈥滆〃鈥濇寚鐨勬槸鍏锋湁绛夊悓缁撴瀯鐨勮褰曠殑闆嗗悎銆傚湪MySQL绨囦腑锛屾暟鎹簱琛ㄤ互鐗囨闆嗗悎鐨勬柟寮忎繚瀛樺湪鏁版嵁鑺傜偣涓紝骞跺皢姣忎釜鐗囨澶嶅埗鍒伴澶栫殑鏁版嵁鑺傜偣涓娿傚鍒剁浉鍚岀墖娈垫垨鐗囨闆嗗悎鐨勬暟鎹妭鐐归泦鍚堢О涓鸿妭鐐圭粍銆

         绨囩▼搴忥細

瀹冧滑鏄懡浠よ绋嬪簭锛岀敤浜庤繍琛屻侀厤缃拰绠$悊MySQL绨囥傚畠浠寘鎷袱绉嶆湇鍔″櫒绔彛鐩戠潱绋嬪簭锛

o        ndbd:

鏁版嵁鑺傜偣绔彛鐩戠潱绋嬪簭锛堣繍琛屾暟鎹妭鐐硅繘绋嬶級銆

o        ndb_mgmd:

绠$悊鏈嶅姟鍣ㄧ鍙g洃鐫g▼搴忥紙杩愯绠$悊鏈嶅姟鍣ㄨ繘绋嬶級銆

浠ュ強瀹㈡埛绔▼搴忥細

o        ndb_mgm:

绠$悊瀹㈡埛绔紙涓烘墽琛岀鐞嗗懡浠ゆ彁渚涗簡1涓晫闈級銆

o        ndb_waiter:

鐢ㄤ簬楠岃瘉绨囦腑鎵鏈夎妭鐐圭殑鐘舵併

o        ndb_restore:

浠庡浠戒腑鎭㈠绨囨暟鎹

鍏充簬杩欎簺绋嬪簭鍙婂叾鐢ㄦ硶鐨勬洿澶氫俊鎭紝璇峰弬瑙17.5鑺傦紝鈥淢ySQL绨囦腑鐨勮繘绋嬬鐞嗏

         浜嬩欢鏃ュ織锛

MySQL绨囨寜鐓х被鍒紙鍚姩銆佸仠姝€侀敊璇佹鏌ョ偣绛夛級銆佷紭鍏堢骇鍜屼弗閲嶇骇鍒潵璁板綍浜嬩欢銆傚叧浜庢墍鏈夊彲閫氭姤浜嬩欢鐨勫畬鏁村垪琛紝璇峰弬瑙17.6.3鑺傦紝鈥淢ySQL绨囦腑鐢熸垚鐨勪簨浠舵姤鍛娾銆備簨浠舵棩蹇楀叿鏈変袱绉嶇被鍨嬶細

o        绨囨棩蹇楋細

涓轰綔涓烘暣浣撶殑绨囪褰曟墍鏈夋墍闇鐨勩佸煎緱璁板綍鐨勪簨浠躲

o        鑺傜偣鏃ュ織锛

涓烘瘡涓崟鐙妭鐐逛繚瀛樼殑鍗曠嫭鏃ュ織銆

鍦ㄦ甯告儏鍐典笅锛屼粎闇淇濆瓨鍜屾鏌ョ皣鏃ュ織锛岃繖閫氬父宸茶冻澶熴傝妭鐐规棩蹇椾粎鐢ㄤ簬搴旂敤绋嬪簭寮鍙戝拰璋冭瘯鐩殑銆

 

杩欐槸MySQL鍙傝冩墜鍐岀殑缈昏瘧鐗堟湰锛屽叧浜嶮ySQL鍙傝冩墜鍐岋紝璇疯闂dev.mysql.com銆傚師濮嬪弬鑰冩墜鍐屼负鑻辨枃鐗堬紝涓庤嫳鏂囩増鍙傝冩墜鍐岀浉姣旓紝鏈炕璇戠増鍙兘涓嶆槸鏈鏂扮殑銆