环境
p5-thhidam-datacle-green02
p5-thhidam-datacle-green01
p5-thhidam-datacle-green03
一、系统设置(所有主机)
1、操作系统环境
CentOS 7.5.1804,64位操作系统,没有更新过
[root@localhost tools]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
2、关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service
3、关闭NetworkManager
systemctl stop NetworkManager
4、关闭selinux
root@p5-thhidam-datacle-green01 gpAdminLogs]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
5、配置/etc/sysctl.conf
[root@p5-thhidam-datacle-green02 ~]# grep -v "#" /etc/sysctl.conf
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
net.ipv4.conf.all.promote_secondaries = 1
net.ipv4.conf.default.promote_secondaries = 1
net.ipv6.neigh.default.gc_thresh3 = 4096
net.ipv4.neigh.default.gc_thresh3 = 4096
kernel.softlockup_panic = 1
kernel.sysrq = 1
net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.default.disable_ipv6=0
net.ipv6.conf.lo.disable_ipv6=0
kernel.numa_balancing = 0
kernel.shmmax = 68719476736
kernel.printk = 5
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv4.neigh.default.gc_stale_time=120
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.all.arp_announce=2
net.ipv4.conf.lo.arp_announce=2
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.ip_local_port_range = 1024 65000
net.netfilter.nf_conntrack_max=655350
net.netfilter.nf_conntrack_tcp_timeout_established=1200
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
vm.max_map_count = 1000000
fs.nr_open = 10000000
fs.file-max = 11000000
net.ipv4.conf.all.arp_filter = 1 ##############主要是这一条###################
6、配置/etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
7、手动执行命令让参数生效,也可以重启系统
#sysctl -p
8、修改/etc/hosts文件配置主机与ip地址的映射
192.xxxx.x.x p5-thhidam-datacle-green01
192.xx.x.x p5-thhidam-datacle-green02
192.x.x.x p5-thhidam-datacle-green03
9、创建gpadmin用户
--每台服务器都做
groupadd -g 530 gpadmin
useradd -g 530 -u 530 -m -d /data/gpadmin -s /bin/bash gpadmin
chown -R gpadmin:gpadmin /data/gpadmin
echo "gpadmin" | passwd --stdin gpadmin
二、安装和分发
CentOS7.5 部署Greenplum6.14集群源码安装
1 联网安装必要的包(所有机器)
[root@p5-thhidam-datacle-green01~]# yum -y install rsync coreutils glib2 lrzsz sysstat e4fsprogs xfsprogs ntp readline-devel zlib zlib-devel openssl openssl-devel pam-devel libxml2-devel libxslt-devel python-devel tcl-devel gcc make smartmontools flex bison perl perl-devel perl-ExtUtils* OpenIPMI-tools openldap openldap-devel logrotate gcc-c++ python-py python-pip libdwarf-devel libzstd-devel yum -y install bzip2-devel libevent-devel apr-devel curl-devel ed python-paramiko python-devel
[root@p5-thhidam-datacle-green01~]# pip3 install --upgrade pip
[root@p5-thhidam-datacle-green01~]# pip3 install lockfile paramiko setuptools epydoc psutil
[root@p5-thhidam-datacle-green01~]# pip3 install --upgrade setuptools
2 master节点解压代码编译安装Greenplum
或者 :
wget https://github.com/greenplum-db/gpdb/releases/download/6.14.1/6.14.1-src-full.tar.gz
- 编译
[root@p5-thhidam-datacle-green01 gpdb-5.15.1]# ./configure --prefix=/data/gpadmin --with-gssapi --with-pgport=5432 --with-libedit-preferred --with-perl --with-python --with-openssl --with-pam --with-krb5 --with-ldap --with-libxml --enable-cassert --enable-debug --enable-testutils --enable-debugbreak --enable-depend --disable-orca
- make -j8
[root@p5-thhidam-datacle-green01 gpdb-5.15.1]# make -j8
make[2]:Leaving directory `/data/tools/gpdb-5.15.1/gpAux/extensions/gpcloud/bin/gpcheckcloud'
make[1]: Leaving directory `/data/tools/gpdb-5.15.1/gpAux/extensions'
make -C gpAux/gpperfmon all
gcc -o gpnetbenchClient gpnetbenchClient.o
make[2]: Leaving directory `/data/tools/gpdb-5.15.1/gpAux/platform/gpnetbench'
make[1]: Leaving directory `/data/tools/gpdb-5.15.1/gpAux/platform'
All of Greenplum Database successfully made. Ready to install.
- make install
[root@p5-thhidam-datacle-green01 gpdb-5.15.1]# make install
make -C gpAux/gpperfmon install
make[1]: Entering directory `/data/tools/gpdb-5.15.1/gpAux/gpperfmon'
make[2]: Leaving directory `/data/tools/gpdb-5.15.1/gpAux/platform/gpnetbench'
make[1]: Leaving directory `/data/tools/gpdb-5.15.1/gpAux/platform'
Greenplum Database installation complete.
若出现:则说明安装成功。
3. 分发文件
因为只在master上安装了Greenplum,所以下面要将安装包批量发送到每个slave机器上,才能算是整个Greenplum集群安装了Greenplum。
先在master主节点上创建GP的tar文件,其中gpsqlpwd是安装路径。
[root@p5-thhidam-datacle-green01 gpsql]# chown -R gpadmin:gpadmin /data/gpsql/
[root@p5-thhidam-datacle-green01 gpadmin]# gtar -cvf /data/gpadmin/gp.tar /data/gpsql
下面的操作都是为了连接所有节点,并将安装包发送到每个节点
在master主机,以gpadmin用户身份创建以下文本,可在gpadmin目录下创建conf文件夹,用来放这些启动互信信息
--master主机需要做
su - gpadmin
mkdir /data/gpadmin/conf
source /data/gpadmin/greenplum_path.sh
ssh-keygen
ssh-copy-id -i p5-thhidam-datacle-green02
ssh-copy-id -i p5-thhidam-datacle-green03
gpssh-exkeys -f /data/gpadmin/conf/all_hosts
****记住要用master节点ssh一下
ssh gpadmin@p5-thhidam-datacle-green02
ssh gpadmin@p5-thhidam-datacle-green02
编辑 集群列表
[root@p5-thhidam-datacle-green01 conf]# vim /data/gpadmin/conf/all_hosts p5-thhidam-datacle-green01 p5-thhidam-datacle-green02 p5-thhidam-datacle-green03 [root@p5-thhidam-datacle-green01 conf]# vim /data/gpadmin/conf/seg_hosts p5-thhidam-datacle-green02 p5-thhidam-datacle-green03
gpadmin@p5-thhidam-datacle-green01 gpsql]$ gpssh-exkeys -f /data/gpadmin/conf/all_hosts
[STEP 1 of 5] create local ID and authorize on local host
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] authorize current user on remote hosts
... send to p5-thhidam-datacle-green02
***
*** Enter password for p5-thhidam-datacle-green02:
... send to p5-thhidam-datacle-green03
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
... finished key exchange with p5-thhidam-datacle-green02
... finished key exchange with p5-thhidam-datacle-green03
[INFO] completed successfully
通过gpscp命令将之前的压缩包分发到/conf/seg_hosts文件配置的segment节点
[gpadmin@p5-thhidam-datacle-green01 ~]$ gpscp -f /data/gpadmin/conf/seg_hosts /data/gpadmin/gp.tar =:/data/gpadmin/
查看是否将压缩包分发成功
[gpadmin@p5-thhidam-datacle-green02 ~]$ ll
total 96780
-rw-r--r--. 1 gpadmin gpadmin 99102720 Apr 26 15:18 gp.tar
[gpadmin@swd2 ~]$ ll
total 96780
-rw-r--r--. 1 gpadmin gpadmin 99102720 Apr 26 15:18 gp.tar
通过gpssh协议连接到segment节点时,all_hosts里有多少机器应该有多少输出
[gpadmin@p5-thhidam-datacle-green01 ~]$ gpssh -f /data/gpadmin/conf/all_hosts
=> pwd
[ p5-thhidam-datacle-green01] /data/gpadmin
[p5-thhidam-datacle-green03] /data/gpadmin
[p5-thhidam-datacle-green02] /data/gpadmin
=>
解压之间的安装包
=> gtar -xvf gp.tar
最后创建数据库工作目录
=> pwd
[ p5-thhidam-datacle-green01] /data/gpadmin
[p5-thhidam-datacle-green03] /data/gpadmin
[p5-thhidam-datacle-green02] /data/gpadmin
=> mkdir gpdata
[ p5-thhidam-datacle-green01]
[p5-thhidam-datacle-green03]
[p5-thhidam-datacle-green02]
=> cd gpdata
[ p5-thhidam-datacle-green01]
[p5-thhidam-datacle-green03]
[p5-thhidam-datacle-green02]
=> mkdir gpdatap1 gpdatap2 gpdatam1 gpdatam2 gpmaster
[ p5-thhidam-datacle-green01]
[p5-thhidam-datacle-green03]
[p5-thhidam-datacle-green02]
=> ll
[ p5-thhidam-datacle-green01] total 20
[ p5-thhidam-datacle-green01] drwxrwxr-x 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatam1
[ p5-thhidam-datacle-green01] drwxrwxr-x 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatam2
[ p5-thhidam-datacle-green01] drwxrwxr-x 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatap1
[ p5-thhidam-datacle-green01] drwxrwxr-x 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatap2
[ p5-thhidam-datacle-green01] drwxrwxr-x 2 gpadmin gpadmin 4096 Apr 26 15:30 gpmaster
[p5-thhidam-datacle-green03] total 20
[p5-thhidam-datacle-green03] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatam1
[p5-thhidam-datacle-green03] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatam2
[p5-thhidam-datacle-green03] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatap1
[p5-thhidam-datacle-green03] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatap2
[p5-thhidam-datacle-green03] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpmaster
[p5-thhidam-datacle-green02] total 20
[p5-thhidam-datacle-green02] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatam1
[p5-thhidam-datacle-green02] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatam2
[p5-thhidam-datacle-green02] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatap1
[p5-thhidam-datacle-green02] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpdatap2
[p5-thhidam-datacle-green02] drwxrwxr-x. 2 gpadmin gpadmin 4096 Apr 26 15:30 gpmaster
=>exit
三、初始化和创建数据库
1 配置.bash_profile 环境变量(每台机器都要配置)
[gpadmin@p5-thhidam-datacle-green01 ~]$ vim .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$data/.local/bin:$data/bin
export PATH
source /data/gpadmin/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/gpadmin/gpadata/gpmaster/gpseg-1
export PGPORT=2346
export PGDATABASE=testDB
[gpadmin@p5-thhidam-datacle-green01 ~]$ . ~/.bash_profile
2 同步时钟
》 在gpadmin下:
- 检查时钟:
[gpadmin@p5-thhidam-datacle-green01 ~]$ gpssh -f /data/gpadmin/conf/all_hosts -v date
[WARN] Reference default values as $MASTER_DATA_DIRECTORY/gpssh.conf could not be found
Using delaybeforesend 0.05 and prompt_validation_timeout 1.0
[Reset ...]
[INFO] login p5-thhidam-datacle-green01
[INFO] login p5-thhidam-datacle-green03
[INFO] login p5-thhidam-datacle-green02
[ p5-thhidam-datacle-green01] Fri Apr 26 15:51:13 CST 2019
[p5-thhidam-datacle-green03] Fri Apr 26 15:51:13 CST 2019
[p5-thhidam-datacle-green02] Fri Apr 26 15:51:16 CST 2019
[INFO] completed successfully
[Cleanup...]
- 同步:
[gpadmin@p5-thhidam-datacle-green01 ~]$ gpssh -f /data/gpadmin/conf/all_hosts -v ntpd
[WARN] Reference default values as $MASTER_DATA_DIRECTORY/gpssh.conf could not be found
Using delaybeforesend 0.05 and prompt_validation_timeout 1.0
[Reset ...]
[INFO] login p5-thhidam-datacle-green01
[INFO] login p5-thhidam-datacle-green02
[INFO] login p5-thhidam-datacle-green03
[ p5-thhidam-datacle-green01] must be run as root, not uid 1001
[p5-thhidam-datacle-green02] must be run as root, not uid 1001
[p5-thhidam-datacle-green03] must be run as root, not uid 1001
[INFO] completed successfully
3 编写数据库启动参数文件
将安装目录下的/data/gpsql/docs/cli_help/gpconfigs/gpinitsystem_config文件copy到/data/gpadmin/conf目录下,然后编辑,保留如下参数即可,
#vi /data/gpadmin/conf/gpinitsystem_config
文件中添加如下参数:
ARRAY_NAME="Greenplum Data Platform"
SEG_PREFIX=gpseg
PORT_BASE=42000
declare -a DATA_DIRECTORY=(/data/gpadmin/gpdata/gpdatap1 /data/gpadmin/gpdata/gpdatap2)
MASTER_HOSTNAME=p5-thhidam-datacle-green01
MASTER_DIRECTORY=/data/gpadmin/gpdata/gpmaster
MASTER_PORT=2346
TRUSTED_SHELL=/usr/bin/ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
####可选参数,针对mirror的参数
MIRROR_PORT_BASE=53000
REPLICATION_PORT_BASE=43000
MIRROR_REPLICATION_PORT_BASE=54000
declare -a MIRROR_DATA_DIRECTORY=(/data/gpadmin/gpdata/gpdatam1 /data/gpadmin/gpdata/gpdatam2)
MACHINE_LIST_FILE=/data/gpadmin/conf/seg_hosts
4初始化
[gpadmin@p5-thhidam-datacle-green01 ~]$ gpinitsystem -c /data/gpadmin/conf/gpinitsystem_config -a
20190429:15:23:32:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, please wait...
/bin/mv: try to overwrite ?.data/gpadmin/conf/gpinitsystem_config?. overriding mode 0644 (rw-r--r--)?
.
.
20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-The Master /data/gpadmin/gpdata/gpmaster/gpseg-1/pg_hba.conf post gpinitsystem
20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-new array must be explicitly added to this file
20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-located in the /data/gpsql/docs directory
20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-----------------
正常得话,会出现
[gpadmin@p5-thhidam-datacle-green01 ~]$ psql -d postgres
psql (8.3.23)
Type "help" for help.
postgres=# select * from gp_segment_configuration ;
dbid | content | role | preferred_role | mode | status | port | hostname | address | replication_port
------+---------+------+----------------+------+--------+-------+----------+---------+------------------
1 | -1 | p | p | s | u | 2346 | p5-thhidam-datacle-green01 | p5-thhidam-datacle-green01 |
2 | 0 | p | p | s | u | 42000 | p5-thhidam-datacle-green01 | p5-thhidam-datacle-green01 | 43000
4 | 2 | p | p | s | u | 42000 | p5-thhidam-datacle-green02 | p5-thhidam-datacle-green02 | 43000
6 | 4 | p | p | s | u | 42000 | p5-thhidam-datacle-green03 | p5-thhidam-datacle-green03 | 43000
3 | 1 | p | p | s | u | 42001 | p5-thhidam-datacle-green01 | p5-thhidam-datacle-green01 | 43001
5 | 3 | p | p | s | u | 42001 | p5-thhidam-datacle-green02 | p5-thhidam-datacle-green02 | 43001
7 | 5 | p | p | s | u | 42001 | p5-thhidam-datacle-green03 | p5-thhidam-datacle-green03 | 43001
8 | 0 | m | m | s | u | 53000 | p5-thhidam-datacle-green02 | p5-thhidam-datacle-green02 | 54000
9 | 1 | m | m | s | u | 53001 | p5-thhidam-datacle-green02 | p5-thhidam-datacle-green02 | 54001
10 | 2 | m | m | s | u | 53000 | p5-thhidam-datacle-green03 | p5-thhidam-datacle-green03 | 54000
11 | 3 | m | m | s | u | 53001 | p5-thhidam-datacle-green03 | p5-thhidam-datacle-green03 | 54001
12 | 4 | m | m | s | u | 53000 | p5-thhidam-datacle-green01 | p5-thhidam-datacle-green01 | 54000
13 | 5 | m | m | s | u | 53001 | p5-thhidam-datacle-green01 | p5-thhidam-datacle-green01 | 54001
(13 rows)
搭建过程中得遇到得问题,记录如下:
错误1:
[gpadmin@p5-thhidam-datacle-green01 ~]$ gpinitsystem -c /data/gpadmin/conf/gpinitsystem_config -a
20190426:16:24:59:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, please wait...
/bin/mv: try to overwrite ?.data/gpadmin/conf/gpinitsystem_config?. overriding mode 0644 (rw-r--r--)?
20190426:16:25:05:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Reading Greenplum configuration file /data/gpadmin/conf/gpinitsystem_config
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale has not been set in /data/gpadmin/conf/gpinitsystem_config, will set to default value
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale set to en_US.utf8
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, Completed
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, please wait...
..
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Configuring build for standard array
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, Completed
20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Building primary segment instance array, please wait...
....
20190426:16:25:10:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Building group mirror array type , please wait...
....
20190426:16:25:14:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking Master host
20190426:16:25:14:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking new segment hosts, please wait...
........
20190426:16:25:31:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking new segment hosts, Completed
20190426:16:25:31:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Building the Master instance database, please wait...
20190426:16:25:46:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Starting the Master in admin mode
20190426:16:25:54:gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[FATAL]:-Unknown host swd2 Script Exiting!
20190426:16:25:54:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:-Script has left Greenplum Database in an incomplete state
20190426:16:25:54:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:-Run command /bin/bash /data/gpadmin/gpAdminLogs/backout_gpinitsystem_gpadmin_20190426_162459 to remove these changes
20190426:16:25:54:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Start Function BACKOUT_COMMAND
20190426:16:25:54:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-End Function BACKOUT_COMMAND
解决方式:
查看各节点的主机名是否正确,发现p5-thhidam-datacle-green03的主机名写成了swd2,将其修改后,再次初始化
错误2:
[gpadmin@p5-thhidam-datacle-green01 gpmaster]$ gpinitsystem -c /data/gpadmin/conf/gpinitsystem_config -a
20190426:16:35:24:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, please wait...
/bin/mv: try to overwrite ?.data/gpadmin/conf/gpinitsystem_config?. overriding mode 0644 (rw-r--r--)? y
/bin/mv: cannot move ?.tmp/cluster_tmp_file.51899?.to ?.data/gpadmin/conf/gpinitsystem_config?. Permission denied
20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Reading Greenplum configuration file /data/gpadmin/conf/gpinitsystem_config
20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale has not been set in /data/gpadmin/conf/gpinitsystem_config, will set to default value
20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale set to en_US.utf8
20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, Completed
20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, please wait...
..
20190426:16:35:27:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Configuring build for standard array
20190426:16:35:27:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, Completed
20190426:16:35:27:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Building primary segment instance array, please wait...
....
20190426:16:35:30:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Building group mirror array type , please wait...
....
20190426:16:35:34:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking Master host
20190426:16:35:34:gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[FATAL]:-Found indication of postmaster process on port 2346 on Master host Script Exiting!
解决方式:关闭杀死占用端口2346的进程
先查询进程
[gpadmin@p5-thhidam-datacle-green01 ~]$ lsof -i:2346
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 51235 gpadmin 3u IPv4 111661 0t0 TCP *:redstorm_join (LISTEN)
postgres 51235 gpadmin 4u IPv6 111662 0t0 TCP *:redstorm_join (LISTEN)
然后杀死进程
gpadmin@p5-thhidam-datacle-green01 ~]$ kill -9 51235
错误三:
[gpadmin@p5-thhidam-datacle-green01 ~]$ gpinitsystem -c /data/gpadmin/conf/gpinitsystem_config -a
20190426:16:41:38:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, please wait...
/bin/mv: try to overwrite ?.data/gpadmin/conf/gpinitsystem_config?. overriding mode 0644 (rw-r--r--)? y
/bin/mv: cannot move ?.tmp/cluster_tmp_file.52895?.to ?.data/gpadmin/conf/gpinitsystem_config?. Permission denied
20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Reading Greenplum configuration file /data/gpadmin/conf/gpinitsystem_config
20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale has not been set in /data/gpadmin/conf/gpinitsystem_config, will set to default value
20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale set to en_US.utf8
20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, Completed
20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, please wait...
..
20190426:16:41:41:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Configuring build for standard array
20190426:16:41:41:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, Completed
20190426:16:41:41:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Building primary segment instance array, please wait...
....
20190426:16:41:44:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Building group mirror array type , please wait...
....
20190426:16:41:48:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking Master host
20190426:16:41:48:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:-Have lock file /tmp/.s.PGSQL.2346.lock but no process running on port 2346
20190426:16:41:48:gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[FATAL]:-Found indication of postmaster process on port 2346 on Master host Script Exiting!
解决:删除文件:/tmp/.s.PGSQL.2346.lock
错误四:
20190429:14:58:52:095181 gpstart:p5-thhidam-datacle-green01:gpadmin-[WARNING]:-Segment instance startup failures reported
20190429:14:58:52:095181 gpstart:p5-thhidam-datacle-green01:gpadmin-[WARNING]:-Failed start 9 of 12 segment instances <<<<<<<<
20190429:14:58:52:095181 gpstart:p5-thhidam-datacle-green01:gpadmin-[WARNING]:-Review /data/gpadmin/gpAdminLogs/gpstart_20190429.log
20190429:14:58:52:095181 gpstart:p5-thhidam-datacle-green01:gpadmin-[INFO]:-----------------------------------------------------
20190429:14:58:52:095181 gpstart:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing parallel segment instance shutdown, please wait...
...
20190429:14:58:57:095181 gpstart:p5-thhidam-datacle-green01:gpadmin-[ERROR]:-gpstart error: Do not have enough valid segments to start the array.
20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:
20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:-Failed to start Greenplum instance; review gpstart output to
20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:- determine why gpstart failed and reinitialize cluster after resolving
20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:- issues. Not all initialization tasks have completed so the cluster
20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:- should not be used.
20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:-gpinitsystem will now try to stop the cluster
20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:
20190429:14:58:58:095823 gpstop:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Starting gpstop with args: -a -l /data/gpadmin/gpAdminLogs -i -d /data/gpadmin/gpdata/gpmaster/gpseg-1
20190429:14:58:58:095823 gpstop:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Gathering information and validating the environment...
20190429:14:58:58:095823 gpstop:p5-thhidam-datacle-green01:gpadmin-[ERROR]:-gpstop error: postmaster.pid file does not exist. is Greenplum instance already stopped?
错误5:
[gpadmin@gpp5-thhidam-datacle-green01 ~]$ gpstart
20130815:22:28:28:003675
gpstart:gpmaster:gpadmin-[INFO]:-Starting gpstart with
args:
20130815:22:28:28:003675
gpstart:gpmaster:gpadmin-[INFO]:-Gathering information and
validating the environment...
20130815:22:28:28:003675
gpstart failed. (Reason='[Errno 2] No such file or directory: '/data/gpadmin/gpadata/gpmaster/gpseg-1/postgresql.conf'') exiting...
解决方法:
.bash_profile文件中添加
export PATH
source /data/gpsql/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/gpadmin/gpadata/gpmaster/gpseg-1
export PGPORT=2346
export PGDATABASE=testDB
并让其生效:. ~/.bash_profile
参考链接:
https://www.linuxidc.com/Linu...
https://www.cnblogs.com/chou1...
https://www.linuxidc.com/Linu...
https://blog.csdn.net/seeyouc...