Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux綜合 >> 學習 Linux

Greenplum 源碼編譯安裝指南:單機與集群部署

Greenplum 源碼安裝與部署入門

Greenplum 是基於 PostgreSQL 的 MPP 資料庫,常用於分析型工作負載。本文以 CentOS 7 為例,說明從源碼編譯、單機模式到集群模式的基本流程。

一、環境準備

建議使用全新安裝的 64 位元 CentOS 7,並先關閉 SELinux 與防火牆,或只放行資料庫所需埠口。安裝前需準備 git、gcc、python、openssl、perl、libxml2、openldap、pam、flex、bison 等相依套件。

yum install -y git
git clone https://github.com/greenplum-db/gpdb

二、編譯安裝

進入 gpdb 目錄後,使用 configure 指定安裝路徑與必要模組,再執行 make 與 make install。

./configure --prefix=/data/program/gpsql --with-gssapi --with-pgport=5432 --with-perl --with-python --with-openssl --with-pam --with-krb5 --with-ldap --with-libxml
make
make install

三、單機模式

單機模式是把 Master 與 Segment 放在同一台主機。此時 hosts 解析不能全部指向 127.0.0.1,建議讓 Master 與 Segment 使用同一個正式 IP,並設定主機名稱。

10.1.5.10 mdw sdw

接著建立 gpadmin 使用者與資料目錄,並設定 MASTER_DATA_DIRECTORY 與 greenplum_path.sh。

export MASTER_DATA_DIRECTORY=/home/gpadmin/masterdata/gpseg-1
source /data/program/gpsql/greenplum_path.sh

再建立 all_hosts、seg_hosts 與 gpinitsystem_config,最後執行 gpssh-exkeys 建立信任關係,並以 gpinitsystem 初始化。

四、集群模式

集群模式需要 Master 與多台 Segment。Master 要能解析所有節點,各 Segment 也要能解析自身。Segment 不必重新編譯,可由 Master 透過 gpseginstall 推送安裝。

gpseginstall -f /home/gpadmin/all_hosts -u gpadmin -p 123456

之後建立 segmentdata 與 segmentmirror 目錄,使用 chrony 同步時間,再設定 gpinitsystem_config 並初始化。

五、備份與還原

可使用 gpcrondump 備份資料庫,並以 gpdbrestore 還原。備份包含全域物件與資料表,適合跨庫遷移。

gpcrondump -x db -c -g -G -a -q
gpdbrestore -b 20161003

若初始化失敗,務必先執行回滾腳本,再重新初始化,否則可能發生檔案已存在的錯誤。

Copyright © Linux教程網 All Rights Reserved