1.环境信息
1.1服务器 centos6.5 64位 8核/32g
SZB-L0038784 master ,segment primary/mirror
SZB-L0038785 standby,segment primary/mirror
SZB-L0038786 segment primary/mirror
SZB-L0038787 segment primary/mirror
SZB-L0038788 segment primary/mirror
1.2 Greenplum版本信息:greenplum-db-4.3.9.1-build-1-rhel5-x86_64.zip
2.安装
2.1 root用户
2.1.1配置主机名和ip映射
# hostname SZB-L0038784
# vi /etc/sysconfig/network
HOSTNAME=SZB-L0038784
# vi /etc/hosts
10.20.23.42 SZB-L0038784
10.20.23.29 SZB-L0038785
10.20.23.38 SZB-L0038786
10.20.23.82 SZB-L0038787
10.20.23.41 SZB-L0038788
2.1.2关闭防火墙
# vi /etc/selinux/config
SELINUX=disabled
或者
# chkconfig iptables off
# chkconfig --list iptables
2.1.3 系统参数设置
# vi /etc/sysctl.conf
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
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.overcommit_memory = 2
vi /etc/security/limits.d/90-nproc.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
2.1.4修改IO调度策略
# vi /boot/grub/menu.lst
kernel /vmlinuz-2.6.32-431.el6.x86_64 roroot=/dev/mapper/VolGroup00-LVroot rd_LVM_LV=VolGroup00/LVroot rd_NO_LUKS ... elevator=deadline //在最末尾添加
#vi /etc/rc.d/rc.local
#disk block
blockdev --setra 16384 /dev/sd*
#reboot
2.1.5
2.2gp准备
# cd /usr/local/
# unzipgreenplum-db-4.3.9.1-build-1-rhel5-x86_64.zip
# ./greenplum-db-4.3.9.1-build-1-rhel5-x86_64.bin
...
# cd greenplum-db
# source greenplum_path.sh
# vi all_host
SZB-L0038784
SZB-L0038785
SZB-L0038786
SZB-L0038787
SZB-L0038788
2.2.1设置ssh免密码
# gpssh-exkeys -f/usr/local/greenplum-db/all_host
...
2.2.2批量安装
# gpseginstall -f/usr/local/greenplum-db/all_host -u gpadmin -p gpadmin
切换到gpadmin用户
# su - gpadmin
$ source/usr/local/greenplum-db/greenplum_path.sh
$ gpssh -f /usr/local/greenplum-db/all_host-e ls -l $GPHOME
$ gpssh-exkeys -f /usr/local/greenplum-db/all_host
--在master上
$ exit
# mkdir -p /data/master
# chown -R gpadmin.gpadmin /data
# ssh SZB-L0038785 --standby
# mkdir -p /data/master
# chown -R gpadmin.gpadmin /data
# exit
创建segment存储目录
# gpssh -f /usr/local/greenplum-db/all_host-e 'mkdir -p /data/primary'
# gpssh -f /usr/local/greenplum-db/all_host-e 'mkdir -p /data/mirror'
# gpssh -f /usr/local/greenplum-db/all_host-e 'chown -R gpadmin.gpadmin /data'
2.2.3检查
# su - gpadmin
$ source/usr/local/greenplum-db/greenplum_path.sh
$ gpcheck -f /usr/local/greenplum-db/all_host-m SZB-L0038784 -s SZB-L0038785
...
20161012:13:42:49:006990gpcheck:SZB-L0038784:gpadmin-[ERROR]:-GPCHECK_ERROR host(None): utility willnot check all settings when run as non-root user
...
$ gpcheckperf -f/usr/local/greenplum-db/all_host -r N -d /tmp > subnet1.out
$ cat subnet1.out
/usr/local/greenplum-db/./bin/gpcheckperf -f/usr/local/greenplum-db/all_host -r N -d /tmp
-------------------
-- NETPERF TEST
-------------------
====================
== RESULT
====================
Netperf bisection bandwidth test
SZB-L0038784 -> SZB-L0038785 = 23.770000
SZB-L0038786 -> SZB-L0038787 = 24.310000
SZB-L0038788 -> SZB-L0038784 = 24.000000
SZB-L0038785 -> SZB-L0038784 = 23.710000
SZB-L0038787 -> SZB-L0038786 = 24.210000
SZB-L0038784 -> SZB-L0038788 = 16.770000
Summary:
sum = 136.77 MB/sec
min = 16.77 MB/sec
max = 24.31 MB/sec
avg = 22.80 MB/sec
median = 24.00 MB/sec
[Warning] connection between SZB-L0038784 andSZB-L0038788 is no good
$ gpcheckperf -f /usr/local/greenplum-db/all_host-r ds -D -d /data/primary -d /data/mirror
$ mkdir /home/gpadmin/gpconfigs
$ cp$GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config/home/gpadmin/gpconfigs/gpinitsystem_config
$ cd gpconfigs
$ vi gpinitsystem_config
# FILE NAME: gpinitsystem_config
# Configuration file needed by thegpinitsystem
################################################
#### REQUIRED PARAMETERS
################################################
#### Name of this Greenplum system enclosedin quotes.
ARRAY_NAME="EMC Greenplum DW"
#### Naming convention for utility-generateddata directories.
SEG_PREFIX=gpseg
#### Base number by which primary segmentport numbers
#### are calculated.
PORT_BASE=40000
#### File system location(s) where primarysegment data directories
#### will be created. The number of locationsin the list dictate
#### the number of primary segments that willget created per
#### physical host (if multiple addresses fora host are listed in
#### the hostfile, the number of segmentswill be spread evenly across
#### the specified interface addresses).
declare -a DATA_DIRECTORY=(/data/primary/data/primary /data/primary)
#### OS-configured hostname or IP address ofthe master host.
MASTER_HOSTNAME=SZB-L0038784
#### File system location where the masterdata directory
#### will be created.
MASTER_DIRECTORY=/data/master
#### Port number for the master instance.
MASTER_PORT=5432
#### Shell utility used to connect to remotehosts.
TRUSTED_SHELL=ssh
#### Maximum log file segments between automaticWAL checkpoints.
CHECK_POINT_SEGMENTS=8
#### Default server-side character setencoding.
ENCODING=UNICODE
################################################
#### OPTIONAL MIRROR PARAMETERS
################################################
#### Base number by which mirror segment portnumbers
#### are calculated.
MIRROR_PORT_BASE=50000
#### Base number by which primary filereplication port
#### numbers are calculated.
REPLICATION_PORT_BASE=41000
#### Base number by which mirror filereplication port
#### numbers are calculated.
MIRROR_REPLICATION_PORT_BASE=51000
#### File system location(s) where mirrorsegment data directories
#### will be created. The number of mirrorlocations must equal the
#### number of primary locations as specifiedin the
#### DATA_DIRECTORY parameter.
declare -aMIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror /data/mirror)
################################################
#### OTHER OPTIONAL PARAMETERS
################################################
#### Create a database of this name afterinitialization.
#DATABASE_NAME=name_of_database
#### Specify the location of the host addressfile here instead of
#### with the the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem
$ scp gpinitsystem_config SZB-L0038785:$PWD
$ gpinitsystem -c gpinitsystem_config -h/usr/local/greenplum-db/all_host -s SZB-L0038785 -S
...
[INFO]:-Greenplum Database instancesuccessfully created
...
2.2.4配置环境变量
$ vi ~/.bashrc
source /usr/local/greenplum-db/greenplum_path.sh
exportMASTER_DATA_DIRECTORY=/data/master/gpseg-1 //参见安装过程中的显示
3测试
[gpadmin@SZB-L0038784 gpconfigs]$ source~/.bashrc
[gpadmin@SZB-L0038784 gpconfigs]$ createdbgpdb -E utf-8
[gpadmin@SZB-L0038784 gpconfigs]$ psql -dgpdb
gpdb=# select version();
gpdb=# create table gpdb_tab_01(id intprimary key,name varchar(24));
gpdb=# insert into gpdb_tab_01 select1,'lily';
INSERT 0 1
gpdb=# select * from gpdb_tab_01;
id | name
----+------
1 | lily
(1 row)
gpdb=# \q
测试oracle函数功能:
$ psql -d gpdb -f$GPHOME/share/postgresql/contrib/orafunc.sql
卸载oracle函数:
$GPHOME/share/postgresql/contrib/uninstall_orafunc.sql