<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Greenplum 技術專欄 彙整 - 歐立威科技</title>
	<atom:link href="https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/</link>
	<description>歐立威科技 Omniwaresoft｜全方位企業級開源軟體解決方案</description>
	<lastBuildDate>Mon, 05 May 2025 02:52:14 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.4</generator>

<image>
	<url>https://www.omniwaresoft.com.tw/wp-content/uploads/2022/12/android-icon-192x192-1.png</url>
	<title>Greenplum 技術專欄 彙整 - 歐立威科技</title>
	<link>https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">242464019</site>	<item>
		<title>PB 級 ETL 獨門秘器 &#8211; Greenplum GPFDIST 介紹與使用情境</title>
		<link>https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/greenplum-etl-tool-gpfdist-introdution/</link>
		
		<dc:creator><![CDATA[Omni]]></dc:creator>
		<pubDate>Mon, 12 Dec 2022 10:43:21 +0000</pubDate>
				<category><![CDATA[Greenplum 技術專欄]]></category>
		<category><![CDATA[ETL]]></category>
		<category><![CDATA[Greenplum]]></category>
		<guid isPermaLink="false">http://www.omniwaresoft.com.tw/?p=18600</guid>

					<description><![CDATA[GPFDIST 是 Greenplum Database parallel file distribution program，專門用於處理 Greenplum 對外部檔案進行讀取或寫。由於 GreenPlum 將自身定位為可處理 PB 等級資料的數據倉儲產品，因此在實際應用場景中，必然會有 ETL 大量資料匯入的需求，此時就可以透過 GPFDIST 以平行處理、協同作業的方式進行極為快速的資料處理。]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="18600" class="elementor elementor-18600" data-elementor-post-type="post">
						<section data-particle_enable="false" data-particle-mobile-disabled="false" class="elementor-section elementor-top-section elementor-element elementor-element-21b1848 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="21b1848" data-element_type="section">
						<div class="elementor-container elementor-column-gap-thegem"><div class="elementor-row">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-36c58ab7" data-id="36c58ab7" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-342e6c9c flex-horizontal-align-default flex-horizontal-align-tablet-default flex-horizontal-align-mobile-default flex-vertical-align-default flex-vertical-align-tablet-default flex-vertical-align-mobile-default elementor-widget elementor-widget-text-editor" data-id="342e6c9c" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
												<div class="elementor-text-editor elementor-clearfix">
						<p></p>
<h2 class="has-medium-font-size wp-block-heading">誰適合看這篇文章</h2>
<p></p>
<p></p>
<ol class="wp-block-list"><p></p>
<li>正在使用 Greenplum 或有意了解 Greenplum 的工程師</li>
<p></p>
<p></p>
<li>對 GPFDIST 有興趣的使用者</li>
<p></p>
</ol>
<p></p>
<p></p>
<h2 class="has-medium-font-size wp-block-heading" id="可以得到什麼收穫"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E5%8F%AF%E4%BB%A5%E5%BE%97%E5%88%B0%E4%BB%80%E9%BA%BC%E6%94%B6%E7%A9%AB"></a>可以得到什麼收穫</h2>
<p></p>
<p></p>
<ol class="wp-block-list"><p></p>
<li>了解 GPFDIST 基本介紹</li>
<p></p>
<p></p>
<li>創建透過 GPFDIST 協定的外部表語法</li>
<p></p>
</ol>
<p></p>
<p></p>
<h2 class="has-medium-font-size wp-block-heading" id="什麼是GPFDIST"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E4%BB%80%E9%BA%BC%E6%98%AFGPFDIST"></a>什麼是 GPFDIST</h2>
<p></p>
<p></p>
<p>GPFDIST 是 Greenplum Database parallel file distribution program，專門用於處理 Greenplum 對外部檔案進行讀取或寫入。由於 GreenPlum 將自身定位為可處理 PB 等級資料的數據倉儲產品，因此在實際應用場景中，必然會有 ETL 大量資料匯入的需求，此時就可以透過 GPFDIST 以平行處理、協同作業的方式進行極為快速的資料處理。</p>
<p></p>
<p></p>
<p>一般來說，要將外部資料匯入資料庫的方法主要有下面兩種：<br>(1) 單純一筆一筆資料 insert&nbsp;<br>(2) COPY from File</p>
<p></p>
<p></p>
<p>而上述方法都需要仰賴 Master (主節點) 耗費資源來獨立處理，因此可以想像當有大量資料待處理時，不但耗時甚久更可能影響到其他作業程序。</p>
<p></p>
<p></p>
<p>為了解決上述問題並且加速匯入流程，Greenplum 提供了一個基於其 MPP 架構 (Massively Parallel Processor) 的內部套件，也就是 GPFDIST。透過 GPFDIST 可以驅動各個 SEGMENT 平行讀寫來源檔案，進而增加匯入效率。</p>
<p></p>
<p></p>
<h2 class="has-medium-font-size wp-block-heading" id="特點介紹"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E7%89%B9%E9%BB%9E%E4%BB%8B%E7%B4%B9"></a>GPFDIST 特點介紹</h2>
<p></p>
<p></p>
<p>由於 GPFDIST 與各 SEGMENT 是透過 HTTP 協定進行溝通，因此我們可視 GPFDIST 將為 HTTP SERVER 專門處理資料的傳輸發送，而各 SEGMENT 則扮演 HTTP CLIENT 的角色，對 GPFIDST 發送 GET/POST 等請求，受益於這樣的架構概念，帶來了下面幾項特點：</p>
<p></p>
<p></p>
<h3 class="wp-block-heading" id="1支援各種來源檔案" style="font-size:18px"><a href="https://hackmd.io/@AManTw/SkzR973Do#1%E6%94%AF%E6%8F%B4%E5%90%84%E7%A8%AE%E4%BE%86%E6%BA%90%E6%AA%94%E6%A1%88"></a>(1) 支援各種來源檔案</h3>
<p></p>
<p></p>
<p>由於 ETL 或其他來源的資料格式都各不同，因此 GPFDIST 支援了常見的 TEXT、CSV 之外，也能透過 yaml 檔來進行JSON、XML 的轉置導入，而且在建立外部表時，透過 wildcard(*) 來代替完整檔名，在有多份文件匯入時，相當的方便。</p>
<p></p>
<p></p>
<p>除此之外，ETL 時常產出數百 GB 的資料，而這樣龐大的資料直接佔據硬碟空間，其實是很不明智的，因此針對被壓縮過的 ETL 資料檔 (gzip bzip2 bz2 zstd)，GPFDIST 能夠自動解壓縮並且成為外部表的來源，透過 CPU 的運算能力來降低對空間的使用率，使其在各項考量中取得良好的平衡。</p>
<p></p>
<p></p>
<h3 class="wp-block-heading" id="2彈性部屬支援" style="font-size:18px"><a href="https://hackmd.io/@AManTw/SkzR973Do#2%E5%BD%88%E6%80%A7%E9%83%A8%E5%B1%AC%E6%94%AF%E6%8F%B4"></a>(2) 彈性部署支援</h3>
<p></p>
<p></p>
<p>為了讓 Greenplum 主機的資源發揮到最大，通常會規劃將非必要的 loading 放在 ETL 主機執行，此時就可以根據資源的考量，GPFDIST 不只可以隨著 Greenplum 安裝在主機上之外，也能夠部署到 ETL 主機群上，並且透過建表時指定不同網卡 (NIC) 來讓 SEGMENT 們平行讀取/傳輸檔案。讓資料匯入的效率可以大幅提升，而不再將 loading 都依賴 Master 主機上。</p>
<p></p>
<p></p>
<p>而要將 GPFDIST 部署到 ETL 主機上也相當簡單，只要確認好 OS 有相依的套件，就可以直接將 GPFDIST 執行檔複製到 ETL 主機上執行。</p>
<p></p>
<p></p>
<pre class="wp-block-code"><code># gpfdist version "6.22.0"
[root@mdw ~]# ldd ./gpfdist
        linux-vdso.so.1 (0x00007ffd0705d000)
        libbz2.so.1 =&gt; /lib64/libbz2.so.1 (0x00007fb00ec37000)
        libssl.so.1.1 =&gt; /lib64/libssl.so.1.1 (0x00007fb00e9a3000)
        libcrypto.so.1.1 =&gt; /lib64/libcrypto.so.1.1 (0x00007fb00e4ba000)
        libyaml-0.so.2 =&gt; /lib64/libyaml-0.so.2 (0x00007fb00e29a000)
        libzstd.so.1 =&gt; /lib64/libzstd.so.1 (0x00007fb00dff6000)
        libz.so.1 =&gt; /lib64/libz.so.1 (0x00007fb00ddde000)
        libevent-2.1.so.6 =&gt; /lib64/libevent-2.1.so.6 (0x00007fb00db85000)
        libapr-1.so.0 =&gt; /lib64/libapr-1.so.0 (0x00007fb00d94b000)
        libpthread.so.0 =&gt; /lib64/libpthread.so.0 (0x00007fb00d72b000)
        libc.so.6 =&gt; /lib64/libc.so.6 (0x00007fb00d366000)
        libdl.so.2 =&gt; /lib64/libdl.so.2 (0x00007fb00d162000)
        libuuid.so.1 =&gt; /lib64/libuuid.so.1 (0x00007fb00cf5a000)
        libcrypt.so.1 =&gt; /lib64/libcrypt.so.1 (0x00007fb00cd31000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb00ee48000)</code></pre>
<p></p>
<p></p>
<h2 class="has-medium-font-size wp-block-heading" id="語法範例"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E8%AA%9E%E6%B3%95%E7%AF%84%E4%BE%8B"></a>語法範例</h2>
<p></p>
<p></p>
<figure class="wp-block-image aligncenter size-full"><img data-recalc-dims="1" src="https://i0.wp.com/www.omniwaresoft.com.tw/wp-content/uploads/2023/03/gpfdist-%E8%AA%9E%E6%B3%95%E7%AF%84%E4%BE%8B.png?w=1170&#038;ssl=1" alt="gpfdist 語法範例" class="wp-image-35370"></figure>
<p></p>
<p></p>
<p>此處提供了上圖內三種常見情境的對應建表語法(以可讀表為例)，並且將兩組 GPFDIST 運行於 ETL SERVER 中。</p>
<p></p>
<p></p>
<p>模擬資訊如下：</p>
<p></p>
<p></p>
<figure class="wp-block-table">
<table>
<thead>
<tr>
<th>Host_NIC_Name</th>
<th>IP</th>
</tr>
</thead>
<tbody>
<tr>
<td>etl_NIC_1</td>
<td>192.168.0.10</td>
</tr>
<tr>
<td>etl_NIC_2</td>
<td>192.168.0.11</td>
</tr>
</tbody>
</table>
</figure>
<p></p>
<p></p>
<p>ETL 主機運行 GPFDIST 指令：</p>
<p></p>
<p></p>
<pre class="wp-block-code"><code>#透過nohup讓GPFDIST在背景常駐執行
# -p &lt;PORT_NUMBERR&gt;      //指定PORT
# -d &lt;PATH_EXT_FOLDER&gt;   //匯入或讀取資料的目錄路徑
# -l &lt;PATH_LOG_FOLDER&gt;   //GPFDIST執行時的log存放目錄

nohup gpfdist -p 8080 -d /home/gpadmin/ext_folder/ -l /home/gpadmin/gplog1 &amp;
nohup gpfdist -p 8081 -d /home/gpadmin/ext_folder/ -l /home/gpadmin/gplog2 &amp;
</code></pre>
<p></p>
<p></p>
<hr class="wp-block-separator has-css-opacity">
<p></p>
<p></p>
<h3 class="wp-block-heading">情境 1 &#8211; 單 GPFDIST，單檔案</h3>
<p></p>
<p></p>
<p>檔名: ext_file.csv</p>
<p></p>
<p></p>
<pre class="wp-block-code"><code>CREATE EXTERNAL TABLE ext_omni_1 (id int, name char(10)) 
LOCATION ('gpfdist://etl_NIC_1:8080/ext_file.csv') 
FORMAT 'csv';</code></pre>
<p></p>
<p></p>
<h3 class="wp-block-heading" id="情境2---單gpfdist，多檔案"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E6%83%85%E5%A2%832---%E5%96%AEgpfdist%EF%BC%8C%E5%A4%9A%E6%AA%94%E6%A1%88"></a>情境 2 &#8211; 單 GPFDIST，多檔案</h3>
<p></p>
<p></p>
<p>檔名: ext_file1.csv , ext_file2.csv</p>
<p></p>
<p></p>
<pre class="wp-block-code"><code>CREATE EXTERNAL TABLE ext_omni_2 (id int, name char(10)) 
LOCATION ('gpfdist://etl_NIC_1:8080/ext_file1.csv', 
          'gpfdist://etl_NIC_1:8080/ext_file2.csv') 
FORMAT 'csv';

-- 利用wildcard，指定相關檔案 
CREATE EXTERNAL TABLE ext_omni_3 (id int, name char(10)) 
LOCATION ('gpfdist://etl_NIC_1:8080/ext_file*.csv') 
FORMAT 'csv';</code></pre>
<p></p>
<p></p>
<h3 class="wp-block-heading" id="情境3---多gpfdist，多檔案"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E6%83%85%E5%A2%833---%E5%A4%9Agpfdist%EF%BC%8C%E5%A4%9A%E6%AA%94%E6%A1%88"></a>情境 3 &#8211; 多 GPFDIST，多檔案</h3>
<p></p>
<p></p>
<p>檔名: ext_fileA.csv ext_fileB.csv</p>
<p></p>
<p></p>
<pre class="wp-block-code"><code>-- 在/home/gpadmin/ext_folder/下有兩個子目錄: folder_A 及 folder_B
CREATE EXTERNAL TABLE ext_omni_4 (id int, name char(10)) 
LOCATION ('gpfdist://etl_NIC_1:8080/folder_A/ext_fileA.csv', 
          'gpfdist://etl_NIC_2:8081/folder_B/ext_fileB.csv') 
FORMAT 'csv';</code></pre>
<p></p>
<p></p>
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p></p>
<p><strong>[注意]</strong>&nbsp;每張外部表在 location 內的 url 數量，不可以超過 primary instance 的個數。</p>
<p></p>
</blockquote>
<p></p>
<p></p>
<h3 class="wp-block-heading" id="匯入資料"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E5%8C%AF%E5%85%A5%E8%B3%87%E6%96%99"></a>匯入資料</h3>
<p></p>
<p></p>
<pre class="wp-block-code"><code>#讀取外部表 ext_omni_1
 SELECT * FROM ext_omni_1;
 
#將外部表 ext_omni_1 匯入到內部表 omni_table 當中
 INSERT INTO omni_table SELECT * FROM ext_omni_1;</code></pre>
<p></p>
<p></p>
<h2 class="wp-block-heading" id="結論"><a href="https://hackmd.io/@AManTw/SkzR973Do#%E7%B5%90%E8%AB%96"></a>結論</h2>
<p></p>
<p></p>
<p>GPFDIST 做為一款 Greenplum 當中能支援多面向的平行資料傳輸工具，不但相當輕量化而且也能和其他 ETL 系統、服務進行資料流的串接整合。對於需要處理大量資料的 ETL 開發端，更是相當的好上手並且支援多種功能。</p>
<p></p>
<p></p>
<p>除此之外，若是有資料安全的考量，也能支援 SSL 的 gpfdists://Protocol，而當要對匯入的資料內容做更細微處理，Greenplum 更有提供一個以 GPFDIST 為基礎的工具 -GPLOAD，來滿足相應的資料轉置需求。因此在 Greenplum 的環境下，相當推薦使用 GPFDIST 來代替過往單靠 Master 來匯入資料的功能。</p>
<p></p>
<p></p>
<h2 class="has-medium-font-size wp-block-heading" id="REF"><a href="https://hackmd.io/@AManTw/SkzR973Do#REF"></a>[REF]</h2>
<p></p>
<p></p>
<ul class="wp-block-list"><p></p>
<li><a rel="noreferrer noopener" href="https://cn.greenplum.org/greenplum-external-table/" target="_blank">https://cn.greenplum.org/greenplum-external-table/</a></li>
<p></p>
<p></p>
<li><a rel="noreferrer noopener" href="https://greenplum.org/greenplum-etl/" target="_blank">https://greenplum.org/greenplum-etl/</a></li>
<p></p>
<p></p>
<li><a rel="noreferrer noopener" href="https://docs.vmware.com/en/VMware-Tanzu-Greenplum/6/greenplum-database/GUID-admin_guide-external-g-using-the-greenplum-parallel-file-server--gpfdist-.html" target="_blank">https://docs.vmware.com/en/VMware-Tanzu-Greenplum/6/greenplum-database/GUID-admin_guide-external-g-using-the-greenplum-parallel-file-server&#8211;gpfdist-.html</a></li>
<p></p>
</ul>
<p></p>
<p></p>
<hr class="wp-block-separator has-css-opacity is-style-wide">
<p></p>
<p></p>							</div>
										</div>
				</div>
					</div>
		</div>
					</div></div>
		</section>
				</div>
		]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">18600</post-id>	</item>
		<item>
		<title>Greenplum Vacuum Lock 測試</title>
		<link>https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/greenplum-vacuum-lock-test/</link>
		
		<dc:creator><![CDATA[Omni]]></dc:creator>
		<pubDate>Tue, 06 Feb 2018 17:30:47 +0000</pubDate>
				<category><![CDATA[Greenplum 技術專欄]]></category>
		<category><![CDATA[技術專欄]]></category>
		<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Techcolumn]]></category>
		<guid isPermaLink="false">https://goodpoint-studio.com/?p=13029</guid>

					<description><![CDATA[本文作者：Ren 測試一 1.先進行de...]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="13029" class="elementor elementor-13029" data-elementor-post-type="post">
						<section data-particle_enable="false" data-particle-mobile-disabled="false" class="elementor-section elementor-top-section elementor-element elementor-element-d8b6c7c elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="d8b6c7c" data-element_type="section">
						<div class="elementor-container elementor-column-gap-thegem"><div class="elementor-row">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4283a2cd" data-id="4283a2cd" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-4f344285 flex-horizontal-align-default flex-horizontal-align-tablet-default flex-horizontal-align-mobile-default flex-vertical-align-default flex-vertical-align-tablet-default flex-vertical-align-mobile-default elementor-widget elementor-widget-text-editor" data-id="4f344285" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
												<div class="elementor-text-editor elementor-clearfix">
						<p style="text-align: right;">本文作者：Ren</p>
<p>測試一<br>
1.先進行delete 再進行 vacuum analyze<br>
2.表單 t2</p>
<pre>gpadmin=# select * from t2 limit 1000;
&nbsp; &nbsp; i &nbsp; &nbsp; | &nbsp; c
----------+-------
&nbsp;25674464 | xxxxx
&nbsp;25674466 | xxxxx
&nbsp;25674468 | xxxxx
&nbsp;25674470 | xxxxx
&nbsp;25674472 | xxxxx
&nbsp;25674474 | xxxxx
&nbsp;25674476 | xxxxx
&nbsp;25674478 | xxxxx
&nbsp;25674480 | xxxxx
&nbsp;25674482 | xxxxx
&nbsp;25674484 | xxxxx
&nbsp;25674486 | xxxxx
&nbsp;25674488 | xxxxx
&nbsp;25674490 | xxxxx
&nbsp;25674492 | xxxxx
&nbsp;25674494 | xxxxx
&nbsp;25674497 | xxxxx
&nbsp;25674499 | xxxxx 

</pre>
<p>3.先做delete t2</p>
<pre>&nbsp;gpadmin=# delete from t2 where c='xxxxx';

</pre>
<p>4.再執行 vacuum analyze t2</p>
<pre>&nbsp;gpadmin=# vacuum analyze t2;

</pre>
<p>會發現 vacuum analyze 作業等待中</p>
<pre>gpadmin=# select * from pg_stat_activity where waiting = 't';
datid | datname | procpid | sess_id | usesysid | usename | current_query&nbsp;|&nbsp;waiting |&nbsp;query_start | backend_start | client_addr | client_port | application_name | xact_start | waiting_reason
-------+---------+---------+---------+----------+---------+--------------------+
30622 | gpadmin | 13422 | &nbsp; 65855 | 10 | gpadmin | vacuum analyze t2; |&nbsp;t &nbsp;| 2016-04-06 20:09:09.822948+08 | 2016-04-06 20:07:06.2235+08 | | &nbsp;| psql &nbsp;| 2016-04-06 20:09:09.822948+08 | lock
(1 row)

</pre>
<hr>
<p>測試二 先進行 vacuum analyze,再進行 delete</p>
<p>結果為 &nbsp;delete 作業等待</p>
<pre>gpadmin=# select * from pg_stat_activity where waiting = 't';
datid | datname | procpid | sess_id | usesysid | usename |&nbsp; current_query&nbsp; | waiting |&nbsp; &nbsp;query_start&nbsp; &nbsp; |&nbsp; backend_start&nbsp;&nbsp;| client_addr | client_port | application_name |&nbsp; xact_start&nbsp;| waiting_reason
-------+---------+---------+---------+----------+---------+---------------------------------+---------+-------------------------------+--------------------------------------+-------------------------------------
30622 | gpadmin | &nbsp; 13241 | &nbsp; 65834 | 10 | gpadmin | delete from t2 where&nbsp;c='xxxxx'; | t&nbsp; &nbsp; &nbsp;2016-04-06 20:11:46.766068+08 | 2016-04-06 20:06:23.696965+08 |&nbsp; &nbsp; |&nbsp; &nbsp;-1 | psql&nbsp; &nbsp; | 2016-04-06 20:11:46.766068+08 | lock
(1 row)</pre>							</div>
										</div>
				</div>
					</div>
		</div>
					</div></div>
		</section>
				</div>
		]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">13029</post-id>	</item>
		<item>
		<title>Greenplum 如何確認暫存表</title>
		<link>https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/greenplum-how-to-check-temptables/</link>
		
		<dc:creator><![CDATA[Omni]]></dc:creator>
		<pubDate>Tue, 06 Feb 2018 09:13:41 +0000</pubDate>
				<category><![CDATA[Greenplum 技術專欄]]></category>
		<category><![CDATA[技術專欄]]></category>
		<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Techcolumn]]></category>
		<guid isPermaLink="false">https://goodpoint-studio.com/?p=13016</guid>

					<description><![CDATA[本文作者：Ren 步驟如下: 1.查Re...]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="13016" class="elementor elementor-13016" data-elementor-post-type="post">
						<section data-particle_enable="false" data-particle-mobile-disabled="false" class="elementor-section elementor-top-section elementor-element elementor-element-3f2d4599 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="3f2d4599" data-element_type="section">
						<div class="elementor-container elementor-column-gap-thegem"><div class="elementor-row">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3553979f" data-id="3553979f" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-21a6e41b flex-horizontal-align-default flex-horizontal-align-tablet-default flex-horizontal-align-mobile-default flex-vertical-align-default flex-vertical-align-tablet-default flex-vertical-align-mobile-default elementor-widget elementor-widget-text-editor" data-id="21a6e41b" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
												<div class="elementor-text-editor elementor-clearfix">
						<p style="text-align: right;">本文作者：Ren</p>
<p>步驟如下:</p>
<p>1.查Ren這個帳號，在GPDB&nbsp;中建了多少個&nbsp;temp table</p>
<pre>gpadmin=# SELECT * FROM pg_tables WHERE schemaname like 'pg_temp%' and tableowner='ren';
schemaname&nbsp; &nbsp;| tablename | tableowner | tablespace | hasindexes | hasrules | hastriggers
---------------+-----------+------------+------------+------------+----------+-------------
&nbsp;pg_temp_69393 | t1&nbsp; &nbsp; &nbsp; &nbsp; | ren&nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; | f
&nbsp;pg_temp_69393 | t2&nbsp; &nbsp; &nbsp; &nbsp; | ren&nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; | f
&nbsp;pg_temp_69393 | t3&nbsp; &nbsp; &nbsp; &nbsp; | ren&nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; | f
&nbsp;pg_temp_69399&nbsp;| t4&nbsp; &nbsp; &nbsp; &nbsp; | ren&nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | f&nbsp; &nbsp; &nbsp; &nbsp; | f
(4 rows)</pre>
<p>2.temp table&nbsp;的大小&nbsp;</p>
<pre>gpadmin=# select pg_size_pretty(pg_relation_size('pg_temp_69393.t1'));;
&nbsp;pg_size_pretty
----------------
&nbsp;182 MB
(1 row)
Time: 11.951 ms
Time: 0.151 ms
gpadmin=# select pg_size_pretty(pg_relation_size('pg_temp_69393.t2'));;
&nbsp;pg_size_pretty
----------------
&nbsp;34 MB
(1 row)</pre>
<p>3.如何確認活動狀態</p>
<pre>gpadmin=# select * from pg_stat_activity ;
&nbsp;datid | datname | procpid | sess_id | usesysid | usename | current_query &nbsp;| waiting | query_start
&nbsp;backend_start &nbsp; | client_addr | client_port | application_name | xact_start &nbsp;| waiting_reason
-------+---------+---------+---------+----------+---------+------------------------------------------------------+---------+-------------------------
30622 | gpadmin | &nbsp; 46241 | &nbsp;&nbsp;69399&nbsp;| &nbsp; &nbsp;33496 | ren &nbsp; &nbsp; | insert into t4 values(generate_series(1,150000000)); | f &nbsp;| 2016-04-11 10:17:30.684044+08 | 2016-04-11 10:17:06.261786+08 | &nbsp;  &nbsp; | &nbsp;&nbsp;-1 | psql &nbsp;  | 2016-04-11 10:17:30.684044+08 |</pre>							</div>
										</div>
				</div>
					</div>
		</div>
					</div></div>
		</section>
				</div>
		]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">13016</post-id>	</item>
		<item>
		<title>Greenplum Database角色及權限管理</title>
		<link>https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/greenplum-database-roles-management/</link>
		
		<dc:creator><![CDATA[Omni]]></dc:creator>
		<pubDate>Thu, 01 Feb 2018 10:07:56 +0000</pubDate>
				<category><![CDATA[Greenplum 技術專欄]]></category>
		<category><![CDATA[技術專欄]]></category>
		<category><![CDATA[Greenplum]]></category>
		<category><![CDATA[Techcolumn]]></category>
		<guid isPermaLink="false">https://goodpoint-studio.com/?p=12961</guid>

					<description><![CDATA[Ren 創建一個角色Ren,使其能夠存取...]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="12961" class="elementor elementor-12961" data-elementor-post-type="post">
						<section data-particle_enable="false" data-particle-mobile-disabled="false" class="elementor-section elementor-top-section elementor-element elementor-element-5a02fc5c elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="5a02fc5c" data-element_type="section">
						<div class="elementor-container elementor-column-gap-thegem"><div class="elementor-row">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7eb3776b" data-id="7eb3776b" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-6913044d flex-horizontal-align-default flex-horizontal-align-tablet-default flex-horizontal-align-mobile-default flex-vertical-align-default flex-vertical-align-tablet-default flex-vertical-align-mobile-default elementor-widget elementor-widget-text-editor" data-id="6913044d" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
												<div class="elementor-text-editor elementor-clearfix">
						<p style="text-align: right;">Ren</p>
<p>創建一個角色Ren,使其能夠存取資料庫gpadmin下的schema_1.table_1表單<br>
Database gpadmin<br>
tablename&nbsp; table_1<br>
schemaname schema_1</p>
<h2><strong>方法一.創建使用者 並給予權限</strong></h2>
<p>psql -d gpadmin<br>
建立使用者給予登入權限<br>
=#Create role Ren with login;<br>
配置密碼<br>
=#Alter role Ren with password &#8216;ren&#8217;;</p>
<p>給予Ren角色存取schema_1.table_1 的權限<br>
=#grant ALL on table schema_1.table_1 to Ren;<br>
=#grant ALL on schema schema_1 to Ren;</p>
<p>給予Ren角色在database下建立schema的權限<br>
=#grant ALL on database gpadmin to Ren;<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>可以指定範圍權限<br>
=#grant select on table schema_1.table_1 to Ren;<br>
=#grant insert on table schema_1.table_1 to Ren;<br>
可移除指定範圍權限&nbsp;<br>
=#revoke select on table schema_1.table_1 from Ren;<br>
可移除所有權限<br>
=#REVOKE ALL PRIVILEGES ON schema_1.table_1 FROM Ren;</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<h2><strong>方法二.創立群組,直接給予使用者(群組權限)</strong></h2>
<p>=#Create role Rengroup CREATEROLE CREATEDB;&nbsp; (群組不給予登入權限)<br>
=#grant ALL on table schema_1.table_1 to Rengroup;<br>
=#grant ALL on schema schema_1 to Rengroup;<br>
=#grant ALL on database gpadmin to Rengroup;<br>
給予角色群組權限<br>
=#grant Rengroup to Ren,Alex;<br>
移除角色群組權限<br>
=#revoke Rengroup FROM REN;<br>
如果無法移除角色代表角色有自己的物件(表單)</p>
<ol>
<li>先轉移角色的物件</li>
</ol>
<p>REASSIGN OWNED 角色A TO 角色B<br>
Drop role by 角色A</p>
<ol start="2">
<li>或連角色所OWNED物件也移除</li>
</ol>
<p>DROP OWNED BY 角色A<br>
DROP ROLE BY 角色A</p>
<h2><strong>三.修改客戶端訪問權限管理(/data/master/gpseg-1/pg_hba.conf）</strong></h2>
<p>vi pg_hba.conf<br>
最底下加入<br>
遠端或本地&nbsp; 資料庫&nbsp; 使用者&nbsp; md5驗證<br>
local&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpadmin&nbsp;&nbsp; Ren&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; md5<br>
host&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpadmin&nbsp;&nbsp; Ren&nbsp;&nbsp;&nbsp; 遠端來源IP&nbsp; md5<br>
<img data-recalc-dims="1" class="aligncenter wp-image-12962" src="https://i0.wp.com/104.154.39.219/wp-content/uploads/2018/02/Greenplum-Database%E8%A7%92%E8%89%B2%E5%8F%8A%E6%AC%8A%E9%99%90%E7%AE%A1%E7%90%861.png?resize=500%2C41" alt="Greenplum Database角色及權限管理1" width="500" height="41"><br>
資料庫需重新讀取參數<br>
gpstop -u</p>
<h2><strong>四.登入測試(登入gpadmin資料庫,使用者為Ren)</strong></h2>
<p>psql -d gpadmin -U Ren<br>
select * from schema_1.table_1;</p>
<h2><strong>五.角色權限請參考</strong></h2>
<table style="height: 702px;" width="559">
<tbody>
<tr>
<td style="text-align: center;"><b>Attributes</b></td>
<td style="text-align: left;">
<p style="text-align: center;"><b>Description</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>SUPERUSER | NOSUPERUSER</b></p>
</td>
<td>
<p style="text-align: left;"><b>Determines if the role is a superuser. A superuser always bypasses all access permission checks within the database and has full access to everything. Superuser status is dangerous and should be used only when really needed. You must yourself be a superuser to create a new superuser. NOSUPERUSER is the default.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>CREATEDB | NOCREATEDB</b></p>
</td>
<td>
<p style="text-align: left;"><b>Determines if the role is allowed to create databases. NOCREATEDB is the default.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>CREATEROLE | NOCREATEROLE</b></p>
</td>
<td>
<p style="text-align: left;"><b>Determines if the role is allowed to create and manage other roles. NOCREATEROLE is the default.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>INHERIT | NOINHERIT</b></p>
</td>
<td>
<p style="text-align: left;"><b>Determines whether a role inherits the privileges of roles it is a member of. A role with the INHERIT attribute can automatically use whatever database privileges have been granted to all roles it is directly or indirectly a member of. INHERIT is the default.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>LOGIN | NOLOGIN</b></p>
</td>
<td>
<p style="text-align: left;"><b>Determines whether a role is allowed to log in. A role having the LOGIN attribute can be thought of as a user. Roles without this attribute are useful for managing database privileges (groups). NOLOGIN is the default.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>CONNECTION LIMIT </b><b><i>connlimit</i></b></p>
</td>
<td style="text-align: left;">
<p style="text-align: left;"><b>If role can log in, this specifies how many concurrent connections the role can make. -1 (the default) means no limit.</b></p>
</td>
</tr>
<tr>
<td style="text-align: left;"><b>PASSWORD ‘</b><b><i>password</i></b><b>’</b></td>
<td>
<p style="text-align: left;"><b>Sets the role’s password. If you do not plan to use password authentication you can omit this option. If no password is specified, the password will be set to null and password authentication will always fail for that user. A null password can optionally be written explicitly as PASSWORD NULL.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>ENCRYPTED | UNENCRYPTED</b></p>
</td>
<td style="text-align: left;"><b>Controls whether the password is stored encrypted in the system catalogs. The default behavior is determined by the configuration parameter </b><b>password_encryption </b><b>(currently set to MD5). If the presented password string is already in MD5-encrypted format, then it is stored encrypted as-is, regardless of whether ENCRYPTED or UNENCRYPTED is specified (since the system cannot decrypt the specified encrypted password string). This allows reloading of encrypted passwords during dump/restore.</b></td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>VALID UNTIL ‘</b><b><i>timestamp</i></b><b>’</b></p>
</td>
<td>
<p style="text-align: left;"><b>Sets a date and time after which the role’s password is no longer valid. If omitted the password will be valid for all time.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>RESOURCE QUEUE </b><b><i>queue_name</i></b></p>
</td>
<td>
<p style="text-align: left;"><b>Assigns the role to the named resource queue for workload management. Any statement that role issues is then subject to the resource queue’s limits. Note that the RESOURCE QUEUE attribute is not inherited; it must be set on each user-level (LOGIN) role.</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>DENY {deny_interval | deny_point}</b></p>
</td>
<td>
<p style="text-align: left;"><b>Restricts access during an interval, specified by day or day and time. For more information see “Time-based Authentication” on page 35.</b></p>
</td>
</tr>
</tbody>
</table>
<h2><strong>六.物件權限請參考</strong></h2>
<table style="height: 552px;" width="301">
<tbody>
<tr>
<td>
<p style="text-align: center;"><b>Object Type</b></p>
</td>
<td>
<p style="text-align: center;"><b>Privileges</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>Tables, Views, Sequences</b></p>
</td>
<td>
<p style="text-align: left;"><b>SELECT</b></p>
<p style="text-align: left;"><b>INSERT</b></p>
<p style="text-align: left;"><b>UPDATE</b></p>
<p style="text-align: left;"><b>DELETE</b></p>
<p style="text-align: left;"><b>RULE</b></p>
<p style="text-align: left;"><b>ALL</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>External Tables</b></p>
</td>
<td>
<p style="text-align: left;"><b>SELECT</b></p>
<p style="text-align: left;"><b>RULE</b></p>
<p style="text-align: left;"><b>ALL</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>Databases</b></p>
</td>
<td style="text-align: left;"><b>CONNECT</b><br>
<b>CREATE</b><br>
<b>TEMPORARY | TEMP</b><br>
<b>ALL</b></td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>Functions</b></p>
</td>
<td>
<p style="text-align: left;"><b>EXECUTE</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>Procedural Languages</b></p>
</td>
<td>
<p style="text-align: left;"><b>USAGE</b></p>
</td>
</tr>
<tr>
<td>
<p style="text-align: left;"><b>Schemas</b></p>
</td>
<td>
<p style="text-align: left;"><b>CREATE</b></p>
<p style="text-align: left;"><b>USAGE</b></p>
<p style="text-align: left;"><b>ALL</b></p>
</td>
</tr>
</tbody>
</table>
<h5><strong>七.參考原廠文件</strong></h5>
<p>GPDB43AdminGuide.pdf<br>
Chapter 12.Managing Roles and Privileges</p>							</div>
										</div>
				</div>
					</div>
		</div>
					</div></div>
		</section>
				</div>
		]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">12961</post-id>	</item>
		<item>
		<title>如何在 Pivotal Greenplum Database 擴充節點</title>
		<link>https://www.omniwaresoft.com.tw/techcolumn/greenplum-techcolumn/greenplum-how-to-extend-nodes/</link>
		
		<dc:creator><![CDATA[Omni]]></dc:creator>
		<pubDate>Thu, 28 Dec 2017 17:15:06 +0000</pubDate>
				<category><![CDATA[Greenplum 技術專欄]]></category>
		<category><![CDATA[技術專欄]]></category>
		<category><![CDATA[Greenplum]]></category>
		<guid isPermaLink="false">https://goodpoint-studio.com/?p=12626</guid>

					<description><![CDATA[如何在 Pivotal Greenplum Database 擴充節點，及擴容常見問題列表及注意事項]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="12626" class="elementor elementor-12626" data-elementor-post-type="post">
						<section data-particle_enable="false" data-particle-mobile-disabled="false" class="elementor-section elementor-top-section elementor-element elementor-element-1d98e4d0 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="1d98e4d0" data-element_type="section">
						<div class="elementor-container elementor-column-gap-thegem"><div class="elementor-row">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5b55e3" data-id="5b55e3" data-element_type="column">
			<div class="elementor-widget-wrap elementor-element-populated">
						<div class="elementor-element elementor-element-122e32fc flex-horizontal-align-default flex-horizontal-align-tablet-default flex-horizontal-align-mobile-default flex-vertical-align-default flex-vertical-align-tablet-default flex-vertical-align-mobile-default elementor-widget elementor-widget-text-editor" data-id="122e32fc" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
												<div class="elementor-text-editor elementor-clearfix">
						<p><strong>gpexpand Lab (</strong><strong>以下遮蔽系統訊息方便閱讀</strong><strong>)</strong></p>
<table style="height: 165px;" width="442">
<tbody>
<tr>
<td width="279"><strong>擴容前的環境</strong></td>
<td width="279"><strong>擴容後的環境</strong></td>
</tr>
<tr>
<td width="279"><strong>1Master +2 Segment </strong></td>
<td width="279"><strong>1Master +4 Segment</strong></td>
</tr>
<tr>
<td width="279"><strong>mdw</strong><br>
<strong>sdw1</strong><br>
<strong>sdw2</strong><br>
<strong>&nbsp;</strong></td>
<td width="279"><strong>mdw</strong><br>
<strong>sdw1</strong><br>
<strong>sdw2</strong><br>
<strong>sdw3</strong><br>
<strong>sdw4</strong></td>
</tr>
</tbody>
</table>
<p><strong><em>於正式環境需經過完整的規劃及考量</em></strong><strong><em>,</em></strong><strong><em>並通過</em></strong><strong><em> (gpcheck)</em></strong><strong><em>及</em></strong><strong><em>(gpcheckperf)</em></strong><strong><em>等等驗證</em></strong><strong><em>.</em></strong><br>
<strong><em>&nbsp;</em></strong></p>
<table>
<tbody>
<tr>
<td width="279"><strong>hostfile</strong><strong>加入下列主機</strong></td>
<td width="279"><strong>newhostfile</strong><strong>加入下列主機</strong></td>
</tr>
<tr>
<td width="279"><strong>mdw</strong><br>
<strong>sdw1</strong><br>
<strong>sdw2</strong><br>
<strong>sdw3</strong><br>
<strong>sdw4</strong></td>
<td width="279"><strong>sdw3</strong><br>
<strong>sdw4</strong><br>
<strong>&nbsp;</strong></td>
</tr>
</tbody>
</table>
<p><strong>[gpadmin@mdw ~]$ gpssh-exkeys -f hostfile &nbsp;</strong><br>
<strong>(</strong><strong>重新交換金鑰</strong><strong>)</strong><br>
<strong>[gpadmin@mdw ~]$gpssh –f newhostfile</strong><br>
<strong>(</strong><strong>透過</strong><strong>gpssh</strong><strong>部署環境在新節點</strong><strong>)</strong></p>
<ul>
<li><strong>mkdir /data1/mirror</strong></li>
<li><strong>mkdir /data2/mirror</strong></li>
<li><strong>mkdir /data1/primary</strong></li>
<li><strong>mkdir /data2/primary</strong></li>
</ul>
<p><strong>[gpadmin@mdw ~]$ gpseginstall -f newhostfile </strong><br>
<strong>(</strong><strong>安裝</strong><strong>greenplum db</strong><strong>於新增節點</strong><strong>)</strong><br>
<strong>[gpadmin@mdw ~]$ gpexpand -f newhost</strong><br>
<strong>…….</strong><br>
<strong>Please refer to the Admin Guide for more information.</strong><br>
<strong>Would you like to initiate a new System Expansion Yy|Nn (default=N):</strong></p>
<ul>
<li><strong>Y</strong></li>
</ul>
<p><strong>請選擇</strong><strong>Y,</strong><strong>否則會跳出此次命令</strong><br>
<strong>…….</strong><br>
<strong>How many new primary segments per host do you want to add? (default=0):</strong></p>
<ul>
<li><strong>0</strong></li>
</ul>
<p><strong>是否希望提升每個節點的</strong><strong>primary segment ,</strong><strong>預設為</strong><strong>0</strong><br>
<strong>Please review the file and make sure that it is correct then re-run</strong><br>
<strong>with: gpexpand -i gpexpand_inputfile_20150715_103959 -D gpadmin</strong><br>
<strong>….</strong><br>
<strong>將會產生一個</strong><strong>gpexpand_inputfile_20150715_103959</strong><strong>配置文件&nbsp;</strong><br>
<strong>確認設定檔沒有問題後</strong><strong>,</strong><strong>進行</strong><strong>gpexpand</strong><br>
<strong>[gpadmin@mdw ~]$ gpexpand -i gpexpand_inputfile_20150715_103959 -D gpadmin&nbsp; </strong><br>
<strong>-D</strong><strong>為指定</strong><strong>gpexpand schema</strong><strong>存放在哪個</strong><strong>DB</strong><br>
<strong>(</strong><strong>注意此時資料庫將會鎖定備份</strong><strong>/data/master</strong><strong>下的資料</strong><strong>,</strong><strong>目標位置</strong><strong>hostname </strong><strong>必須正確</strong><strong> /etc/sysconfig/network)</strong><br>
<strong>如果失敗了並發現錯誤訊息</strong><strong>,</strong><strong>修正錯誤後進行</strong><strong>rollback</strong><br>
<strong>[gpadmin@mdw ~]$ gpstart -m</strong><br>
<strong>(</strong><strong>只啟動</strong><strong>Master)</strong><br>
<strong>[gpadmin@mdw ~]$ gpexpand &#8211;rollback</strong><br>
<strong>[gpadmin@mdw ~]$ gpstart </strong><br>
<strong>順利完成後依照指式進行資料打散的任務</strong><br>
<strong>[gpadmin@mdw ~]$ gpexpand -d 60:00:00</strong><br>
<strong>(</strong><strong>指定</strong><strong>60</strong><strong>小時內完成</strong><strong>,</strong><strong>執行過程中最消耗資源的表單資料重分佈</strong><strong>,</strong><strong>系統將會在比較空閒時執行</strong><strong>)</strong><br>
<strong>[gpadmin@mdw ~]$ psql -c ‘ select * from pg_stat_activity’</strong><br>
<strong>(</strong><strong>查詢現在正在運行的</strong><strong>SQL)</strong><br>
<strong>[gpadmin@mdw ~]$ psql -c ‘select * from gpexpand.status_detail’ -d gpadmin</strong><br>
<strong>(</strong><strong>表單分佈狀態</strong><strong>)</strong><br>
<strong>以下為</strong><strong>gpexpand schema</strong><strong>所產生的視圖</strong></p>
<ul>
<li><strong>status </strong><strong>起始時間</strong></li>
<li><strong>status_detail </strong><strong>完成哪幾個表單及哪幾個表單尚未開始</strong></li>
<li><strong>expansion_progress </strong><strong>資料平衡的總進度</strong></li>
</ul>
<p>當gpexpand -d 意外停止時,可以在重新開始執行將會繼續未完成的表單<br>
確認任務都完成後進行gpexpand schema清除<br>
[gpadmin@mdw ~]$ gpexpand -c<br>
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<h2><strong>擴容常見問題列表及注意事項</strong></h2>
<ol>
<li><strong>確認</strong><strong> /data/master </strong><strong>空間會增加一倍</strong><strong> (</strong><strong>需注意</strong><strong>metadata</strong><strong>的存放空間</strong><strong>)</strong></li>
<li><strong>確認</strong><strong> /data/master/gpseg-1/gppermon/data </strong><strong>檔案數量可能到千萬</strong><strong>,</strong><strong>將會造成</strong><strong>gpexpan -i </strong><strong>無法完成</strong><strong>.</strong></li>
</ol>
<p style="padding-left: 40px;"><strong>[gpadmin@mdw ~]$ cd /data/master/gpseg-1/gppermon/data</strong><br>
<strong>[gpadmin@mdw ~]$ ls -1|wc -l </strong><strong>算檔案數量</strong><br>
<strong>[gpadmin@mdw ~]$ rm -rf *</strong><br>
<strong>如果檔案數太多刪不掉</strong> <strong>需使用</strong><strong> xargs rm</strong><br>
<strong>[gpadmin@mdw ~]$ find . -name &#8216;*&#8217; | xargs rm</strong></p>
<ol start="3">
<li><strong>gpexpand:mdw:gpadmin-[ERROR]:-gpexpand failed: Invalid database &#8216;template1&#8217; specified. Cannot use a template database.</strong></li>
</ol>
<p style="padding-left: 40px;"><strong>Please set the environment variable PGDATABASE to a different database or use the -D option to specify a database and re-run</strong><br>
<strong>[gpadmin@mdw ~]$ export PGDATABASE=gpadmin</strong><br>
<strong>指定您的</strong><strong>PGDATABASE</strong></p>
<p>4.在有Mirror的狀態下Greenplum只允許一次擴容兩個節點以上，可參考如何擴充單一節點並手動搬移Mirror.</p>							</div>
										</div>
				</div>
					</div>
		</div>
					</div></div>
		</section>
				</div>
		]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">12626</post-id>	</item>
	</channel>
</rss>
