Ubuntu源码安装单机版GreePlum


最近因为工作需要了解一下GreenPlum,于是便想在自己电脑上面安装一个,感受一下。可是最后发现安装起来问题很多,而且网上的教程多是多机器的部署方式,很多想自学的人很难有那样的条件(除非使用虚拟机去模拟几台机器)。少有的单机部署的文章要么是比较老,要么就是问题一大堆,或许可能是因为我用的是Ubuntu吧。所以,我把自己的安装过程记录以下,希望可以帮到别人。

再次说明下我的场景:

  • OS是Ubuntu 16.04 LTS 64位
  • 单机部署(一个master和一个segment,而且部署在同一台机器上面)。如果你是部署在多台机器上,那网上的教程很多,这篇文章可能不完全适合你。
  • 从源码安装,而不是从二进制文件安装。因为我安装GP主要是想看一下代码,所以不能使用二进制文件安装。
    下面就说一下安装流程(先废话几句:因为每个人的环境有差异,可能我遇到的问题你不会遇到;反之,你遇到的问题我却不一定遇到。所以我认为教程手册类的文章能起到抛砖引玉的作用即可,我们每个人都应该具备一定解决问题的能力)。

一,创建用户

GreenPlum默认的用户叫gpadmin,但其实我们可以使用任意非root用户进行安装。但为了简单,我们还是创建一个专门的gpadmin用户。使用<span class="lang:c decode:true crayon-inline ">sudo useradd -m gpadmin;sudo passwd gpadmin;</span> 命令可以分别创建gpadmin用户和为用户设定密码。注意这里加-m参数是为了同时为新用户创建家目录。因为默认是只创建用户,不创建用户家目录的。

Tips:强烈建议先创建用户,然后后续的目录尽量都使用该用户的家目录(一般就是/home/gpadmin),这样能让你避免掉很多权限问题。我事先不知道这个,后来很多地方都要改权限,挺麻烦的。

二,下载GreePlum源码

这个很简单,从GreePlum的github下取最新代码即可:https://github.com/greenplum-db/gpdb

三,编译安装

GP的安装和很多开源代码安装一样,在你下载的源码目录(比如我的目录是/home/allan/workspace/git/gpdb)里面先执行configure,然后再执行make编译,最后make install安装:

./configure --prefix=/opt/gpsql --enable-debug --enable-depend --enable-cassert
make -j -s
sudo make install

其他说明:

  1. 执行configure的时候,应该会检测出来你的环境上面缺少很多开发库、头文件以及一些工具之类的,这个每个人和每个人的肯定不一样,比如我的环境上面之前已经安装过很多开发库,所以缺的比较少,但你的环境如果是全新安装的或者是没有装过一些开发库的话,肯定会缺很多。所以,我不打算告诉你你要安装哪些库。你只需要根据configure的错误输出看一下你少哪些库,然后一一安装上就可以了。一般,对于库文件,linux开发库/头文件的包命名方式都是:lib库名-dev,所以缺哪个安装哪个即可。比如说,我安装了如下以下软件:libapr1-dev、libevent-dev、libcurl4-gnutls-dev、libbz2-dev、libpython-dev、python-psutil、python-paramiko、ssh等。另外,--prefix的路径说明你最终想将GP安装到哪里,建议最好设置成gpadmin的家目录/home/gpadmin/gpsql。如果你有多个用户要访问数据库二进制文件的话,那就不要设置成这个目录了。如果不设置,默认就安装在/usr/local下面了。因为我要跟代码,所以打开了一些调试开关,你如果不需要gdb跟踪代码,那就不需要了,会影响性能。
  2. make -j -s表示使用所有的CPU核并行编译。因为我的安装目录是/opt/gpsql,编译的用户没有那个目录的写权限,所以安装的时候我用了sudo。如过你没有这种权限问题,就不要加sudo了。

只要你解决了configure时的问题,后面的编译安装一般都不会有什么问题,反正我没遇到什么问题。

安装成功后,在安装目录下面会有个脚本greenplum_path.sh,我们在/etc/profile文件或者/home/gpadmin/.bashrc里面最后们加一行source /opt/gpsql/greenplum_path.sh。这个是设置一些GP需要的环境变量的,如果不source的话,可能就会报一些命令找不到之类的。

后续的操作如果没有特殊说明,都是在gpadmin用户下执行的。

四,配置

1. 创建相关目录

我们直到GP是一个master和多个segment节点(本文不涉及GP架构,既然你都要安装了,想必应该已经有简单了解过了),所以,我们需要分别创建master和segment存放数据的目录(因为我们是单机部署,所以master和segment数据就存放在单台机器上面了,正式部署的话,肯定是master节点只存放master数据,segment节点存放segment数据)。比如我创建的master的数据目录是"/home/gpadmin/gpdb_p1",segment的数据目录是"/home/gpadmin/data/gpdb_p0"(只有一个segment)。

2. 设置host相关信息

其实host信息主要是用于master和多台segment通信用的,虽然我们是单机部署,但是这些信息也需要设置以下,不然无法安装。麻雀虽小,五脏还是要俱全的。我们在/home/gpadmin下创建一个gpconfigs目录,后续配置相关的文件就全放在里面。然后,我们需要创建两个文件:(1)all_hosts文件:这个文件是所有节点(master+所有segment)的hostname(2)seg_hosts文件:这个是所有segment节点的hostname。因为我们是单机部署,所以这两个文件里面就写我们电脑的hostname就可以了(直接输hostname命令就可以返回你电脑的hostname了)。比如我的这两个文件长下面这样:

gpadmin@NYC:~/gpconfigs$ hostname
NYC
gpadmin@NYC:~/gpconfigs$ cat all_hosts 
NYC
gpadmin@NYC:~/gpconfigs$ cat seg_hosts 
NYC

3. 数据库初始化

GP提供了一个初始化的样例配置文件,这个配置文件在你的数据库安装目录,比如我的在"/opt/gpsql/docs/cli_help/gpconfigs"目录。我们将这个文件拷贝一份到/home/gpadmin目录下,然后修改以下里面的一些信息:

  • DATA_DIRECTORY:这个后面的目录改成你刚才的segment的数据目录。比如我的值是:declare -a DATA_DIRECTORY=/home/gpadmin/data/gpdb_p0
  • MASTER_HOSTNAME:这个改成你电脑的hostname。比如我的值是MASTER_HOSTNAME=NYC
  • MASTER_DIRECTORY:这个改成你刚才创建的master的数据目录(其实这个目录你刚才不创建,这里配置了以后程序自己也会创建的)。比如我的值是MASTER_DIRECTORY=/home/gpadmin/gpdb_p1 。
  • MACHINE_LIST_FILE:注意这个在最后一行,而且是注释掉的。去掉注释,改成你seg_hosts文件所在目录。比如我的值是:MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/seg_hosts
    其他诸如端口号什么的,你要想改就改,不确定的就保留默认值把。

配置完这个,我们就可以使用下面命令初始化数据库了:

gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/seg_hosts

中间会让你输一个y/yes,如果一切顺利的话,应该就可以安装成功了。

gpadmin@NYC:~$ gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/seg_hosts 
20160606:23:39:19:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Checking configuration parameters, please wait...
20160606:23:39:19:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Reading Greenplum configuration file gpconfigs/gpinitsystem_config
20160606:23:39:19:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Locale has not been set in gpconfigs/gpinitsystem_config, will set to default value
20160606:23:39:19:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Locale set to en_US.utf8
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Detected a single host GPDB array build, reducing value of BATCH_DEFAULT from 60 to 4
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[WARN]:-Master open file limit is 1024 should be &gt;= 65535
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Checking configuration parameters, Completed
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
.
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Configuring build for standard array
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Commencing multi-home checks, Completed
20160606:23:39:20:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Building primary segment instance array, please wait...
.
20160606:23:39:21:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Checking Master host
20160606:23:39:21:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Checking new segment hosts, please wait...
20160606:23:39:21:024635 gpinitsystem:NYC:gpadmin-[WARN]:-Host NYC open files limit is 1024 should be &gt;= 65535
.
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Checking new segment hosts, Completed
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Greenplum Database Creation Parameters
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:---------------------------------------
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master Configuration
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:---------------------------------------
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master instance name       = EMC Greenplum DW
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master hostname            = NYC
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master port                = 5432
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master instance dir        = /home/gpadmin/gpdb_p1/gpseg-1
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master LOCALE              = en_US.utf8
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Greenplum segment prefix   = gpseg
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master Database            = 
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master connections         = 250
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master buffers             = 128000kB
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Segment connections        = 750
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Segment buffers            = 128000kB
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Checkpoint segments        = 8
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Encoding                   = UNICODE
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Postgres param file        = Off
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Initdb to be used          = /opt/gpsql/bin/initdb
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-GP_LIBRARY_PATH is         = /opt/gpsql/lib
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[WARN]:-Ulimit check               = Warnings generated, see log file &lt;&lt;&lt;&lt;&lt;
20160606:23:39:23:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Array host connect type    = Single hostname per node
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master IP address [1]      = ::1
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master IP address [2]      = 192.168.0.106
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Master IP address [3]      = fe80::d53b:865b:d51:6b51
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Standby Master             = Not Configured
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Primary segment #          = 1
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Total Database segments    = 1
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Trusted shell              = ssh
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Number segment hosts       = 1
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Mirroring config           = OFF
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:----------------------------------------
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:----------------------------------------
20160606:23:39:24:024635 gpinitsystem:NYC:gpadmin-[INFO]:-NYC     /home/gpadmin/data/gpdb_p0/gpseg0     40000     2     0
Continue with Greenplum creation Yy/Nn&gt;
Y
20160606:23:39:28:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Building the Master instance database, please wait...
20160606:23:40:51:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Starting the Master in admin mode
20160606:23:40:56:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Commencing parallel build of primary segment instances
20160606:23:40:56:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
.
20160606:23:40:56:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
.............................................................................................
20160606:23:42:30:024635 gpinitsystem:NYC:gpadmin-[INFO]:------------------------------------------------
20160606:23:42:30:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Parallel process exit status
20160606:23:42:30:024635 gpinitsystem:NYC:gpadmin-[INFO]:------------------------------------------------
20160606:23:42:30:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Total processes marked as completed           = 1
20160606:23:42:30:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Total processes marked as killed              = 0
20160606:23:42:30:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Total processes marked as failed              = 0
20160606:23:42:30:024635 gpinitsystem:NYC:gpadmin-[INFO]:------------------------------------------------
20160606:23:42:31:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Deleting distributed backout files
20160606:23:42:31:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Removing back out file
20160606:23:42:31:024635 gpinitsystem:NYC:gpadmin-[INFO]:-No errors generated from parallel processes
20160606:23:42:31:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -i -m -d /home/gpadmin/gpdb_p1/gpseg-1
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Gathering information and validating the environment...
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Obtaining Segment details from master...
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.3.99.00 build dev'
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-There are 0 connections to the database
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='immediate'
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Master host=NYC
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate
20160606:23:42:31:002935 gpstop:NYC:gpadmin-[INFO]:-Master segment instance directory=/home/gpadmin/gpdb_p1/gpseg-1
20160606:23:42:32:002935 gpstop:NYC:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process
20160606:23:42:32:002935 gpstop:NYC:gpadmin-[INFO]:-Terminating processes for segment /home/gpadmin/gpdb_p1/gpseg-1
20160606:23:42:32:003022 gpstart:NYC:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /home/gpadmin/gpdb_p1/gpseg-1
20160606:23:42:32:003022 gpstart:NYC:gpadmin-[INFO]:-Gathering information and validating the environment...
20160606:23:42:32:003022 gpstart:NYC:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.3.99.00 build dev'
20160606:23:42:32:003022 gpstart:NYC:gpadmin-[INFO]:-Greenplum Catalog Version: '301604129'
20160606:23:42:32:003022 gpstart:NYC:gpadmin-[INFO]:-Starting Master instance in admin mode
20160606:23:42:33:003022 gpstart:NYC:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20160606:23:42:33:003022 gpstart:NYC:gpadmin-[INFO]:-Obtaining Segment details from master...
20160606:23:42:33:003022 gpstart:NYC:gpadmin-[INFO]:-Setting new master era
20160606:23:42:33:003022 gpstart:NYC:gpadmin-[INFO]:-Master Started...
20160606:23:42:33:003022 gpstart:NYC:gpadmin-[INFO]:-Shutting down master
20160606:23:42:35:003022 gpstart:NYC:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait...
.. 
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-Process results...
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-----------------------------------------------------
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-   Successful segment starts                                            = 1
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-   Failed segment starts                                                = 0
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-----------------------------------------------------
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-Successfully started 1 of 1 segment instances 
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-----------------------------------------------------
20160606:23:42:37:003022 gpstart:NYC:gpadmin-[INFO]:-Starting Master instance NYC directory /home/gpadmin/gpdb_p1/gpseg-1 
20160606:23:42:38:003022 gpstart:NYC:gpadmin-[INFO]:-Command pg_ctl reports Master NYC instance active
20160606:23:42:38:003022 gpstart:NYC:gpadmin-[INFO]:-No standby master configured.  skipping...
20160606:23:42:38:003022 gpstart:NYC:gpadmin-[INFO]:-Database successfully started
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Scanning utility log file for any warning messages
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[WARN]:-*******************************************************
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[WARN]:-were generated during the array creation
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Please review contents of log file
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20160606.log
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-To determine level of criticality
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-These messages could be from a previous run of the utility
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-that was called today!
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[WARN]:-*******************************************************
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Greenplum Database instance successfully created
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-------------------------------------------------------
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-To complete the environment configuration, please 
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-update gpadmin .bashrc file with the following
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdb_p1/gpseg-1"
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-   to access the Greenplum scripts for this instance:
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-   or, use -d /home/gpadmin/gpdb_p1/gpseg-1 option for the Greenplum scripts
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-   Example gpstate -d /home/gpadmin/gpdb_p1/gpseg-1
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20160606.log
20160606:23:42:38:024635 gpinitsystem:NYC:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Review options for gpinitstandby
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-------------------------------------------------------
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-The Master /home/gpadmin/gpdb_p1/gpseg-1/pg_hba.conf post gpinitsystem
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-new array must be explicitly added to this file
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-located in the /opt/gpsql/docs directory
20160606:23:42:39:024635 gpinitsystem:NYC:gpadmin-[INFO]:-------------------------------------------------------

BTW:

(1)我把上面的输出完整的贴出来是因为它里面包含了很多数据库的信息,你最好可以好好看看你的输出信息。

(2) 如果你们中途报了“gpadmin-[FATAL]:-Failed to complete obtain psql count Master gp_segment_configuration  Script Exiting!”这个错,解决方案如下:使用root执行下面两个命令:

echo "RemoveIPC=no" >> /etc/systemd/logind.conf
service systemd-logind restart

这个是GP单机部署时的一个bug,可参见:https://github.com/greenplum-db/gpdb/issues/197?spm=5176.100241.yqaskinfo1.14.1SsgZ9

(3)如果初始化失败了,一定要调用提示信息(如下那样的信息)里面的脚本取进行清理操作,不然可能会因为一些端口占用等问题导致你下一次初始化失败。比如:

20160606:23:21:50:004395 gpinitsystem:NYC:gpadmin-[WARN]:-Run command /bin/bash                   /home/gpadmin/gpAdminLogs/backout_gpinitsystem_gpadmin_20160606_232004 to remove these changes

4. 设置master的数据目录

执行完上面第3步以后,如果装成功的话,其实gp数据库已经装好了,而且应该是已经在运行了。我们需要在.bashrc中再增加一个环境变量:MASTER_DATA_DIRECTORY。这个就是你master的数据目录,你可以看到这个目录下会有很多配置文件,比如postgresql.con之类的。

export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdb_p1
至此,从源码安装GP单机版就算完成了。后面我们就可以使用gpstart、gpstop等命令启动、停止数据库了。 写在最后: * 网上所说的什么ssh密钥交换,系统资源参数设置之类的问题我安装的时候都没有遇到,因为单机部署在通信方面是同一台,不存在太多问题。我不确定你是否会遇到,如果你遇到了,可以google一下,或者留言我们交流一下。 * 可能安装的时候你会遇到一些我没有遇到的问题,强烈建议你先认真读一下给出的提示信息和错误信息(这真的可以解决很多问题),如果解决不了,就去google一下。当然,欢迎留言交流。

添加新评论

选择表情 captcha

友情提醒:不填或错填验证码会引起页面刷新,导致已填的评论内容丢失。

|