{"id":11683,"date":"2023-04-23T16:32:39","date_gmt":"2023-04-23T08:32:39","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=11683"},"modified":"2023-05-04T16:01:16","modified_gmt":"2023-05-04T08:01:16","slug":"gbase-8a%e9%95%9c%e5%83%8f%e9%9b%86%e7%be%a4%e5%9c%ba%e6%99%af%ef%bc%8c%e5%b0%91%e9%87%8f%e9%ab%98%e9%85%8d%e6%9c%ba%e5%99%a8%e5%81%9a%e5%a4%87%e4%bb%bd%e9%9b%86%e7%be%a4","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/11683","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u955c\u50cf\u96c6\u7fa4\u573a\u666f\uff0c\u5c11\u91cf\u9ad8\u914d\u673a\u5668\u505a\u5907\u4efd\u96c6\u7fa4"},"content":{"rendered":"<p>GBase 8a\u7684\u955c\u50cf\u96c6\u7fa4\uff0c\u4e00\u822c\u5efa\u8bae\u91c7\u7528\u76f8\u540c\u7684\u62d3\u6251\u7ed3\u6784(\u76f8\u540c\u7684\u673a\u5668\u6570\u91cf\uff0c\u76f8\u540c\u7684\u5206\u5e03\u7b56\u7565)\u3002\u5982\u679c\u7528\u4e8e\u5b9e\u65f6\u5907\u4efd\u573a\u666f\uff0c\u4e5f\u53ef\u4ee5\u8003\u8651\u7528\u5927\u5bb9\u91cf\u78c1\u76d8\uff0c\u5c11\u91cf\u8282\u70b9\u505a\u5907\u4efd\u7528\u955c\u50cf\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2b0dcf2bf5b\" 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-6a2b0dcf2bf5b\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/11683\/#%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83\" >\u6d4b\u8bd5\u73af\u5883<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/11683\/#gcadmin\" >gcadmin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/11683\/#vc1%E7%9A%84%E4%BF%A1%E6%81%AF\" >vc1\u7684\u4fe1\u606f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/11683\/#VC2%E7%9A%84%E4%BF%A1%E6%81%AF\" >VC2\u7684\u4fe1\u606f<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/11683\/#%E5%88%9B%E5%BB%BA%E9%95%9C%E5%83%8F%E5%BA%93\" >\u521b\u5efa\u955c\u50cf\u5e93<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/11683\/#%E6%B5%8B%E8%AF%95%E9%95%9C%E5%83%8F%E8%A1%A8\" >\u6d4b\u8bd5\u955c\u50cf\u8868<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.gbase8.cn\/en\/11683\/#%E6%80%BB%E7%BB%93\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83\"><\/span>\u6d4b\u8bd5\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>3\u8282\u70b9\u96c6\u7fa4\u3002\u5176\u4e2d\u524d\u4e24\u4e2a\u8282\u70b9\u662fVC1\uff0c\u8bbe\u7f6e\u4e3ap 1 \u6bcf\u4e2a\u8282\u70b91\u4e2a\u4e3b\u5206\u7247\uff09\uff1b\u7b2c\u4e09\u4e2a\u8282\u70b9\u662fVC2\uff0c\u8bbe\u7f6e\u4e3a p2 d 0(\u6bcf\u4e2a\u8282\u70b92\u4e2a\u4e3b\u5206\u7247)\u3002<\/p>\n\n\n\n<p>\u4e24\u4e2aVC\u505a\u955c\u50cf\u7684\u524d\u63d0<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u4e3b\u5206\u7247\u6570\u91cf\u76f8\u540c\uff0c\u90fd\u662f2\u4e2a\uff1b\u4e0d\u8003\u8651\u526f\u672c<\/li><li>hashmap\u76f8\u540c(vc2\u91c7\u7528 initnodedatamap from vc1\u505a\u7684\u521d\u59cb\u5316)<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"gcadmin\"><\/span>gcadmin<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>&#91;gbase@gbase_rh7_001 gcinstall_9.5.2.45.5]$ gcadmin\nCLUSTER STATE:         ACTIVE\n\n=============================================================\n|           GBASE COORDINATOR CLUSTER INFORMATION           |\n=============================================================\n|   NodeName   | IpAddress  | gcware | gcluster | DataState |\n-------------------------------------------------------------\n| coordinator1 | 10.0.2.101 |  OPEN  |   OPEN   |     0     |\n-------------------------------------------------------------\n=============================================\n|     GBASE VIRTUAL CLUSTER INFORMATION     |\n=============================================\n|    VcName    | DistributionId |  comment  |\n---------------------------------------------\n|     vc1      |       1        | vc_101    |\n---------------------------------------------\n|     vc2      |       2        | vc_102    |\n---------------------------------------------\n\n2 virtual cluster: vc1, vc2\n1 coordinator node\n0 free data node<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"vc1%E7%9A%84%E4%BF%A1%E6%81%AF\"><\/span>vc1\u7684\u4fe1\u606f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>2\u53f0\u673a\u5668\uff0c\u6bcf\u4e2a\u673a\u5668\u4e00\u4e2a\u4e3b\u5206\u7247\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>&#91;gbase@gbase_rh7_001 gcinstall_9.5.2.45.5]$ gcadmin showcluster vc vc1\nCLUSTER STATE:         ACTIVE\nVIRTUAL CLUSTER MODE:  NORMAL\n\n=============================================\n|     GBASE VIRTUAL CLUSTER INFORMATION     |\n=============================================\n|    VcName    | DistributionId |  comment  |\n---------------------------------------------\n|     vc1      |       1        | vc_101    |\n---------------------------------------------\n=========================================================================================================\n|                                 VIRTUAL CLUSTER DATA NODE INFORMATION                                 |\n=========================================================================================================\n| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |\n---------------------------------------------------------------------------------------------------------\n|  node1   |                10.0.2.101                |       1        | OPEN  |    OPEN    |     0     |\n---------------------------------------------------------------------------------------------------------\n|  node2   |                10.0.2.102                |       1        | OPEN  |    OPEN    |     0     |\n---------------------------------------------------------------------------------------------------------\n\n2 data node\n\n&#91;gbase@gbase_rh7_001 gcinstall_9.5.2.45.5]$ gcadmin showdistribution  vc vc1\n\n                                 Distribution ID: 1 | State: new | Total segment num: 2\n\n             Primary Segment Node IP                   Segment ID                 Duplicate Segment node IP\n========================================================================================================================\n|                   10.0.2.101                   |         1          |                   10.0.2.102                   |\n------------------------------------------------------------------------------------------------------------------------\n|                   10.0.2.102                   |         2          |                   10.0.2.101                   |\n========================================================================================================================\n&#91;gbase@gbase_rh7_001 gcinstall_9.5.2.45.5]$<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"VC2%E7%9A%84%E4%BF%A1%E6%81%AF\"><\/span>VC2\u7684\u4fe1\u606f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>1\u53f0\u673a\u5668\uff0c\u67092\u4e2a\u4e3b\u5206\u7247\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>&#91;gbase@gbase_rh7_001 gcinstall_9.5.2.45.5]$ gcadmin showcluster vc vc2\nCLUSTER STATE:         ACTIVE\nVIRTUAL CLUSTER MODE:  NORMAL\n\n=============================================\n|     GBASE VIRTUAL CLUSTER INFORMATION     |\n=============================================\n|    VcName    | DistributionId |  comment  |\n---------------------------------------------\n|     vc2      |       2        | vc_102    |\n---------------------------------------------\n=========================================================================================================\n|                                 VIRTUAL CLUSTER DATA NODE INFORMATION                                 |\n=========================================================================================================\n| NodeName |                IpAddress                 | DistributionId | gnode | syncserver | DataState |\n---------------------------------------------------------------------------------------------------------\n|  node1   |                10.0.2.115                |       2        | OPEN  |    OPEN    |     0     |\n---------------------------------------------------------------------------------------------------------\n\n1 data node\n\n&#91;gbase@gbase_rh7_001 gcinstall_9.5.2.45.5]$ gcadmin showdistribution  vc vc2\n\n                                 Distribution ID: 2 | State: new | Total segment num: 2\n\n             Primary Segment Node IP                   Segment ID                 Duplicate Segment node IP\n========================================================================================================================\n|                   10.0.2.115                   |         1          |                                                |\n------------------------------------------------------------------------------------------------------------------------\n|                   10.0.2.115                   |         2          |                                                |\n========================================================================================================================\n&#91;gbase@gbase_rh7_001 gcinstall_9.5.2.45.5]$ <\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%9B%E5%BB%BA%E9%95%9C%E5%83%8F%E5%BA%93\"><\/span>\u521b\u5efa\u955c\u50cf\u5e93<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u521d\u59cb\u5316\u5e76\u8bbe\u7f6evc1\u5230vc2\u7684\u955c\u50cf\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase&gt; use vc vc1;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n\ngbase&gt; initnodedatamap;\nQuery OK, 1 row affected (Elapsed: 00:00:00.51)\n\ngbase&gt; use vc vc2;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n\ngbase&gt; initnodedatamap from vc1;\nQuery OK, 1 row affected, 1 warning (Elapsed: 00:00:00.36)\n\ngbase&gt; show warnings;\n+---------+------+----------------------------------------------------------+\n| Level   | Code | Message                                                  |\n+---------+------+----------------------------------------------------------+\n| Warning | 1042 | It is risky that some suffix is not in the backup state. |\n+---------+------+----------------------------------------------------------+\n1 row in set (Elapsed: 00:00:00.00)\n\ngbase&gt; create database vc1.testdb;\nQuery OK, 1 row affected (Elapsed: 00:00:00.01)\n\ngbase&gt; create database vc2.testdb;\nQuery OK, 1 row affected (Elapsed: 00:00:00.00)\n\ngbase&gt; alter database vc1.testdb set default mirror=vc2;\nQuery OK, 1 row affected (Elapsed: 00:00:00.00)\n\ngbase&gt; show mirror databases;\n+--------------------+-----+-----------+\n| Database           | VC  | MIRROR_VC |\n+--------------------+-----+-----------+\n| information_schema |     |           |\n| performance_schema |     |           |\n| gbase              |     |           |\n| gctmpdb            |     |           |\n| gclusterdb         | vc2 |           |\n| testdb             | vc2 | vc1       |\n+--------------------+-----+-----------+\n6 rows in set (Elapsed: 00:00:00.00)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E9%95%9C%E5%83%8F%E8%A1%A8\"><\/span>\u6d4b\u8bd5\u955c\u50cf\u8868<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase&gt; use vc vc1;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n\ngbase&gt; use testdb;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n\ngbase&gt; create table t1(id int,name varchar(100));\nQuery OK, 0 rows affected (Elapsed: 00:00:00.21)\n\ngbase&gt; insert into t1 values(1,'From vc1');\nQuery OK, 1 row affected (Elapsed: 00:00:00.13)\n\ngbase&gt; select * from vc1.testd.t1;\nERROR 1146 (42S02): Table 'vc1.testd.t1' doesn't exist\ngbase&gt; select * from vc1.testdb.t1;\n+------+----------+\n| id   | name     |\n+------+----------+\n|    1 | From vc1 |\n+------+----------+\n1 row in set (Elapsed: 00:00:00.01)\n\ngbase&gt; select * from vc2.testdb.t1;\n+------+----------+\n| id   | name     |\n+------+----------+\n|    1 | From vc1 |\n+------+----------+\n1 row in set (Elapsed: 00:00:00.01)\n\ngbase&gt; ^CAborted<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%80%BB%E7%BB%93\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u955c\u50cf\u96c6\u7fa4\uff0c\u548c\u4e3b\u5206\u7247\u6570\u91cf\u6709\u5173\uff0c\u53cc\u65b9\u5fc5\u987b\u6709\u76f8\u540c\u7684\u4e3b\u5206\u7247\u6570\uff1b\u548chashmap\u6709\u5173\uff0c\u53cc\u65b9nodedatamap\u8868\u91cc\u7684data_distribution_id\u7684\u6570\u91cf\u5fc5\u987b\u76f8\u540c\uff0c\u4e14\u5185\u5bb9\u5fc5\u987b\u76f8\u540c\u3002<\/p>\n\n\n\n<p>\u7ecf\u6d4b\u8bd5\uff0c\u5f53\u524d\u7248\u672c\u5bf9distribution\u7684\u6570\u91cf\u6ca1\u6709\u4e25\u683c\u68c0\u67e5\uff0c\u5982\u679c\u53ea\u521b\u5efadistribution,\u4f46\u6ca1\u6709initnodedatamap\uff0c\u6b64\u65f6\u4e0d\u5f71\u54cd\u955c\u50cf\u3002\u4f46\u5982\u679c\u505a\u4e86initnodedatamap,\u5219\u4e24\u9762\u7684nodedatamap\u5c06\u4e0d\u4e00\u6837\uff0c\u5efa\u955c\u50cf\u4f1a\u62a5\u9519\u3002<\/p>\n\n\n\n<p>\u53ef\u4ee5\u7528\u4e0b\u9762\u7684SQL\u8bed\u53e5\u68c0\u67e5\u3002\u770b\u6bcf\u4e2ahashkey,nodeid\u7ec4\u5408\u7684\u6570\u91cf(group by hashkey,nodeid)\u505acount(*)\uff0c \u5982\u679c\u6bcf\u4e2ahashkey\u548cnodeid\u3002<\/p>\n\n\n\n<p>\u5176\u4e2d\u7684id\u662f\u4f60\u955c\u50cfvc\u5f53\u524d\u5728\u7528\u7684distribution\u7f16\u53f7\uff0c\u53ef\u4ee5\u5728gcadmin showdistribution vc VCNAME \u770b\u5230\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>select distinct(res.r), count(res.r) from (select count(*) r from  gbase.nodedatamap t where t.data_distribution_id in (1,2) group by  t.hashkey, t.nodeid) res group by res.r;\n+---+--------------+\n| r | count(res.r) |\n+---+--------------+\n| 2 |        65536 |\n+---+--------------+\n1 row in set (Elapsed: 00:00:00.42)<\/code><\/pre>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u7684\u955c\u50cf\u96c6\u7fa4\uff0c\u4e00\u822c\u5efa\u8bae\u91c7\u7528\u76f8\u540c\u7684\u62d3\u6251\u7ed3\u6784(\u76f8\u540c\u7684\u673a\u5668\u6570\u91cf\uff0c\u76f8\u540c\u7684\u5206\u5e03\u7b56\u7565)\u3002\u5982\u679c\u7528\u4e8e\u5b9e\u65f6\u5907\u4efd\u573a\u666f\uff0c\u4e5f\u53ef\u4ee5\u8003\u8651\u7528\u5927\u5bb9\u91cf\u78c1\u76d8\uff0c\u5c11\u91cf\u8282\u70b9\u505a\u5907\u4efd\u7528\u955c\u50cf\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-11683","post","type-post","status-publish","format-standard","hentry","category-gbase8a"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/11683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=11683"}],"version-history":[{"count":13,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/11683\/revisions"}],"predecessor-version":[{"id":11764,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/11683\/revisions\/11764"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=11683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=11683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=11683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}