CentOS上Greenplum数据库安装维护手册(单机版)
下面简述一下在CentOS 7.6安装Greenplum(5.10.2)的主要步骤
1、创建gpadmin用户
[[email protected] ~]# useradd gpadmin
[[email protected] ~]# passwd gpadmin
2、上传并安装Greenplum
本例用的是greenplum-db-5.10.2-rhel7-x86_64.rpm安装包,先上传至服务器,新建数据库安装目录:/home/greenplum,执行以下rpm安装命令,安装后的目录为:/home/greenplum/greenplum-db
切换到用户gpadmin(su - gpadmin ),后续的命令都在该用户下执行
rpm -ivh --prefix=/home/greenplum greenplum-db-5.10.2-rhel7-x86_64.rpm
3、在/home/greenplum/greenplum-db 中 新建并写入文件seg_hosts和hostlist, 写入内容为主机名bigdata-01,主机名可以通过执行hostname获得
4、使用gpssh-exkeys将所有机器通道打开
/home/greenplum/greenplum-db/bin/gpssh-exkeys -f /home/greenplum/greenplum-db/hostlist
如果出现类似错误:
error: unable to import module: No module named gppylib.commands
解决方案:
yum install -y python-py
easy_install pip
pip install pygresql
如在执行上面命令中出现:
Exception: pg_config tool is not available
解决方案:
yum install postgresql-devel
如果类似错误:
Error: unable to import module: No module named gppylib.commands解决方案
source /home/greenplum/greenplum-db/greenplum_path.sh
或者
source /etc/profile
5、新建数据目录
cd /home/greenplum/greenplum-db
mkdir gpdata
cd /home/greenplum/greenplum-db/gpdata
mkdir gpmaster gpdatap1 gpdatap2 gpdatam1 gpdatam2
6、 将 ~/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config拷贝为~/greenplum-db/initgp_config
cp /home/greenplum/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/greenplum/greenplum-db/initgp_config
7、修改~/.bashrc
注意当前操作用户为gpadmin,在 /home/gpadmin 下执行: vi .bashrc,在文件中添加:
source /home/greenplum/greenplum-db/greenplum_path.sh
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/greenplum/greenplum-db/lib
export GPHOME=/home/greenplum/greenplum-db
export MASTER_DATA_DIRECTORY=/home/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
然后令其生效:source .bashrc
8、 修改~/greenplum-db/initgp_config
# FILE NAME: gpinitsystem_config
# Configuration file needed by the gpinitsystem
################################################
#### REQUIRED PARAMETERS
################################################
#### Name of this Greenplum system enclosed in quotes.
ARRAY_NAME="EMC Greenplum DW"
#### Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg
#### Base number by which primary segment port numbers
#### are calculated.
PORT_BASE=33000
#### 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=(/home/greenplum/greenplum-db/gpdata/gpdatap1 /home/greenplum/greenplum-db/gpdata/gpdatap2)
#### OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=bigdata-01
#### File system location where the master data directory
#### will be created.
MASTER_DIRECTORY=/home/greenplum/greenplum-db/gpdata/gpmaster
#### Port number for the master instance.
MASTER_PORT=2345
#### 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=utf-8
################################################
#### OPTIONAL MIRROR PARAMETERS
################################################
#### Base number by which mirror segment port numbers
#### are calculated.
MIRROR_PORT_BASE=43000
#### Base number by which primary file replication port
#### numbers are calculated.
REPLICATION_PORT_BASE=34000
#### Base number by which mirror file replication port
#### numbers are calculated.
MIRROR_REPLICATION_PORT_BASE=44000
#### 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=(/home/greenplum/greenplum-db/gpdata/gpdatam1 /home/greenplum/greenplum-db/gpdata/gpdatam2)
################################################
#### OTHER OPTIONAL PARAMETERS
################################################
#### Create a database of this name after initialization.
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/greenplum/greenplum-db/seg_hosts
#
MASTER_MAX_CONNECT=100
红字为需要修改及特别留意之处
9 、运行
/home/greenplum/greenplum-db/bin/gpseginstall -f /home/greenplum/greenplum-db/hostlist -u gpadmin -p 前面设置的密码
执行完后继续执行:
/home/greenplum/greenplum-db/bin/gpinitsystem -c /home/greenplum/greenplum-db/initgp_config
当显示的结果中有,“Greenplum Database instance successfully created”即安装成功。
即可以使用psql -p 2345 -d postgres进行访问。
10、 日常维护命令
su - gpadmin
启停:
停 gpstop -M fast
启 gpstart
查看状态:
gpstate -s
ps -ef|grep greenplum
上一篇: Java线程状态 博客分类: 多线程