
{"id":1014,"date":"2021-10-16T17:02:37","date_gmt":"2021-10-16T09:02:37","guid":{"rendered":"http:\/\/dba.qishuo.xin\/?p=1014"},"modified":"2023-10-20T20:52:04","modified_gmt":"2023-10-20T12:52:04","slug":"mariadb%e4%b8%bb%e5%ba%93%e5%90%af%e7%94%a8federated%e5%bc%95%e6%93%8e%e5%af%bc%e8%87%b4%e4%bb%8e%e5%ba%93%e5%a4%b1%e6%95%88","status":"publish","type":"post","link":"http:\/\/dba.qishuo.xin\/?p=1014","title":{"rendered":"Mariadb\u4e3b\u5e93\u542f\u7528FEDERATED\u5f15\u64ce\u5bfc\u81f4\u4ece\u5e93\u5931\u6548"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<label for=\"ez-toc-cssicon-toggle-item-69f7300d8baad\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f7300d8baad\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/dba.qishuo.xin\/?p=1014\/#1_%E6%95%85%E9%9A%9C%E7%8E%B0%E8%B1%A1%EF%BC%88SYMPTOMS%EF%BC%89\" >1. \u6545\u969c\u73b0\u8c61\uff08SYMPTOMS\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/dba.qishuo.xin\/?p=1014\/#2_%E5%8F%98%E5%8C%96%EF%BC%88CHANGES%EF%BC%89\" >2. \u53d8\u5316\uff08CHANGES\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/dba.qishuo.xin\/?p=1014\/#3_%E6%95%85%E9%9A%9C%E5%8E%9F%E5%9B%A0%EF%BC%88CAUSE%EF%BC%89\" >3. \u6545\u969c\u539f\u56e0\uff08CAUSE\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/dba.qishuo.xin\/?p=1014\/#4_%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%EF%BC%88SOLUTION%EF%BC%89\" >4. \u89e3\u51b3\u65b9\u6848\uff08SOLUTION\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/dba.qishuo.xin\/?p=1014\/#5_%E6%80%BB%E7%BB%93%EF%BC%88SUMMARY%EF%BC%89\" >5. \u603b\u7ed3\uff08SUMMARY\uff09<\/a><\/li><\/ul><\/nav><\/div>\n<p>\u73af\u5883\u8bf4\u660e\uff1a10.5.8-MariaDB-log \u4e3b\u4ece\u5e93<\/p>\n<h4><span class=\"ez-toc-section\" id=\"1_%E6%95%85%E9%9A%9C%E7%8E%B0%E8%B1%A1%EF%BC%88SYMPTOMS%EF%BC%89\"><\/span>1. \u6545\u969c\u73b0\u8c61\uff08SYMPTOMS\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><span style='color:red'> \u4ece\u5e93 Slave_SQL_Running: No ,\u5373\u4e0d\u518d\u5e94\u7528\u4e3b\u5e93\u4e0a\u7684\u53d8\u5316<\/span><\/p>\n<pre><code>MariaDB [(none)]&gt; show slave status\\G\n*************************** 1. row ***************************\n                Slave_IO_State: Queueing master event to the relay log\n                   Master_Host: 172.16.5.70\n                   Master_User: repliuser\n                   Master_Port: 3306\n                 Connect_Retry: 60\n               Master_Log_File: mysql-bin.000012\n           Read_Master_Log_Pos: 61008868\n                Relay_Log_File: mysqld-relay-bin.000032\n                 Relay_Log_Pos: 555\n         Relay_Master_Log_File: mysql-bin.000012\n              Slave_IO_Running: Yes\n             Slave_SQL_Running: No\n               Replicate_Do_DB: \n           Replicate_Ignore_DB: \n            Replicate_Do_Table: \n        Replicate_Ignore_Table: \n       Replicate_Wild_Do_Table: \n   Replicate_Wild_Ignore_Table: \n                    Last_Errno: 1286\n                    Last_Error: Error &#039;Unknown storage engine &#039;FEDERATED&#039;&#039; on query. Default database: &#039;easytong1db&#039;. Query: &#039;\/*==============================================================*\/\n\/* Table: SC_CardCode                                           *\/\n\/*==============================================================*\/\ncreate table SC_CardCode1\n(\n   CardCode             int not null,\n   UseFlag              tinyint not null,\n   ReleaseTime          datetime not null,\n   ReleaseMode          tinyint not null default 0,\n   primary key (CardCode)\n)\nENGINE = FEDERATED\nCONNECTION=&#039;mysql:\/\/root:hzxy00yz@172.16.5.70:3306\/easytong_0630\/SC_CardCode1&#039;&#039;\n                  Skip_Counter: 0\n           Exec_Master_Log_Pos: 20114666\n               Relay_Log_Space: 40895067\n               Until_Condition: None\n                Until_Log_File: \n                 Until_Log_Pos: 0\n            Master_SSL_Allowed: No\n            Master_SSL_CA_File: \n            Master_SSL_CA_Path: \n               Master_SSL_Cert: \n             Master_SSL_Cipher: \n                Master_SSL_Key: \n         Seconds_Behind_Master: NULL\n Master_SSL_Verify_Server_Cert: No\n                 Last_IO_Errno: 0\n                 Last_IO_Error: \n                Last_SQL_Errno: 1286\n                Last_SQL_Error: Error &#039;Unknown storage engine &#039;FEDERATED&#039;&#039; on query. Default database: &#039;easytong1db&#039;. Query: &#039;\/*==============================================================*\/\n\/* Table: SC_CardCode                                           *\/\n\/*==============================================================*\/\ncreate table SC_CardCode1\n(\n   CardCode             int not null,\n   UseFlag              tinyint not null,\n   ReleaseTime          datetime not null,\n   ReleaseMode          tinyint not null default 0,\n   primary key (CardCode)\n)\nENGINE = FEDERATED\nCONNECTION=&#039;mysql:\/\/root:hzxy00yz@172.16.5.70:3306\/easytong_0630\/SC_CardCode1&#039;&#039;\n   Replicate_Ignore_Server_Ids: \n              Master_Server_Id: 70\n                Master_SSL_Crl: \n            Master_SSL_Crlpath: \n                    Using_Gtid: No\n                   Gtid_IO_Pos: \n       Replicate_Do_Domain_Ids: \n   Replicate_Ignore_Domain_Ids: \n                 Parallel_Mode: optimistic\n                     SQL_Delay: 0\n           SQL_Remaining_Delay: NULL\n       Slave_SQL_Running_State: \n              Slave_DDL_Groups: 1\nSlave_Non_Transactional_Groups: 0\n    Slave_Transactional_Groups: 0\n1 row in set (0.000 sec)\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"2_%E5%8F%98%E5%8C%96%EF%BC%88CHANGES%EF%BC%89\"><\/span>2. \u53d8\u5316\uff08CHANGES\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<h4><span class=\"ez-toc-section\" id=\"3_%E6%95%85%E9%9A%9C%E5%8E%9F%E5%9B%A0%EF%BC%88CAUSE%EF%BC%89\"><\/span>3. \u6545\u969c\u539f\u56e0\uff08CAUSE\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4e3b\u5e93\u589e\u52a0\u4e86 <code>FEDERATED<\/code> \u5f15\u64ce\uff0c\u800c\u4ece\u5e93\u5374\u4e0d\u652f\u6301\uff0c\u5bfc\u81f4\u4e3b\u4ece\u590d\u5236\u5931\u6548\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"4_%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%EF%BC%88SOLUTION%EF%BC%89\"><\/span>4. \u89e3\u51b3\u65b9\u6848\uff08SOLUTION\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5728\u4ece\u5e93\u4e2d\u542f\u7528 <code>FEDERATED<\/code> \u5f15\u64ce\u3002\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\n<p>\u5b89\u88c5 FederatedX\u5f15\u64ce\u3002\u5728 MariaDB \u547d\u4ee4\u884c\u4e0b\u6267\u884c<\/p>\n<pre><code class=\"language-mysql\">install plugin federated soname &#039;ha_federatedx.so&#039;;<\/code><\/pre>\n<\/li>\n<li>\n<p>\u505c\u6b62 MariaDB<\/p>\n<pre><code class=\"language-shell\">systemctl stop mariadb<\/code><\/pre>\n<\/li>\n<li>\n<p>\u4fee\u6539 \/etc\/my.cnf \u6587\u4ef6\uff0c\u5728 [mysqld] \u8282\u70b9\u4e0b\u589e\u52a0\u5982\u4e0b\u5185\u5bb9<\/p>\n<pre><code class=\"language-shell\">federated = 1<\/code><\/pre>\n<\/li>\n<li>\n<p>\u6700\u540e\u91cd\u65b0\u542f\u52a8 MariaDB<\/p>\n<pre><code class=\"language-shell\">systemctl start mariadb<\/code><\/pre>\n<\/li>\n<li>\n<p>\u67e5\u770b\u5f15\u64ce\u5e76\u5f00\u542fslave<\/p>\n<pre><code class=\"language-mysql\">MariaDB [(none)]&gt;\nshow engines;\nstart slave;\nshow slave status\\G<\/code><\/pre>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/10\/wp_editor_md_ec548ef0c12b99d181500db512b058bf.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/10\/wp_editor_md_ec548ef0c12b99d181500db512b058bf.jpg\" alt=\"\" \/><\/a><\/p>\n<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"5_%E6%80%BB%E7%BB%93%EF%BC%88SUMMARY%EF%BC%89\"><\/span>5. \u603b\u7ed3\uff08SUMMARY\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Federate\u5b58\u50a8\u5f15\u64ce\u4e5f\u662fmysql\u6bd4\u8f83\u5e38\u7528\u7684\u5b58\u50a8\u5f15\u64ce\uff0c\u4f7f\u7528\u5b83\u53ef\u4ee5\u8bbf\u95ee\u8fdc\u7a0b\u7684mysql\u6570\u636e\u5e93\u4e0a\u7684\u8868\uff0c\u8fd9\u79cd\u5f15\u64ce\u7684\u4f5c\u7528\u7c7b\u4f3c\u4e8eoracle\u6570\u636e\u5e93\u7684dblink\uff0c\u4ee5mysql5.5\u4e3a\u4f8b\u9ed8\u8ba4\u662f\u4e0d\u542f\u7528federated\u5f15\u64ce\u7684\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>INSTALL PLUGIN plugin_name SONAME &#039;shared_library_name&#039;<\/code> \u8bed\u53e5\u52a8\u6001\u52a0\u8f7d\uff0c\u4e0b\u9762\u6765\u770b\u770bfederated\u5f15\u64ce\u7684\u67b6\u6784\uff1a<\/p>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/10\/wp_editor_md_9d1787e69fb817a1b3445fefbc61f2ad.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/10\/wp_editor_md_9d1787e69fb817a1b3445fefbc61f2ad.jpg\" alt=\"\" \/><\/a><\/p>\n<p>federated table\u5e76\u4e0d\u4fdd\u5b58\u6570\u636e\u53ea\u6709.frm\u6587\u4ef6\uff0c\u771f\u5b9e\u7684\u6570\u636e\u5b58\u5728\u4e8e\u8fdc\u7a0b\u6570\u636e\u5e93\uff0c\u8bbf\u95eefederated\u5f15\u64ce\u8868\u65f6\u672c\u5730\u6570\u636e\u5e93\u63a5\u53d7\u7528\u6237SQL\u8bf7\u6c42\u540e\u4f7f\u7528msyql client c\u00a0api\u00a0\u7684\u00a0mysql_real_query()\u00a0\u53d1\u9001\u5230\u8fdc\u7a0b\u6570\u636e\u5e93\uff0c\u4f7f\u7528\u00a0\u00a0mysql_store_result() \u51fd\u6570\u8bfb\u53d6\u8fdc\u7a0b\u6570\u636e\u5e93\u67e5\u8be2\u7ed3\u679c.<br \/>\n<strong><span style='color:red'> \u7531\u4e8efederate\u4e0d\u80fd\u4f7f\u7528\u7f13\u5b58\uff0c\u800c\u4e14\u591a\u4e86\u7f51\u7edc\u5f00\u9500\u6240\u4ee5\u4ed6\u7684\u6027\u80fd\u4e0d\u7406\u60f3\u3002federated\u5f15\u64ce\u7684\u5c40\u9650\u8fd8\u662f\u6bd4\u8f83\u591a\u7684\uff0c\u7279\u522b\u5728\u5e76\u53d1\u67e5\u8be2\u7684\u60c5\u51b5\u4e0b\u6027\u80fd\u4e0b\u964d\u5f88\u5feb\uff0c\u4e0d\u9002\u5408\u9ad8\u5e76\u53d1\u7684\u73af\u5883\u3002 <\/span><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883\u8bf4\u660e\uff1a10.5.8-MariaDB-log \u4e3b&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45,31,3],"tags":[12,137],"class_list":{"0":"post-1014","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-mariadb","8":"category-mariadbmysql","9":"tag-mariadb","10":"tag-137"},"_links":{"self":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/1014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1014"}],"version-history":[{"count":4,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/1014\/revisions"}],"predecessor-version":[{"id":3419,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/1014\/revisions\/3419"}],"wp:attachment":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1014"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}