Greenplum安裝

環(huán)境準(zhǔn)備

本文只搭建一個虛擬機(jī)畏腕,適合初學(xué)者練習(xí),同時本文也列出了現(xiàn)實中集群部署的操作與建議。

  • VMWare
    虛擬機(jī)分配2G內(nèi)存時創(chuàng)建數(shù)據(jù)庫報錯绢彤。注意內(nèi)存分配多一些。
  • CentOS 7.3.1611: 網(wǎng)易開源鏡像站下載

    版本建議(CentOS版本不要學(xué)我r殉堋):
    This directory (and version of CentOS) is deprecated. For normal users,
    you should use /7/ and not /7.3.1611/ in your path. Please see this FAQ
    concerning the CentOS release scheme:
    https://wiki.centos.org/FAQ/General
    If you know what you are doing, and absolutely want to remain at the 7.3.1611
    level, go to http://vault.centos.org/ for packages.
    Please keep in mind that 7.3.1611 no longer gets any updates, nor
    any security fix's.

  • Greenplum 5.4.0:官方下載
    Greenplum官方下載
  • 部署目標(biāo):一臺機(jī)器搭建Greenplum:Master + 2 * Primary Segment + 2 * Mirror Segment茫舶。

1. VMWare安裝CentOS及準(zhǔn)備工作

VMWare上安裝CentOS步驟略

1.1 數(shù)據(jù)盤

Greenplum數(shù)據(jù)盤需要使用xfs格式,建議建立獨(dú)立的分區(qū)刹淌,方便管理饶氏。在RHEL/CentOS 6中,需要注意設(shè)置有勾;在RHEL/CentOS 7中疹启,默認(rèn)為xfs格式。


分區(qū)

1.2 配置選擇

  • 典型的Greenplum集群由Master + Master Standby + n * Segment構(gòu)成蔼卡。
  • Master Standby通常是獨(dú)立的物理節(jié)點(diǎn)喊崖,也可以和某一個Segment部署在一起(不推薦)。在不要求高可用的情況下雇逞,甚至可以不設(shè)置Master Standby荤懂。
  • 要求每臺Segment應(yīng)具有相同的硬件配置。
  • Master及Master Standby不存儲數(shù)據(jù)塘砸,對磁盤空間無特殊要求节仿。
  • 交換機(jī)要盡量高配置的。
  • 本例為單臺機(jī)器掉蔬,和集群部署不同的地方會單獨(dú)指出廊宪。

1.3 主機(jī)名

集群中建議如下命名查近,方便統(tǒng)一管理:

  • mdw0: Master
  • mdw1: Master Standby
  • sdw0: Segment 1
    ……
  • sdwn: Segment n

設(shè)置主機(jī)名,vi /etc/sysconfig/network挤忙,加入如下內(nèi)容:

# for gpdb
NETWORKING=yes
HOSTNAME=mdw1

vi /etc/hostname:

mdw1

1.4 hosts

集群中所有的服務(wù)器都要配置霜威,本例中只有一臺。vi /etc/hosts册烈,加入如下內(nèi)容:

# for gpdb
192.168.199.244 mdw1

測試:ping mdw1戈泼。

雙網(wǎng)卡vi /etc/systemcfg/network-scrits,略

1.5 關(guān)閉防火墻

依次執(zhí)行:systemctl stop firewalld.service赏僧,systemctl disable firewalld.service大猛。
查看防火墻狀態(tài)systemctl status firewalld.service

1.6 關(guān)閉SELINUX

關(guān)閉SELINUX淀零,vi /etc/selinux/config

SELINUX=disabled

1.7 重啟

reboot -f挽绩,重啟機(jī)器。

2. 安裝Greenplum

本節(jié)所有操作均在Master節(jié)點(diǎn)上驾中,以root用戶進(jìn)行操作唉堪。

2.1 上傳、解壓縮肩民、安裝

  1. 上傳安裝包"greenplum-db-5.4.0-rhel7-x86_64.zip";
  2. 解壓縮:unzip greenplum-db-5.4.0-rhel7-x86_64.zip;
  3. 安裝:./greenplum-db-5.4.0-rhel7-x86_64.bin;
  4. 空格鍵滾動安裝信息唠亚,按照提示一路安裝;


    安裝提示
  5. 完成安裝持痰。


    完成安裝

2.2 引入Greenplum運(yùn)行環(huán)境

source /usr/local/greenplum-db/greenplum_path.sh灶搜,如果改動了步驟2.1中的安裝路徑,請自行調(diào)整工窍。后面安裝過程中重啟機(jī)器時割卖,需要再執(zhí)行一下此操作。

2.3 hostlist和seglist

分別創(chuàng)建兩個文件患雏,其中hostlist中填寫所有節(jié)點(diǎn)的主機(jī)名鹏溯;seglist中填寫所有Segment的主機(jī)名(即不包括Master和Master Standby)。本例中只有一個節(jié)點(diǎn)纵苛,且為Master + Segment剿涮,故vi hostlist

mdw1

保存文件。這兩個文件(本例中由于單節(jié)點(diǎn)攻人,是一個文件)后面會用到取试。

2.4 免密登錄

執(zhí)行命令:gpssh-exkeys -f hostlist

微信截圖_20180427163844.png

2.5 gpseginstall

執(zhí)行命令怀吻,向所有節(jié)點(diǎn)部署:

gpseginstall -f hostlist -u gpadmin -p gpadmin

會創(chuàng)建系統(tǒng)用戶gpadmin瞬浓,初始密碼為gpadmin。

2.6 gpcheck

執(zhí)行命令:

gpcheck -f hostlist -m mdw1

本例中沒有Master Standby節(jié)點(diǎn)蓬坡,如果有猿棉,需要在上述命令后面再加上-s 主機(jī)名選項磅叛。
可以看到南用,報出了大量錯誤莹菱,下面將根據(jù)提示,逐個修改:

20180427:16:46:32:004229 gpcheck:mdw1:root-[INFO]:-dedupe hostnames
20180427:16:46:32:004229 gpcheck:mdw1:root-[INFO]:-Detected platform: Generic Linux Cluster
20180427:16:46:32:004229 gpcheck:mdw1:root-[INFO]:-generate data on servers
20180427:16:46:33:004229 gpcheck:mdw1:root-[INFO]:-copy data files from servers
20180427:16:46:33:004229 gpcheck:mdw1:root-[INFO]:-delete remote tmp files
20180427:16:46:33:004229 gpcheck:mdw1:root-[INFO]:-
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): on device (sr0) IO scheduler 'cfq' does not match expected value 'deadline'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): on device (/dev/sda3) blockdev readahead value '8192' does not match expected value '16384'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): on device (/dev/sda1) blockdev readahead value '8192' does not match expected value '16384'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): on device (/dev/sda2) blockdev readahead value '8192' does not match expected value '16384'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): on device (/dev/sda) blockdev readahead value '8192' does not match expected value '16384'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.ipv4.ip_local_port_range'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'vm.overcommit_memory'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.msgmax'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.ipv4.tcp_syncookies'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.ipv4.tcp_max_syn_backlog'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.core.netdev_max_backlog'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.sem'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.ipv4.conf.all.arp_filter'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.shmall'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.msgmnb'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.ipv4.ip_forward'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.shmmax'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.shmmni'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.ipv4.conf.default.accept_source_route'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.msgmni'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.core_uses_pid'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'net.ipv4.tcp_tw_recycle'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): variable not detected in /etc/sysctl.conf: 'kernel.sysrq'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): soft nofile not found in /etc/security/limits.conf
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): hard nproc not found in /etc/security/limits.conf
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): soft nproc not found in /etc/security/limits.conf
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): hard nofile not found in /etc/security/limits.conf
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/mapper/cl-root has 5 XFS mount options and 4 are expected
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/mapper/cl-root is missing the recommended mount option 'allocsize=16m'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/mapper/cl-root is missing the recommended mount option 'noatime'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/sda1 has 5 XFS mount options and 4 are expected
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'allocsize=16m'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/sda1 is missing the recommended mount option 'noatime'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/sda3 has 5 XFS mount options and 4 are expected
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/sda3 is missing the recommended mount option 'allocsize=16m'
20180427:16:46:33:004229 gpcheck:mdw1:root-[ERROR]:-GPCHECK_ERROR host(mdw1): XFS filesystem on device /dev/sda3 is missing the recommended mount option 'noatime'
20180427:16:46:33:004229 gpcheck:mdw1:root-[INFO]:-gpcheck completing...

3. 根據(jù)gpcheck提示進(jìn)行調(diào)整

本節(jié)為系統(tǒng)參數(shù)調(diào)整驱闷,需要針對gpcheck檢查結(jié)果杖爽,對各個機(jī)器進(jìn)行調(diào)整敲董,均以root用戶進(jìn)行操作。

本例中慰安,計劃將所有數(shù)據(jù)都放在/data盤中腋寨,別的硬盤可以不管,查看盤符命令df

盤符

gpcheck日志中有這么一句話:

Using gpcheck config file: /usr/local/greenplum-db/./etc/gpcheck.cnf

gpcheck.cnf是gpcheck的檢查依據(jù)化焕,那么我們也可以通過這個文件來進(jìn)行我們的配置:

[global]
configfile_version = 3

[linux]
xfs_mount_options = rw,noatime,inode64,allocsize=16m
sysctl.kernel.shmmax = 500000000
sysctl.kernel.shmmni = 4096
sysctl.kernel.shmall = 4000000000
sysctl.kernel.sem = 250 512000 100 2048
sysctl.kernel.sysrq = 1
sysctl.kernel.core_uses_pid = 1
sysctl.kernel.msgmnb = 65536
sysctl.kernel.msgmax = 65536
sysctl.kernel.msgmni = 2048
sysctl.net.ipv4.tcp_syncookies = 1
sysctl.net.ipv4.ip_forward = 0
sysctl.net.ipv4.conf.default.accept_source_route = 0
sysctl.net.ipv4.tcp_tw_recycle = 1
sysctl.net.ipv4.tcp_max_syn_backlog = 4096
sysctl.net.ipv4.conf.all.arp_filter = 1
sysctl.net.ipv4.ip_local_port_range = 1025 65535
sysctl.net.core.netdev_max_backlog = 10000
sysctl.vm.overcommit_memory = 2

3.1 內(nèi)核參數(shù)

gpcheck提示:

variable not detected in /etc/sysctl.conf: 'net.ipv4.ip_local_port_range'
……
variable not detected in /etc/sysctl.conf: 'kernel.sysrq'

命令vi /etc/sysctl.conf修改內(nèi)核參數(shù)萄窜,之后sysctl -p生效。

# gpdb
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 512000 100 2048
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog = 10000
vm.overcommit_memory = 2

3.2 PAM 配置文件

gpcheck提示:

soft nofile not found in /etc/security/limits.conf
hard nproc not found in /etc/security/limits.conf
soft nproc not found in /etc/security/limits.conf
hard nofile not found in /etc/security/limits.conf

執(zhí)行命令vi /etc/security/limits.conf:

# gpdb
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

保存撒桨。

3.3 IO調(diào)度

gpcheck提示:

on device (sr0) IO scheduler 'cfq' does not match expected value 'deadline'

device (sr0)并非我使用的數(shù)據(jù)盤查刻,不用管。
關(guān)于IO調(diào)度:參考資料

3.4 預(yù)讀扇區(qū)

gpcheck提示:

on device (/dev/sda3) blockdev readahead value '8192' does not match expected value '16384'

修改方法如下:

# 查看 /dev/sda2 盤的預(yù)讀扇區(qū)
blockdev --getra /dev/sda3
# 顯示8192元莫,與gpcheck提示符合

#修改 /dev/sda2 盤的預(yù)讀扇區(qū)
blockdev --setra 16384 /dev/sda3
#修改完成后再查看一下

#將修改命令寫入/etc/rc.local赖阻,否則重啟后會失效
echo '/sbin/blockdev --setra 16384 /dev/sda2' >> /etc/rc.local

#查看是否寫入成功
cat /etc/rc.local

#必要時可重啟系統(tǒng)進(jìn)行驗證

3.5 XFS 文件系統(tǒng) mount 參數(shù)

gpcheck提示

XFS filesystem on device /dev/sda3 has 5 XFS mount options and 4 are expected
XFS filesystem on device /dev/sda3 is missing the recommended mount option 'allocsize=16m'
XFS filesystem on device /dev/sda3 is missing the recommended mount option 'noatime'

vi /etc/fstab,修改前:

UUID=203ac506-a2fb-4465-88ac-df2caefd3268 /data  xfs     defaults        0 0

修改后:

UUID=203ac506-a2fb-4465-88ac-df2caefd3268 /data xfs     defaults,allocsize=16348k,inode64,noatime        0 0

命令mount -o remount /data使之生效踱蠢,mount命令查看。
注意:本例為CentOS7.3棋电,這里不能寫allocsize=16m茎截,要寫成allocsize=16348k

3.6 時鐘同步

本例中只有一臺節(jié)點(diǎn)赶盔,不涉及時鐘同步的問題企锌,如果是多臺機(jī)器,gpcheck會提示:

ntpd not detected on machine

假設(shè)以某個服務(wù)器上的時間為基準(zhǔn)時間于未,該服務(wù)器的IP為x.x.x.x撕攒。
編輯文件vi /etc/ntp.conf,在末尾追加信息(三種節(jié)點(diǎn)添加的東西不一樣):

# Master 節(jié)點(diǎn)
server x.x.x.x

# Master Standby 節(jié)點(diǎn)
server mdw perfer
server x.x.x.x

# Segment 節(jié)點(diǎn)
server mdw perfer
server mdw1 perfer

# mdw為Master烘浦,mdw1為Master Standby

設(shè)置ntpd服務(wù)開機(jī)啟動抖坪,在/etc/rc.local中添加如下信息:
/etc/init.d/ntpd start
如果只是簡單的試驗環(huán)境,并沒有時間服務(wù)器闷叉,則只需要從Master上同步時間即可擦俐,自行調(diào)整。

3.7 再次gpcheck

再次gpcheck握侧,gpcheck -f hostlist -m mdw1蚯瞧,本例中的最終結(jié)果如下:

gpcheck最終結(jié)果

4. 初始化Greenplum數(shù)據(jù)庫

本節(jié)內(nèi)容在Master機(jī)器上嘿期,以gpadmin用戶進(jìn)行操作。

root用戶將/data盤交給gpadmin:

chown gpadmin /data
chgrp gpadmin /data

將剛才的hostlist和seglist文件復(fù)制給gpadmin用戶埋合,登錄gpadmin用戶:

gpssh-exkeys創(chuàng)建gpadmin用戶之間的ssh免密登錄备徐,后續(xù)初始化時會用到。

source /usr/local/greenplum-db/greenplum_path.sh
gpssh-exkeys -f hostlist

4.1 創(chuàng)建數(shù)據(jù)目錄

  • Master和Master Standby上創(chuàng)建:mkdir /data/master
  • Segment上創(chuàng)建Primary Segment:mkdir /data/primary
  • Segment上創(chuàng)建Mirror Segment(非必須):mkdir /data/mirror

本例只有一臺服務(wù)器甚颂,只好在一臺機(jī)器上創(chuàng)建master坦喘、primary、mirror三個目錄西设。當(dāng)Segment比較多時瓣铣,可以使用gpssh-exkeys命令輔助操作。
不要在Master/Master Standby上也創(chuàng)建primary和mirror目錄贷揽!

4.2 gpinitsystem_config

Greenplum配置文件模板位置:/usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config棠笑,復(fù)制一份出來。
其中關(guān)鍵的配置項如下:

  • DATA_DIRECTORY:決定了每個Segment上部署多少個Primary Instance禽绪,一個目錄就是一個Instance蓖救。這里建議把所有的Instance都指向一個目錄,例如部署兩個實例印屁,則為:/gpdata/primary /gpdata/primary循捺。原因是我們在使用中會創(chuàng)建新的文件系統(tǒng),這樣便于和文件系統(tǒng)區(qū)分雄人。
  • MASTER_HOSTNAME:Master的主機(jī)名从橘。
  • MASTER_DIRECTORY:Master文件目錄。
  • MASTER_PORT:該端口用于訪問Greenplum數(shù)據(jù)庫础钠。
  • MIRROR_DATA_DIRECTORY:(如果需要部署Mirror)恰力,決定了每個Segment上部署多少個Mirror Instance。類似于DATA_DIRECTORY旗吁,例如:/gpdata/mirror /gpdata/mirror踩萎。
  • DATABASE_NAME:創(chuàng)建一個數(shù)據(jù)庫,輸入數(shù)據(jù)庫名稱很钓。也可以之后手工創(chuàng)建香府。

本例中只有一臺機(jī)器,兩主(DATA_DIRECTORY)兩備(MIRROR_DATA_DIRECTORY)码倦。本例中的配置如下:

# FILE NAME: gpinitsystem_config

# Configuration file needed by the gpinitsystem

################################################
#### REQUIRED PARAMETERS
################################################

#### Name of this Greenplum system enclosed in quotes.
ARRAY_NAME="Greenplum Data Platform"

#### Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg

#### Base number by which primary segment port numbers 
#### are calculated.
PORT_BASE=40000

#### File system location(s) where primary segment data directories 
#### will be created. The number of locations in the list dictate
#### the number of primary segments that will get created per
#### physical host (if multiple addresses for a host are listed in 
#### the hostfile, the number of segments will be spread evenly across
#### the specified interface addresses).
declare -a DATA_DIRECTORY=(/data/primary /data/primary)

#### OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=mdw1

#### File system location where the master data directory 
#### will be created.
MASTER_DIRECTORY=/data/master

#### Port number for the master instance. 
MASTER_PORT=5432

#### Shell utility used to connect to remote hosts.
TRUSTED_SHELL=ssh

#### Maximum log file segments between automatic WAL checkpoints.
CHECK_POINT_SEGMENTS=8

#### Default server-side character set encoding.
ENCODING=UNICODE

################################################
#### OPTIONAL MIRROR PARAMETERS
################################################

#### Base number by which mirror segment port numbers 
#### are calculated.
MIRROR_PORT_BASE=50000

#### Base number by which primary file replication port 
#### numbers are calculated.
REPLICATION_PORT_BASE=41000

#### Base number by which mirror file replication port 
#### numbers are calculated. 
MIRROR_REPLICATION_PORT_BASE=51000

#### File system location(s) where mirror segment data directories 
#### will be created. The number of mirror locations must equal the
#### number of primary locations as specified in the 
#### DATA_DIRECTORY parameter.
declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror)


################################################
#### OTHER OPTIONAL PARAMETERS
################################################

#### Create a database of this name after initialization.
DATABASE_NAME=my

#### Specify the location of the host address file here instead of
#### with the the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem

4.3 初始化Greenplum

一般的集群部署中:

gpinitsystem -h seglist -c gpdb-config -s sdw2 -S

其中g(shù)pdb-config是剛才的配置文件名企孩;-S指Spread分布,是primary和mirror的分布關(guān)系叹洲,此為推薦值柠硕。-mdw2是指定了Master Standby。一般集群部署中,也可以挑選一個Segment作為Master Standby蝗柔。
本例只有一臺機(jī)器闻葵,命令是這樣的:

gpinitsystem -h hostlist -c gpdb-config

安裝過程中,核對安裝信息:


Master安裝信息

Segment安裝信息

按照提示輸入Y癣丧,回車確定:

安裝完成并已創(chuàng)建數(shù)據(jù)庫

4.4 環(huán)境變量

編輯文件:vi .bashrc槽畔,以本例的環(huán)境為準(zhǔn),加入如下信息

# for greenplum DB 
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/gpdata/master/gpseg-1
export PGPORT=5432
export PGDATABASE=my

生效:

source .bashrc

登錄GPDB胁编,如圖所示厢钧,應(yīng)該能看到如下形式:


本地連接gpdb

如果部署了Master Standby,將環(huán)境變量copy到Master Standby中嬉橙。大功告成早直!

4.5 最后一件事

  • 在安裝的時候,我們?yōu)閞oot用戶之間建立了ssh免密登錄市框,現(xiàn)在安裝完成了霞扬,應(yīng)該刪除掉,以免發(fā)生安全隱患枫振。
  • gpadmin用戶之間的ssh免密登錄不要刪除喻圃!現(xiàn)在gpadmin用戶的密碼均為“gpadmin”,為了避免發(fā)生安全隱患粪滤,請修改gpadmin用戶的密碼斧拍。
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市杖小,隨后出現(xiàn)的幾起案子肆汹,更是在濱河造成了極大的恐慌,老刑警劉巖窍侧,帶你破解...
    沈念sama閱讀 216,692評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件县踢,死亡現(xiàn)場離奇詭異,居然都是意外死亡伟件,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,482評論 3 392
  • 文/潘曉璐 我一進(jìn)店門议经,熙熙樓的掌柜王于貴愁眉苦臉地迎上來斧账,“玉大人,你說我怎么就攤上這事煞肾∵种” “怎么了?”我有些...
    開封第一講書人閱讀 162,995評論 0 353
  • 文/不壞的土叔 我叫張陵籍救,是天一觀的道長习绢。 經(jīng)常有香客問我,道長,這世上最難降的妖魔是什么闪萄? 我笑而不...
    開封第一講書人閱讀 58,223評論 1 292
  • 正文 為了忘掉前任梧却,我火速辦了婚禮,結(jié)果婚禮上败去,老公的妹妹穿的比我還像新娘放航。我一直安慰自己,他們只是感情好圆裕,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,245評論 6 388
  • 文/花漫 我一把揭開白布广鳍。 她就那樣靜靜地躺著,像睡著了一般吓妆。 火紅的嫁衣襯著肌膚如雪赊时。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,208評論 1 299
  • 那天行拢,我揣著相機(jī)與錄音祖秒,去河邊找鬼。 笑死剂陡,一個胖子當(dāng)著我的面吹牛狈涮,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播鸭栖,決...
    沈念sama閱讀 40,091評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼歌馍,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了晕鹊?” 一聲冷哼從身側(cè)響起松却,我...
    開封第一講書人閱讀 38,929評論 0 274
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎溅话,沒想到半個月后晓锻,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,346評論 1 311
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡飞几,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,570評論 2 333
  • 正文 我和宋清朗相戀三年砚哆,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片屑墨。...
    茶點(diǎn)故事閱讀 39,739評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡躁锁,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出卵史,到底是詐尸還是另有隱情战转,我是刑警寧澤,帶...
    沈念sama閱讀 35,437評論 5 344
  • 正文 年R本政府宣布以躯,位于F島的核電站槐秧,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜刁标,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,037評論 3 326
  • 文/蒙蒙 一颠通、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧命雀,春花似錦蒜哀、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,677評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至狐血,卻和暖如春淀歇,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背匈织。 一陣腳步聲響...
    開封第一講書人閱讀 32,833評論 1 269
  • 我被黑心中介騙來泰國打工浪默, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人缀匕。 一個月前我還...
    沈念sama閱讀 47,760評論 2 369
  • 正文 我出身青樓纳决,卻偏偏與公主長得像,于是被迫代替她去往敵國和親乡小。 傳聞我的和親對象是個殘疾皇子阔加,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,647評論 2 354

推薦閱讀更多精彩內(nèi)容

  • 架構(gòu):默認(rèn)Grouped Miior,建議Spread Mirror 目錄:第一部分 - Linux Config...
    saup007閱讀 5,935評論 1 10
  • GREENPLUM的安裝和部署 在虛擬機(jī)上安裝greenplum:1.操作系統(tǒng)redhat 2.6.18-53.e...
    Michael_林閱讀 2,998評論 0 5
  • 聽見沙漏的聲音 劃過天藍(lán)的空靈 轉(zhuǎn)身 帶走玉人的羅扇 云朵曬干了潮氣 天晴朗了高度 月下徘徊 西風(fēng)起 葉落地的驚醒...
    劉海波a閱讀 209評論 2 12
  • 今天刷的還是萬維鋼老師的精英日課,我們來學(xué)習(xí)一下到底智慧是什么湃番。 我們總是聽人們提起智慧這個詞夭织,但是智慧到底是什么...
    Mandy大萌閱讀 592評論 0 2
  • 人們,好像在洗澡的時候都會去想一些問題吠撮。
    向太陽看齊2000閱讀 188評論 0 0