环境
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 = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536net.ipv4.conf.all.promote_secondaries = 1net.ipv4.conf.default.promote_secondaries = 1net.ipv6.neigh.default.gc_thresh3 = 4096 net.ipv4.neigh.default.gc_thresh3 = 4096kernel.softlockup_panic = 1kernel.sysrq = 1net.ipv6.conf.all.disable_ipv6=0net.ipv6.conf.default.disable_ipv6=0net.ipv6.conf.lo.disable_ipv6=0kernel.numa_balancing = 0kernel.shmmax = 68719476736kernel.printk = 5net.ipv6.conf.all.disable_ipv6 = 1net.ipv6.conf.default.disable_ipv6 = 1net.ipv4.neigh.default.gc_stale_time=120net.ipv4.conf.default.arp_announce = 2net.ipv4.conf.all.arp_announce=2net.ipv4.conf.lo.arp_announce=2net.ipv4.icmp_echo_ignore_broadcasts = 1net.ipv4.icmp_ignore_bogus_error_responses = 1net.ipv4.ip_forward = 0net.ipv4.conf.all.send_redirects = 0net.ipv4.conf.default.send_redirects = 0net.ipv4.conf.all.rp_filter = 1net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.all.accept_source_route = 0net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 68719476736kernel.shmall = 4294967296net.ipv4.tcp_max_tw_buckets = 6000net.ipv4.tcp_sack = 1net.ipv4.tcp_window_scaling = 1net.ipv4.tcp_rmem = 4096 87380 4194304net.ipv4.tcp_wmem = 4096 16384 4194304net.core.wmem_default = 8388608net.core.rmem_default = 8388608net.core.rmem_max = 16777216net.core.wmem_max = 16777216net.core.netdev_max_backlog = 262144net.ipv4.tcp_max_orphans = 3276800net.ipv4.tcp_max_syn_backlog = 262144net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 1net.ipv4.tcp_syn_retries = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000net.ipv4.tcp_fin_timeout = 1net.ipv4.tcp_keepalive_time = 1800net.ipv4.tcp_keepalive_probes = 3net.ipv4.tcp_keepalive_intvl = 15net.ipv4.ip_local_port_range = 1024 65000net.netfilter.nf_conntrack_max=655350net.netfilter.nf_conntrack_tcp_timeout_established=1200net.ipv4.conf.all.accept_redirects = 0net.ipv4.conf.default.accept_redirects = 0net.ipv4.conf.all.secure_redirects = 0net.ipv4.conf.default.secure_redirects = 0vm.max_map_count = 1000000fs.nr_open = 10000000fs.file-max = 11000000net.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-green01192.xx.x.x p5-thhidam-datacle-green02192.x.x.x p5-thhidam-datacle-green03
9、创立gpadmin用户
--每台服务器都做groupadd -g 530 gpadminuseradd -g 530 -u 530 -m -d /data/gpadmin -s /bin/bash gpadminchown -R gpadmin:gpadmin /data/gpadminecho "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
web 拜访下载https://github.com/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 -j8make[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 allgcc -o gpnetbenchClient gpnetbenchClient.omake[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 installmake -C gpAux/gpperfmon installmake[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 - gpadminmkdir /data/gpadmin/confsource /data/gpadmin/greenplum_path.shssh-keygenssh-copy-id -i p5-thhidam-datacle-green02ssh-copy-id -i p5-thhidam-datacle-green03gpssh-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_hostsp5-thhidam-datacle-green01p5-thhidam-datacle-green02p5-thhidam-datacle-green03 [root@p5-thhidam-datacle-green01 conf]# vim /data/gpadmin/conf/seg_hostsp5-thhidam-datacle-green02p5-thhidam-datacle-green03
装置目录下的 greenplum_path.sh中保留了运行Greenplum的一些环境变量设置,包含GPdata、PYTHONdata等设置。
以gpadmin身份执行source命令失效,之后gpssh-exkeys替换密钥
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 ~]$ lltotal 96780-rw-r--r--. 1 gpadmin gpadmin 99102720 Apr 26 15:18 gp.tar [gpadmin@swd2 ~]$ lltotal 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 functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$data/.local/bin:$data/binexport PATHsource /data/gpadmin/greenplum_path.shexport MASTER_DATA_DIRECTORY=/data/gpadmin/gpadata/gpmaster/gpseg-1export PGPORT=2346export 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 foundUsing 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 foundUsing 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=gpsegPORT_BASE=42000declare -a DATA_DIRECTORY=(/data/gpadmin/gpdata/gpdatap1 /data/gpadmin/gpdata/gpdatap2)MASTER_HOSTNAME=p5-thhidam-datacle-green01MASTER_DIRECTORY=/data/gpadmin/gpdata/gpmasterMASTER_PORT=2346TRUSTED_SHELL=/usr/bin/sshCHECK_POINT_SEGMENTS=8ENCODING=UNICODE####可选参数,针对mirror的参数MIRROR_PORT_BASE=53000REPLICATION_PORT_BASE=43000MIRROR_REPLICATION_PORT_BASE=54000declare -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 -a20190429: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 gpinitsystem20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-has been configured to allow all hosts within this new20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-new array must be explicitly added to this file20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-located in the /data/gpsql/docs directory20190429:15:26:07:096604 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-----------------
失常得话,会呈现
[gpadmin@p5-thhidam-datacle-green01 ~]$ psql -d postgrespsql (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 -a20190426: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_config20190426: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 value20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale set to en_US.utf820190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 25020190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, Completed20190426: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 array20190426:16:25:06:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, Completed20190426: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 host20190426: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, Completed20190426: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 mode20190426: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 state20190426: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 changes20190426:16:25:54:049694 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Start Function BACKOUT_COMMAND20190426: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 -a20190426: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 denied20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Reading Greenplum configuration file /data/gpadmin/conf/gpinitsystem_config20190426: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 value20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale set to en_US.utf820190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates20190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 25020190426:16:35:26:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, Completed20190426: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 array20190426:16:35:27:051899 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, Completed20190426: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 host20190426: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 -a20190426: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 denied20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Reading Greenplum configuration file /data/gpadmin/conf/gpinitsystem_config20190426: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 value20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Locale set to en_US.utf820190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates20190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 25020190426:16:41:40:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Checking configuration parameters, Completed20190426: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 array20190426:16:41:41:052895 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[INFO]:-Commencing multi-data checks, Completed20190426: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 host20190426: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 234620190426: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 reported20190429: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.log20190429: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 to20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:- determine why gpstart failed and reinitialize cluster after resolving20190429:14:58:57:085332 gpinitsystem:p5-thhidam-datacle-green01:gpadmin-[WARN]:- issues. Not all initialization tasks have completed so the cluster20190429: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 cluster20190429: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-120190429: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 ~]$ gpstart20130815:22:28:28:003675gpstart:gpmaster:gpadmin-[INFO]:-Starting gpstart withargs:20130815:22:28:28:003675gpstart:gpmaster:gpadmin-[INFO]:-Gathering information andvalidating the environment...20130815:22:28:28:003675gpstart failed. (Reason='[Errno 2] No such file or directory: '/data/gpadmin/gpadata/gpmaster/gpseg-1/postgresql.conf'') exiting...
解决办法:
.bash_profile文件中增加
export PATHsource /data/gpsql/greenplum_path.shexport MASTER_DATA_DIRECTORY=/data/gpadmin/gpadata/gpmaster/gpseg-1export PGPORT=2346export PGDATABASE=testDB并让其失效:. ~/.bash_profile
注: 一个常见的谬误是有局部节点死活 start 不起来,log 中显示 gpdata 下某某文件夹不存在,事实上是该文件夹下初始化了谬误的文件。尝试 vi /data/gpadmin/.gphostcache 看看缓存的 host 对不对,不对的话批改过去。因为如果在批改 network 文件之前执行过 gpssh-exkeys ,可能会在 gphostcache 文件中生成主机名和 hostlist 配置中的名字造成对应关系,而 greenplum 之后不会再批改这个文件,这样的话 gpdata 下就会初始化谬误的节点数据,所以这里是个大坑。
参考链接:
https://www.linuxidc.com/Linu...
https://www.cnblogs.com/chou1...
https://www.linuxidc.com/Linu...
https://blog.csdn.net/seeyouc...
https://blog.csdn.net/weixin_...
https://blog.csdn.net/q936889...