环境:
服务器版本:centos 6.5
数据库版本:greenplum-db-4.2.8.5-build-1-RHEL5-x86_64.zip
1.创建用户和组gpadmin
groupadd -g 3030 gpadmin
useradd -u 3030 gpadmin -g gpadmin -d /home/gpadmin
passwd gpadmin
配置内核参数,添加如下内容:
vi /etc/sysctl.conf
#By greenplum
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.sem = 250 64000 100 512
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 64000 100 512
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_max_syn_backlog=4096
net.core.netdev_max_backlog=10000
vm.overcommit_memory=2
net.ipv4.conf.all.arp_filter = 1
以上参数可以根据自己系统配置做适当修改
手工执行命令,让参数生效
[root@gpmaster ~]# sysctl -p
在limits.conf文件中添加如下配置
[root@gpmaster ~]# vi /etc/security/limits.conf
# End of file
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
配置用户ssh用户无密码登录,单机也得配置
[root@gpmaster ~]# su - gpadmin
[gpadmin@gpmaster ~]$ mkdir ~/.ssh
[gpadmin@gpmaster ~]$ chmod 700 ~/.ssh
[gpadmin@gpmaster ~]$ cd .ssh/
[gpadmin@gpmaster .ssh]$ ssh-keygen -t rsa
[gpadmin@gpmaster .ssh]$ ssh gpmaster cat /home/gpadmin/.ssh/id_rsa.pub >>authorized_keys
[gpadmin@gpmaster .ssh]$chmod 600 authorized_keys
[gpadmin@gpmaster .ssh]$ ssh gpmaster date
2.安装GP软件
[root@gpmaster ~]# unzip greenplum-db-4.2.8.5-build-1-RHEL5-x86_64.zip
[root@gpmaster ~]# ./greenplum-db-4.2.8.5-build-1-RHEL5-x86_64.bin
创建instance需要的目录
[root@gpmaster ~]# mkdir -p /app/master
[root@gpmaster ~]# mkdir -p /app/data/gp1
[root@gpmaster ~]# mkdir -p /app/data/gp2
[root@gpmaster ~]# mkdir -p /app/data/gp3
[root@gpmaster ~]# mkdir -p /app/data/gp4
修改目录属主:
[root@gpmaster ~]# chown -R gpadmin:gpadmin /usr/local/greenplum-db*
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/master
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp1
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp2
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp3
[root@gpmaster ~]# chown -R gpadmin:gpadmin /app/data/gp4
修改gpadmin用户环境配置:
[root@gpmaster ~]# su - gpadmin
[gpadmin@gpmaster ~]$ vi .bash_profile
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/app/master/gpseg-1
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=gpmaster
生效:
[gpadmin@gpmaster ~]$ source .bash_profile
编辑all_hosts_file文件,添加如下内容:
[gpadmin@gpmaster ~]$ vi all_hosts_file
gpmaster
执行如下命令验证用户等效性
[gpadmin@gpmaster ~]$ gpssh-exkeys -f all_hosts_file
3.初始化系统:
编辑系统初始化的参数文件,这个文件的编辑可以使用模版,模板文件所在目录如下:
[gpadmin@gpmaster ~]$ cp /usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/
编辑gp参数文件,修改如下配置:
[gpadmin@gpmaster ~]$ vi gpinitsystem_config
declare -a DATA_DIRECTORY=(/app/data/gp1 /app/data/gp2 /app/data/gp3 /app/data/gp4)
MASTER_HOSTNAME=gpmaster
MASTER_DIRECTORY=/app/master
DATABASE_NAME=gpmaster
编辑seg_hosts_file文件
[gpadmin@gpmaster ~]$ vi seg_hosts_file
gpmaster
执行初始化系统命令:
[gpadmin@gpmaster ~]$ gpinitsystem -c gpinitsystem_config -h seg_hosts_file
系统开始初始化,之后会看到如下提示:
Continue with Greenplum creation Yy/Nn>
输入 Y ,按回车,系统会初始化完成
安装结束可以连接GP数据库了:
[gpadmin@gpmaster ~]$ psql -d gpmaster
psql (8.2.15)
Type "help" for help.
gpmaster=#
创建数据库
[gpadmin@gpmaster ~]$ createdb testDB -E utf-8
给数据库权限
[gpadmin@gpmaster ~]$ psql -d gpmaster
psql (8.2.15)
Type "help" for help.
gpmaster=# \c testDB
You are now connected to database "testDB" as user "gpadmin".
testDB=# alter role gpadmin with password ‘gpadmin‘;
远程权限
[gpadmin@gpmaster ~]$ cd $MASTER_DATA_DIRECTORY/
[gpadmin@gpmaster gpseg-1]$ ls
base pg_distributedlog pg_stat_tmp pg_xlog
global pg_distributedxidmap pg_subtrans postgresql.conf
gp_dbid pg_hba.conf pg_tblspc postmaster.opts
gpperfmon pg_ident.conf pg_twophase postmaster.pid
pg_changetracking pg_log pg_utilitymodedtmredo
pg_clog pg_multixact PG_VERSION
[gpadmin@gpmaster gpseg-1]$
[gpadmin@gpmaster gpseg-1]$ vi pg_hba.conf
host testDB gpadmin 192.168.96.1/32 md5
通过gpstop -u命令使配置生效
[gpadmin@gpmaster gpseg-1]$ gpstop -u
通过其他机器登录数据库
$ psql -h192.168.96.128 -p5432 -d testDB -Ugpadmin
本文出自 “飛鴻沓膤” 博客,请务必保留此出处http://jxzhfei.blog.51cto.com/1382161/1766666
原文地址:http://jxzhfei.blog.51cto.com/1382161/1766666