{"id":2168,"date":"2022-01-21T15:43:39","date_gmt":"2022-01-21T07:43:39","guid":{"rendered":"https:\/\/199604.com\/?p=2168"},"modified":"2022-01-21T15:43:39","modified_gmt":"2022-01-21T07:43:39","slug":"greenplum%e6%89%a9%e5%ae%b9-%e7%ba%b5%e5%90%91%e6%89%a9%e5%ae%b9","status":"publish","type":"post","link":"https:\/\/199604.com\/2168","title":{"rendered":"Greenplum\u6269\u5bb9-\u7eb5\u5411\u6269\u5bb9"},"content":{"rendered":"<h1>Greenplum\u6269\u5bb9-\u7eb5\u5411\u6269\u5bb9<\/h1>\n<h3>\u6269\u5bb9\u524d\u51c6\u5907<\/h3>\n<p>\u9996\u5148\u770b\u770b\u73b0\u6709\u7684\u96c6\u7fa4\u7684\u72b6\u6001\uff1a<code>gpstate<\/code><\/p>\n<p>\u73b0\u5728\u7684\u72b6\u6001\u662f\u67093\u53f0\u4e3b\u673a\uff0c\u4e00\u4e2a\u662fmaster\u8282\u70b9\uff0c\u8fd8\u6709\u4e24\u4e2asegment\u7684\u673a\u5668\uff0c\u6bcf\u4e2asegment\u7684\u673a\u5668\u4e0a\u90fd\u6709\u4e00\u4e2aprimary\u548cmirror\u7684segment.<\/p>\n<p>\u73b0\u5728\u8ba1\u5212\u5728\u73b0\u6709\u7684\u96c6\u7fa4\u4e0a\u8fdb\u884csegment\u7684\u6269\u5bb9\uff0c\u5728\u6bcf\u53f0\u673a\u5668\u4e0a\u7684segment\u7684\u6570\u91cf\u7ffb\u500d.<br \/>\n\u73b0\u5728segment\u7684\u76ee\u5f55\u4e3a\uff1a<\/p>\n<pre><code class=\"language-bash \">\/data\/data1\/gp\/mirror\n\/data\/data1\/gp\/primary\n<\/code><\/pre>\n<p>\u73b0\u5728\u9700\u8981\u5728\u4e24\u4e2asegment\u7684\u4e3b\u673a\u4e0a\u521b\u5efa\u65b0\u7684\u76ee\u5f55\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-bash \">\/data\/data2\/gp\/mirror\n\/data\/data2\/gp\/primary\n<\/code><\/pre>\n<p>\u4e0a\u9762\u7684\u76ee\u5f55\u7684\u6240\u5c5e\u7ec4\u548c\u7528\u6237\u5747\u4e3agpadmin:gpamdin\uff0c\u8fd9\u91cc\u521b\u5efa\u76ee\u5f55\u53ef\u4ee5\u4f7f\u7528gpssh\u521b\u5efa\u4e5f\u53ef\u4ee5\u4e00\u4e2a\u4e00\u4e2a\u7684\u521b\u5efa<\/p>\n<pre><code class=\"language-bash \">mkdir -p \/data\/data2\/gp\/primary\nmkdir -p \/data\/data2\/gp\/mirror\n\nmkdir -p \/data\/data2\/gp\/primary\/space_fastdisk\nmkdir -p \/data\/data2\/gp\/mirror\/space_fastdisk\n\nchown -R gpadmin:gpadmin \/data\/data2\n<\/code><\/pre>\n<h3>\u521b\u5efa\u521d\u59cb\u5316\u6587\u4ef6<\/h3>\n<p>\u67e5\u770b\u76ee\u524dsegment\u7684\u4e3b\u673a\uff1a<\/p>\n<pre><code class=\"language-bash \">[gpadmin@hljydwxywgzt4-7 ~]$ cat seg_host \nhljydwxywgzt-8 \nhljydwxywgzt2-4\n<\/code><\/pre>\n<p>\u6267\u884c\uff1a<code>gpexpand -f seg_hosts<\/code>or <code>gpexpand -f seg_hosts -D your_db_name<\/code><\/p>\n<p>\u5982\u679c\u62a5\u9519\u8fd9\u4e2a\u9519:[ERROR]:-gpexpand failed: Invalid database &#8216;template1&#8217; specified.  Cannot use a template database. \u5c31\u6709\u4e24\u79cd\u89e3\u51b3\u529e\u6cd5:<\/p>\n<p>1.\u6307\u5b9a\u60a8\u7684\u6570\u636e\u5e93:<code>gpexpand -f seg_hosts -D lte_mr<\/code><\/p>\n<p>2.\u5728<code>.bash_profile<\/code> \u65b0\u589e:<code>export PGDATABASE=lte_mr<\/code> \u6307\u5411\u6570\u636e\u5e93<\/p>\n<pre><code class=\"language-bash \">[gpadmin@hljydwxywgzt4-7 ~]$ gpexpand -f seg_host \n20220121:15:27:33:197129 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 5.29.3 build commit:dcbb78a61cebd6eb8d196cb73d2eb76836bd59c7'\n20220121:15:27:33:197129 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.3.23 (Greenplum Database 5.29.3 build commit:dcbb78a61cebd6eb8d196cb73d2eb76836bd59c7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan  4 2022 04:24:09'\n20220121:15:27:33:197129 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state\n\nSystem Expansion is used to add segments to an existing GPDB array.\ngpexpand did not detect a System Expansion that is in progress.\n\nBefore initiating a System Expansion, you need to provision and burn-in\nthe new hardware.  Please be sure to run gpcheckperf to make sure the\nnew hardware is working properly.\n\nPlease refer to the Admin Guide for more information.\n\nWould you like to initiate a new System Expansion Yy|Nn (default=N):\n&gt; y\n\nYou must now specify a mirroring strategy for the new hosts.  Spread mirroring places\na given hosts mirrored segments each on a separate host.  You must be \nadding more hosts than the number of segments per host to use this. \nGrouped mirroring places all of a given hosts segments on a single \nmirrored host.  You must be adding at least 2 hosts in order to use this.\n\n\n\nWhat type of mirroring strategy would you like?\n spread|grouped (default=grouped):#\u9ed8\u8ba4\u7684mirror\u65b9\u5f0f\n&gt; \n\n** No hostnames were given that do not already exist in the **\n** array. Additional segments will be added existing hosts. **\n\n    By default, new hosts are configured with the same number of primary\n    segments as existing hosts.  Optionally, you can increase the number\n    of segments per host.\n\n    For example, if existing hosts have two primary segments, entering a value\n    of 2 will initialize two additional segments on existing hosts, and four\n    segments on new hosts.  In addition, mirror segments will be added for\n    these new primary segments if mirroring is enabled.\n\n\nHow many new primary segments per host do you want to add? (default=0):\n&gt; 1\nEnter new primary data directory 1:\n&gt; \/data\/data2\/gp\/primary\nEnter new mirror data directory 1:\n&gt; \/data\/data2\/gp\/mirror\n\nGenerating configuration file...\n\n20220121:15:28:41:197129 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-Generating input file...\n\nInput configuration files were written to 'gpexpand_inputfile_20220121_152841' and 'None'.\nPlease review the file and make sure that it is correct then re-run\nwith: gpexpand -i gpexpand_inputfile_20220121_152841 -D lte_mr #\u751f\u6210\u7684\u521d\u59cb\u5316\u6587\u4ef6\n\n20220121:15:28:41:197129 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-Exiting...\n<\/code><\/pre>\n<p>\u67e5\u770b\u521d\u59cb\u5316\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-bash \">[gpadmin@hljydwxywgzt4-7 ~]$ cat gpexpand_inputfile_20220121_152841\nhljydwxywgzt-8:hljydwxywgzt-8:40001:\/data\/data2\/gp\/primary\/gpseg2:7:2:p:41001\nhljydwxywgzt2-4:hljydwxywgzt2-4:50001:\/data\/data2\/gp\/mirror\/gpseg2:10:2:m:51001\nhljydwxywgzt2-4:hljydwxywgzt2-4:40001:\/data\/data2\/gp\/primary\/gpseg3:8:3:p:41001\nhljydwxywgzt-8:hljydwxywgzt-8:50001:\/data\/data2\/gp\/mirror\/gpseg3:9:3:m:51001\n<\/code><\/pre>\n<h3>\u521d\u59cb\u5316Segment\u5e76\u4e14\u521b\u5efa\u6269\u5bb9schema<\/h3>\n<p>\u6267\u884c\u547d\u4ee4: <code>gpexpand -i gpexpand_inputfile_20220121_152841<\/code> or<code>gpexpand -i gpexpand_inputfile_20220121_152841 -D your_db_name<\/code><\/p>\n<p>\u4f7f\u7528<code>gpstate<\/code>\u9a8c\u8bc1\u4e0b\u8282\u70b9\u662f\u5426\u6dfb\u52a0\u6210\u529f!<\/p>\n<h3>\u91cd\u5206\u5e03\u6570\u636e<\/h3>\n<p>\u6267\u884c\u547d\u4ee4\uff1a<code>gpexpand -d 1:00:00<\/code><\/p>\n<h3>\u79fb\u9664\u6269\u5bb9schema<\/h3>\n<p>\u6267\u884c\u547d\u4ee4\uff1a<code>gpexpand -c<\/code><\/p>\n<pre><code class=\"language-bash \">[gpadmin@hljydwxywgzt4-7 ~]$ gpexpand -c\n20220121:15:41:33:202342 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 5.29.3 build commit:dcbb78a61cebd6eb8d196cb73d2eb76836bd59c7'\n20220121:15:41:33:202342 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.3.23 (Greenplum Database 5.29.3 build commit:dcbb78a61cebd6eb8d196cb73d2eb76836bd59c7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan  4 2022 04:24:09'\n20220121:15:41:33:202342 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state\n\n\nDo you want to dump the gpexpand.status_detail table to file? Yy|Nn (default=Y):\n&gt; y\n20220121:15:41:37:202342 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-Dumping gpexpand.status_detail to \/data\/master\/gpseg-1\/gpexpand.status_detail\n20220121:15:41:37:202342 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-Removing gpexpand schema\n20220121:15:41:38:202342 gpexpand:hljydwxywgzt4-7:gpadmin-[INFO]:-Cleanup Finished.  exiting...\n<\/code><\/pre>\n<p>\u8fd9\u91cc\u4e3a\u6b62\u7eb5\u5411\u6269\u5bb9\u5c31\u5b8c\u6210\u4e86\uff0c\u4e0d\u51fa\u9519\u90fd\u662f\u50bb\u74dc\u5f0f\u7684\u64cd\u4f5c\uff0c\u51fa\u9519\u591a\u770b\u65e5\u5fd7\uff0c\u4e5f\u4e0d\u96be\u3002<\/p>\n<p><strong>\u6ce8\u610f\uff1a\u5982\u679c\u5728\u6269\u5bb9\u7684\u65f6\u5019\u5931\u8d25\u6216\u8005\u51fa\u9519\u4e86\uff0c\u8bb0\u5f97\u56de\u6eda\uff1agpexpand -r \uff0c\u8fd8\u6709\u5c31\u662f\u6269\u5bb9\u6210\u529f\uff0c\u6570\u636e\u91cd\u5206\u5e03\u6210\u529f\u540e\u8bb0\u5f97\u4f7f\u7528analyze\u6216\u8005analyzedb\u8fdb\u884c\u5206\u6790<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Greenplum\u6269\u5bb9-\u7eb5\u5411\u6269\u5bb9 \u6269\u5bb9\u524d\u51c6\u5907 \u9996\u5148\u770b\u770b\u73b0\u6709\u7684\u96c6\u7fa4\u7684\u72b6\u6001\uff1agpstate \u73b0\u5728\u7684\u72b6\u6001\u662f\u67093\u53f0\u4e3b\u673a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[257,304,260],"tags":[276],"class_list":["post-2168","post","type-post","status-publish","format-standard","hentry","category-gp","category-greenplum","category-linux","tag-greenplum"],"_links":{"self":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/comments?post=2168"}],"version-history":[{"count":1,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2168\/revisions"}],"predecessor-version":[{"id":2169,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/posts\/2168\/revisions\/2169"}],"wp:attachment":[{"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/media?parent=2168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/categories?post=2168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/199604.com\/wp-json\/wp\/v2\/tags?post=2168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}