gpdb安装
环境:
OS:CentOS Linux release 7.5.1804 (Core)
GP:greenplum-db-5.3.0-rhel7-x86_64.zip
JDK:1.8
hostname:pys
1.创建gpadmin用户:
[root@pys gpadmin]#useradd gpadmin
[root@pys gpadmin]#passwd gpadmin
2.设置gpadmin用户环境
[root@pys gpadmin]#cd /home/gpadmin
[root@pys gpadmin]#vi .bashrc
[root@pys gpadmin]#vi .bash_profile
.bashrc和.bash_profile最后都添加下面两行
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data1/gpdata/master/gpseg-1
3.设置完成后source让其生效
source ~/.bashrc
source ~/.bash_profile
source /usr/local/greenplum-db/greenplum_path.sh
4.上传并解压安装包
greenplum-db-5.3.0-rhel7-x86_64.zip上传至master的/opt/目录下
[root@pys opt]#/bin/bash greenplum-db-5.3.0-rhel7-x86_64.bin
4.1出现这种,按空格继续
4.2看到是否接受协议的时候,停止。输入yes。
4.3然后提示默认安装的路径:回车后,会提示问,是否安装到默认路径,默认的话,就yes就好了。
4.4默认安装的路径并不存在,提示是否创建,输入yes
4.5完事儿,小等一会儿,就提示已经成功了。
4.6到安装目录下,可以看到已经存在了,并且自动创建了软链接。
4.7准备节点服务器信息文件
后面的批量安装会用到这两个文件,如果all_host和all_segment内容一样,可以只创建一个文件
[root@pys opt]# mkdir -p /opt/gpinit/
[root@pys gpinit]#touch all_host
[root@pys gpinit]#touch all_segment
all_host和all_segment内容:
pys
4.8建立节点服务器间的信任
[root@pys ~]#/usr/local/greenplum-db/bin/gpssh-exkeys -f /opt/gpinit/all_host
按照提示输入root密码,记住这一步不能输入gpadmin的密码,因为批量安装时需要在/usr/local下创建目录,需要root权限
4.9批量安装
[root@pys ~]#gpseginstall -f /opt/gpinit/all_host -u gpadmin -p gpadmin
这一步其实就是将master上的greenplum打包通过scp命令传到all_host中的主机上,并赋予目录gpadmin的权限
4.10检查批量安装情况
[root@pys ~]#gpssh -f /opt/gpinit/all_host -e ls -l $GPHOME
返回结果中各节点目录一致则成功–单机不用考虑这一步
4.11创建存储目录
master
[root@pys ~]#mkdir -p /data1/gpdata/master
[root@pys ~]#chown gpadmin:gpadmin /data1/gpdata/master
segent
[root@pys ~]#gpssh -f /opt/gpinit/all_host -e 'mkdir -p /data1/gpdata/primary'
[root@pys ~]#gpssh -f /opt/gpinit/all_host -e 'chown gpadmin:gpadmin /data1/gpdata/primary'
mirror
[root@pys ~]#gpssh -f /opt/gpinit/all_segment -e 'mkdir -p /data1/gpdata/mirror'
[root@pys ~]#gpssh -f /opt/gpinit/all_segment -e 'chown gpadmin:gpadmin /data1/gpdata/mirror'
4.12.创建GP初始化文件
su - gpadmin
[gpadmin@pys ~]$mkdir /home/gpadmin/gpconfigs
[gpadmin@pys ~]$cp /usr/local/greenplumdb/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config
[gpadmin@pys ~ gpconfigs]$chmod 775 gpinitsystem_config
4.13修改GP初始化文件
[gpadmin@pys ~ gpconfigs]$vi gpinitsystem_config
# 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=(/data1/gpdata/primary /data1/gpdata/primary)
#### OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=pys
#### File system location where the master data directory
#### will be created.
MASTER_DIRECTORY=/data1/gpdata/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=(/data1/mirror /data1/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror)
declare -a MIRROR_DATA_DIRECTORY=(/data1/gpdata/mirror /data1/gpdata/mirror)
################################################
#### OTHER OPTIONAL PARAMETERS
################################################
#### Create a database of this name after initialization.
#DATABASE_NAME=name_of_database
DATABASE_NAME=test
#### 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
初始化GP
[gpadmin@pys ~]$gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config -h /opt/gpinit/all_host
如果没有报ERROR,GP数据库就安装好了。下面讲一些附加操作
运行pgdb
psql -h pys -U root -d postgres
附加项:
1.运行psql出现用户不存在
Fatal: role h9uest does not exist
是因为没有权限的问题
首先说一下,大家为什么会走到这一步呢,不用说了,肯定是在装系统或者买服务器的时候没有将admin账号加入用户组,使用sudo命令的时候,出现这个情况:
admin is not in the sudoers file. This incident will be reported
处理方式
1.切换到root用户下
su
接着输入root用户的密码
2.添加sudo文件的写权限,命令是:
chmod u+w /etc/sudoers
3.编辑sudoers文件
vi /etc/sudoers
找到这行 root ALL=(ALL) ALL,在他下面添加xxx ALL=(ALL) ALL (这里的xxx是你的用户名)
执行缺少那个用户就赋权哪个用户
ps:这里说下你可以sudoers添加下面四行中任意一条
youuser ALL=(ALL) ALL
%youuser ALL=(ALL) ALL
youuser ALL=(ALL) NOPASSWD: ALL
%youuser ALL=(ALL) NOPASSWD: ALL
第一行:允许用户youuser执行sudo命令(需要输入密码).
第二行:允许用户组youuser里面的用户执行sudo命令(需要输入密码).
第三行:允许用户youuser执行sudo命令,并且在执行的时候不输入密码.
第四行:允许用户组youuser里面的用户执行sudo命令,并且在执行的时候不输入密码.
4.撤销sudoers文件写权限,命令:
chmod u-w /etc/sudoers
这样普通用户就可以使用sudo了.
2.当出现unzip abc.zip -bash: unzip: command not found
下载:yum -y install Java-1.6.0-openjdk-devel
jar xvf abc.zip
3.进行通道打开
error:缺少模型
1.source greenplum_path.sh
2.pip install下载
4.安装pip install pyparsing==1.5.7出现以下错误: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-WImLdR/pyparsing/
解决方案:
sudo python -m pip install --upgrade --force pip sudo pip install setuptools==33.1.1