基本环境:
server | IP |
---|---|
MDW | 172.16.16.31 |
SDW1 | 172.16.16.34 |
SDW2 | 172.16.16.35 |
1:检查操作系统是否符合要求,以及系统设置。
我这里使用的系统是CentOS ,操作系统要求CentOS64-bit 6.x or 7.x,CentOS最好是7以上版本。 然后关闭selinux,iptables
cat /etc/selinux/config SELINUX=disabled
查看状态:
[[email protected] mail]# sestatus SELinux status: disabled
关闭iptables
[[email protected] ~]# chkconfig iptables off [[email protected] ~]# chkconfig --list |grep iptables iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
配置系统参数,官方给出了一些建议的配置:
vi /etc/sysctl.conf
然后修改
kernel.shmmax = 500000000 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 250 512000 100 2048 kernel.sysrq = 1 kernel.core_uses_pid = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.msgmni = 2048 net.ipv4.tcp_syncookies = 1 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.tcp_tw_recycle = 1 net.ipv4.tcp_max_syn_backlog = 4096 net.ipv4.conf.all.arp_filter = 1 net.ipv4.ip_local_port_range = 10000 65535 net.core.netdev_max_backlog = 10000 net.core.rmem_max = 2097152 net.core.wmem_max = 2097152 vm.overcommit_memory = 2
第二个文件也有一些需要修改的地方
vi /etc/security/limits.conf
添加以下内容:
* soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072
修改IO调度算法:
echo deadline > /sys/block/sr0/queue/scheduler
然后重启机器。文件系统最好使用XFS。 禁用THP:
[[email protected] ~]# grubby --update-kernel=ALL --args="transparent_hugepage=never" [[email protected] ~]# cat /sys/kernel/mm/*transparent_hugepage/enabled [always] madvise never [always] madvise never
2:安装Greenplum
我们下载的是5.0版本,使用二进制发行版安装,使用root用户登录,最好建立一个单独的用户进行安装。 所有节点创建用户
useradd gpadmin
先进行解压:
[[email protected] sa]# unzip greenplum-db-5.0.0-rhel7-x86_64.zip [[email protected] gptest]# groupadd gpadmin [[email protected] gptest]# useradd -r -g gpadmin -s /bin/false gpadmin
开始安装:
[[email protected] gptest]# /bin/bash greenplum-db-5.0.0-rhel7-x86_64.bin
安装过程会有提示:
I HAVE READ AND AGREE TO THE TERMS OF THE ABOVE PIVOTAL SOFTWARE LICENSE AGREEMENT. ******************************************************************************** Do you accept the Pivotal Database license agreement? [yes|no] ******************************************************************************** yes ******************************************************************************** Provide the installation path for Greenplum Database or press ENTER to accept the default installation path: /usr/local/greenplum-db-5.0.0 ******************************************************************************** /home/greenplum-db-5.0.0 ******************************************************************************** Install Greenplum Database into /home/greenplum-db-5.0.0? [yes|no] ******************************************************************************** yes ******************************************************************************** /home/greenplum-db-5.0.0 does not exist. Create /home/greenplum-db-5.0.0 ? [yes|no] (Selecting no will exit the installer) ******************************************************************************** yes Extracting product to /home/greenplum-db-5.0.0 ******************************************************************************** Installation complete. Greenplum Database is installed in /home/greenplum-db-5.0.0 Pivotal Greenplum documentation is available for download at http://gpdb.docs.pivotal.io ********************************************************************************
安装以后的我们进去看一下具体的安装目录:
[[email protected] greenplum-db-5.0.0]# ls bin docs etc ext greenplum_path.sh include lib pxf sbin share
看看目录具体作用:
greenplum_path.sh:配置文件 bin目录:主要是一些工具,其中也包括pgsql等 docs目录:帮助文件和一些配置文件 etc:示例配置文件和一些工具的配置文件 ext:GP的一些绑定程序,我们看到现在只有一个python include:GP的一些C的头文件 lib:库文件 sbin:内部脚本和程序 share :共享文件夹
然后我们在另外两台机器上也执行相同脚本进行安装和部署或者使用gpseginstall进行安装。这里我们使用第二种方法 先修改host文件:
172.16.16.31 mdw 172.16.16.34 sdw1 172.16.16.35 sdw2
初始化一下环境变量,这里我们可以看到两个
[[email protected] greenplum-db-5.0.0]# source /home/greenplum-db-5.0.0/greenplum_path.sh [[email protected] greenplum-db-5.0.0]# source /home/greenplum-db/greenplum_path.sh
两个文件是一模一样的选择任何都是一样的。然后创建一个文件:
[[email protected] greenplum-db-5.0.0]# cat my_host_list_file mdw sdw1 sdw2
配置SSH的免密链接:
[[email protected] sa]$ gpssh-exkeys -f /home/gpdb/hostlist [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 sdw1 *** *** Enter password for sdw1: ... send to sdw2 [STEP 4 of 5] determine common authentication file content [STEP 5 of 5] copy authentication files to all remote hosts ... finished key exchange with sdw1 ... finished key exchange with sdw2 [INFO] completed successfully
在各个节点创建所必须的文件夹:
[[email protected] sa]$ gpssh -f /home/gpdb/seghostlist -e -v ‘sudo mkdir -p /home/greenplum && sudo chown -R gpadmin /home/greenplum‘ [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 sdw2 [INFO] login sdw1 [sdw2] sudo mkdir -p /home/greenplum && sudo chown -R gpadmin /home/greenplum [sdw1] sudo mkdir -p /home/greenplum && sudo chown -R gpadmin /home/greenplum [INFO] completed successfully [Cleanup...]
下面开始安装:
[[email protected] home]$ gpseginstall -f /home/gpdb/hostlist -u gpadmin -p gpadmin 20171214:23:29:27:008905 gpseginstall:mdw:gpadmin-[INFO]:-Installation Info: link_name greenplum-db binary_path /home/greenplum/greenplum-db-5.0.0 binary_dir_location /home/greenplum binary_dir_name greenplum-db-5.0.0 20171214:23:29:27:008905 gpseginstall:mdw:gpadmin-[INFO]:-check cluster password access 20171214:23:29:28:008905 gpseginstall:mdw:gpadmin-[INFO]:-de-duplicate hostnames 20171214:23:29:28:008905 gpseginstall:mdw:gpadmin-[INFO]:-master hostname: mdw 20171214:23:29:29:008905 gpseginstall:mdw:gpadmin-[INFO]:-rm -f /home/greenplum/greenplum-db-5.0.0.tar; rm -f /home/greenplum/greenplum-db-5.0.0.tar.gz 20171214:23:29:29:008905 gpseginstall:mdw:gpadmin-[INFO]:-cd /home/greenplum; tar cf greenplum-db-5.0.0.tar greenplum-db-5.0.0 20171214:23:29:32:008905 gpseginstall:mdw:gpadmin-[INFO]:-gzip /home/greenplum/greenplum-db-5.0.0.tar 20171214:23:30:37:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: mkdir -p /home/greenplum 20171214:23:30:38:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: rm -rf /home/greenplum/greenplum-db-5.0.0 20171214:23:30:38:008905 gpseginstall:mdw:gpadmin-[INFO]:-scp software to remote location 20171214:23:30:52:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: gzip -f -d /home/greenplum/greenplum-db-5.0.0.tar.gz 20171214:23:31:09:008905 gpseginstall:mdw:gpadmin-[INFO]:-md5 check on remote location 20171214:23:31:27:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: cd /home/greenplum; tar xf greenplum-db-5.0.0.tar 20171214:23:31:40:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: rm -f /home/greenplum/greenplum-db-5.0.0.tar 20171214:23:31:41:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: cd /home/greenplum; rm -f greenplum-db; ln -fs greenplum-db-5.0.0 greenplum-db 20171214:23:31:41:008905 gpseginstall:mdw:gpadmin-[INFO]:-rm -f /home/greenplum/greenplum-db-5.0.0.tar.gz 20171214:23:31:42:008905 gpseginstall:mdw:gpadmin-[INFO]:-version string on master: gpssh version 5.0.0 build commit:458a89ba2d99f62ac212f2c87d24addcc5f58b9f 20171214:23:31:42:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: . /home/greenplum/greenplum-db/./greenplum_path.sh; /home/greenplum/greenplum-db/./bin/gpssh --version 20171214:23:31:42:008905 gpseginstall:mdw:gpadmin-[INFO]:-remote command: . /home/greenplum/greenplum-db-5.0.0/greenplum_path.sh; /home/greenplum/greenplum-db-5.0.0/bin/gpssh --version 20171214:23:31:43:008905 gpseginstall:mdw:gpadmin-[INFO]:-SUCCESS -- Requested commands completed
然后给这个账号暂时赋予管理员的权限:
[[email protected] ~]# visudo gpadmin ALL=(ALL) ALL gpadmin ALL=(ALL) NOPASSWD:ALL
安装完成以后我们检查一下安装:
[[email protected] home]$ gpssh -f /home/gpdb/seghostlist -e ls -l $GPHOME [sdw1] ls -l /home/greenplum/greenplum-db/. [sdw1] total 40 [sdw1] drwxr-xr-x 8 gpadmin root 4096 Sep 8 05:20 bin [sdw1] drwxr-xr-x 4 gpadmin root 4096 Sep 8 05:02 docs [sdw1] drwxr-xr-x 2 gpadmin root 4096 Sep 8 05:02 etc [sdw1] drwxr-xr-x 3 gpadmin root 4096 Sep 8 05:02 ext [sdw1] -rw-r--r-- 1 gpadmin root 738 Dec 14 2017 greenplum_path.sh [sdw1] drwxr-xr-x 6 gpadmin root 4096 Sep 8 05:02 include [sdw1] drwxr-xr-x 7 gpadmin root 4096 Sep 8 05:02 lib [sdw1] drwxr-xr-x 8 gpadmin root 4096 Sep 8 05:07 pxf [sdw1] drwxr-xr-x 2 gpadmin root 4096 Sep 8 05:07 sbin [sdw1] drwxr-xr-x 5 gpadmin root 4096 Sep 8 04:59 share [sdw2] ls -l /home/greenplum/greenplum-db/. [sdw2] total 40 [sdw2] drwxr-xr-x 8 gpadmin root 4096 Sep 8 05:20 bin [sdw2] drwxr-xr-x 4 gpadmin root 4096 Sep 8 05:02 docs [sdw2] drwxr-xr-x 2 gpadmin root 4096 Sep 8 05:02 etc [sdw2] drwxr-xr-x 3 gpadmin root 4096 Sep 8 05:02 ext [sdw2] -rw-r--r-- 1 gpadmin root 738 Dec 14 2017 greenplum_path.sh [sdw2] drwxr-xr-x 6 gpadmin root 4096 Sep 8 05:02 include [sdw2] drwxr-xr-x 7 gpadmin root 4096 Sep 8 05:02 lib [sdw2] drwxr-xr-x 8 gpadmin root 4096 Sep 8 05:07 pxf [sdw2] drwxr-xr-x 2 gpadmin root 4096 Sep 8 05:07 sbin [sdw2] drwxr-xr-x 5 gpadmin root 4096 Sep 8 04:59 share
接下来我们创建数据目录的空间:
[[email protected] home]$ cd greenplum/ [[email protected] greenplum]$ ls greenplum-db greenplum-db-5.0.0 [[email protected] greenplum]$ source /home/greenplum/greenplum-db-5.0.0/greenplum_path.sh [[email protected] greenplum]$ gpssh -f /home/gpdb/hostlist -e ‘mkdir -p /home/greenplum/data‘ [sdw1] mkdir -p /home/greenplum/data [sdw2] mkdir -p /home/greenplum/data [ mdw] mkdir -p /home/greenplum/data [[email protected] greenplum]$ gpssh -h mdw -e ‘mkdir -p /home/greenplum/data/master‘ [mdw] mkdir -p /home/greenplum/data/master [[email protected] greenplum]$ gpssh -f /home/gpdb/seghostlist -e ‘mkdir -p /home/greenplum/data/{primary,mirror}‘ [sdw1] mkdir -p /home/greenplum/data/{primary,mirror} [sdw2] mkdir -p /home/greenplum/data/{primary,mirror}
设置环境变量:
[[email protected] data]$ cat /home/greenplum/greenplum-db-5.0.0/greenplum_path.sh >>/home/gpadmin/.bash_profile [[email protected] data]$ source /home/gpadmin/.bash_profile [[email protected] data]$ gps gpscp gpseginstall gpsourcify.pl gpssh-exkeys gpstate gpstringsubs.pl gpsd gpsmon gpssh gpstart gpstop gpsys1 [[email protected] .ssh]$ cat /home/greenplum/greenplum-db-5.0.0/greenplum_path.sh>> ~/.bashrc [[email protected] .ssh]$ scp ~/.bashrc sdw1:~ .bashrc 100% 969 1.0KB/s 00:00 [[email protected] .ssh]$ scp ~/.bashrc sdw2:~ .bashrc
同步时钟: 在Master主机上编辑/etc/ntp.conf来设置如下内容: server 127.127.1.0 在Segment主机上编辑/etc/ntp.conf server mdw
[[email protected] ntp]# su gpadmin [[email protected] ntp]$ gpssh -f /home/gpdb/hostlist -v -e ‘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 sdw1 [INFO] login mdw [INFO] login sdw2 [sdw1] ntpd [sdw1] -bash: ntpd: command not found [ mdw] ntpd [ mdw] -bash: ntpd: command not found [sdw2] ntpd [sdw2] -bash: ntpd: command not found [INFO] completed successfully [Cleanup...]
上面的都完成以后,我们来开始初始化GP之前的检查:
[[email protected] queue]# su gpadmin [[email protected] queue]$ gpcheck -f /home/gpdb/hostlist -m mdw Cannot import modules. Please check that you have sourced greenplum_path.sh. Detail: No module named gppylib.gpparseopts [[email protected] queue]$ source /home/greenplum/greenplum-db-5.0.0/greenplum_path.sh [[email protected] queue]$ gpcheck -f /home/gpdb/hostlist -m mdw 20171218:18:07:10:003346 gpcheck:mdw:gpadmin-[INFO]:-dedupe hostnames 20171218:18:07:11:003346 gpcheck:mdw:gpadmin-[INFO]:-Detected platform: Generic Linux Cluster 20171218:18:07:11:003346 gpcheck:mdw:gpadmin-[INFO]:-generate data on servers 20171218:18:07:11:003346 gpcheck:mdw:gpadmin-[INFO]:-copy data files from servers 20171218:18:07:11:003346 gpcheck:mdw:gpadmin-[INFO]:-delete remote tmp files 20171218:18:07:11:003346 gpcheck:mdw:gpadmin-[INFO]:-Using gpcheck config file: /home/greenplum/greenplum-db/./etc/gpcheck.cnf 20171218:18:07:11:003346 gpcheck:mdw:gpadmin-[ERROR]:-GPCHECK_ERROR host(None): utility will not check all settings when run as non-root user 20171218:18:07:11:003346 gpcheck:mdw:gpadmin-[INFO]:-gpcheck completing... 下面开始初始化数据库,首先我们创建配置文件: [[email protected] ~]$ cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpinitsystem_config [[email protected] ~]$ ls gpAdminLogs gpinitsystem_config [[email protected] ~]$ chmod 775 gpinitsystem_config [[email protected] ~]$ vi gpinitsystem_config
配置文件如下:
ARRAY_NAME="Greenplum Data Platform" SEG_PREFIX=gpseg PORT_BASE=40000 declare -a DATA_DIRECTORY=(/home/greenplum/data/primary /home/greenplum/data/primary) MASTER_HOSTNAME=mdw MASTER_DIRECTORY=/home/greenplum/data/master MASTER_PORT=5432 TRUSTED_SHELL=ssh CHECK_POINT_SEGMENTS=8 ENCODING=UNICODE declare -a MIRROR_DATA_DIRECTORY=(/home/greenplum/data/mirror /home/greenplum/data/mirror) MACHINE_LIST_FILE=/home/gpdb/seghostlist
下面就开始初始化数据库吧:
[[email protected] ~]$ gpinitsystem -c gpinitsystem_config -h /home/gpdb/seghostlist 20171219:14:05:47:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, please wait... 20171219:14:05:47:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Reading Greenplum configuration file gpinitsystem_config 20171219:14:05:47:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value 20171219:14:05:47:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Locale set to en_US.utf8 20171219:14:05:47:008599 gpinitsystem:mdw:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates 20171219:14:05:47:008599 gpinitsystem:mdw:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250 20171219:14:05:48:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, Completed 20171219:14:05:48:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, please wait... .. 20171219:14:05:48:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Configuring build for standard array 20171219:14:05:48:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, Completed 20171219:14:05:48:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Building primary segment instance array, please wait... .... 20171219:14:05:51:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Checking Master host 20171219:14:05:51:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, please wait... .... 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, Completed 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database Creation Parameters 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:--------------------------------------- 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master Configuration 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:--------------------------------------- 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance name = Greenplum Data Platform 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master hostname = mdw 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master port = 5432 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance dir = /home/greenplum/data/master/gpseg-1 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master LOCALE = en_US.utf8 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum segment prefix = gpseg 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master Database = 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master connections = 250 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master buffers = 128000kB 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Segment connections = 750 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Segment buffers = 128000kB 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Checkpoint segments = 8 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Encoding = UNICODE 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Postgres param file = Off 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Initdb to be used = /home/greenplum/greenplum-db/./bin/initdb 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-GP_LIBRARY_PATH is = /home/greenplum/greenplum-db/./lib 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-HEAP_CHECKSUM is = on 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Ulimit check = Passed 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Array host connect type = Single hostname per node 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [1] = ::1 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [2] = 172.16.16.31 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [3] = fe80::250:56ff:fe93:41db 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Standby Master = Not Configured 20171219:14:05:58:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Primary segment # = 2 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Total Database segments = 4 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Trusted shell = ssh 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Number segment hosts = 2 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Mirroring config = OFF 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------- 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Primary Segment Configuration 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------- 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1 /home/greenplum/data/primary/gpseg0 40000 2 0 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1 /home/greenplum/data/primary/gpseg1 40001 3 1 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2 /home/greenplum/data/primary/gpseg2 40000 4 2 20171219:14:05:59:008599 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2 /home/greenplum/data/primary/gpseg3 40001 5 3 Continue with Greenplum creation Yy|Nn (default=N): > y 20171219:14:06:10:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Building the Master instance database, please wait... 20171219:14:06:26:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Starting the Master in admin mode 20171219:14:06:36:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing parallel build of primary segment instances 20171219:14:06:37:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Spawning parallel processes batch [1], please wait... .... 20171219:14:06:37:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait... ................................................................ 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------ 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Parallel process exit status 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------ 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as completed = 4 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as killed = 0 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as failed = 0 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------ 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Deleting distributed backout files 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Removing back out file 20171219:14:07:42:008599 gpinitsystem:mdw:gpadmin-[INFO]:-No errors generated from parallel processes 20171219:14:07:43:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -i -m -d /home/greenplum/data/master/gpseg-1 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Gathering information and validating the environment... 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Obtaining Segment details from master... 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Greenplum Version: ‘postgres (Greenplum Database) 5.0.0 build commit:458a89ba2d99f62ac212f2c87d24addcc5f58b9f‘ 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-There are 0 connections to the database 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=‘immediate‘ 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Master host=mdw 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate 20171219:14:07:43:023565 gpstop:mdw:gpadmin-[INFO]:-Master segment instance directory=/home/greenplum/data/master/gpseg-1 20171219:14:07:44:023565 gpstop:mdw:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process 20171219:14:07:44:023565 gpstop:mdw:gpadmin-[INFO]:-Terminating processes for segment /home/greenplum/data/master/gpseg-1 20171219:14:07:45:023654 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /home/greenplum/data/master/gpseg-1 20171219:14:07:45:023654 gpstart:mdw:gpadmin-[INFO]:-Gathering information and validating the environment... 20171219:14:07:45:023654 gpstart:mdw:gpadmin-[INFO]:-Greenplum Binary Version: ‘postgres (Greenplum Database) 5.0.0 build commit:458a89ba2d99f62ac212f2c87d24addcc5f58b9f‘ 20171219:14:07:45:023654 gpstart:mdw:gpadmin-[INFO]:-Greenplum Catalog Version: ‘301705051‘ 20171219:14:07:45:023654 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance in admin mode 20171219:14:07:46:023654 gpstart:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20171219:14:07:46:023654 gpstart:mdw:gpadmin-[INFO]:-Obtaining Segment details from master... 20171219:14:07:46:023654 gpstart:mdw:gpadmin-[INFO]:-Setting new master era 20171219:14:07:46:023654 gpstart:mdw:gpadmin-[INFO]:-Master Started... 20171219:14:07:46:023654 gpstart:mdw:gpadmin-[INFO]:-Heap checksum setting is consistent across the cluster 20171219:14:07:46:023654 gpstart:mdw:gpadmin-[INFO]:-Shutting down master 20171219:14:07:48:023654 gpstart:mdw:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait... .... 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:-Process results... 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:----------------------------------------------------- 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:- Successful segment starts = 4 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:- Failed segment starts = 0 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:----------------------------------------------------- 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:-Successfully started 4 of 4 segment instances 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:----------------------------------------------------- 20171219:14:07:52:023654 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /home/greenplum/data/master/gpseg-1 20171219:14:07:53:023654 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active 20171219:14:07:53:023654 gpstart:mdw:gpadmin-[INFO]:-No standby master configured. skipping... 20171219:14:07:53:023654 gpstart:mdw:gpadmin-[INFO]:-Database successfully started 20171219:14:07:53:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Scanning utility log file for any warning messages 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Log file scan check passed 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database instance successfully created 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------------- 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-To complete the environment configuration, please 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-update gpadmin .bashrc file with the following 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/home/greenplum/data/master/gpseg-1" 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:- to access the Greenplum scripts for this instance: 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:- or, use -d /home/greenplum/data/master/gpseg-1 option for the Greenplum scripts 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:- Example gpstate -d /home/greenplum/data/master/gpseg-1 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20171219.log 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Review options for gpinitstandby 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------------- 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-The Master /home/greenplum/data/master/gpseg-1/pg_hba.conf post gpinitsystem 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-has been configured to allow all hosts within this new 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-new array must be explicitly added to this file 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is 20171219:14:07:54:008599 gpinitsystem:mdw:gpadmin-[INFO]:-located in the /home/greenplum/greenplum-db/./docs directory 20171219:14:07:55:008599 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------------- 我们看一下进程: [[email protected] primary]# ps -ef|grep gpadmin gpadmin 5978 1 0 14:07 ? 00:00:00 /home/greenplum/greenplum-db-5.0.0/bin/postgres -D /home/greenplum/data/primary/gpseg1 -p 40001 --gp_dbid=3 --gp_num_contents_in_cluster=4 --silent-mode=true -i -M mirrorless --gp_contentid=1 gpadmin 5979 1 0 14:07 ? 00:00:00 /home/greenplum/greenplum-db-5.0.0/bin/postgres -D /home/greenplum/data/primary/gpseg0 -p 40000 --gp_dbid=2 --gp_num_contents_in_cluster=4 --silent-mode=true -i -M mirrorless --gp_contentid=0 gpadmin 5980 5979 0 14:07 ? 00:00:00 postgres: 40000, logger process gpadmin 5981 5978 0 14:07 ? 00:00:00 postgres: 40001, logger process gpadmin 5986 5979 0 14:07 ? 00:00:00 postgres: 40000, stats collector process gpadmin 5987 5978 0 14:07 ? 00:00:00 postgres: 40001, stats collector process gpadmin 5988 5979 0 14:07 ? 00:00:00 postgres: 40000, writer process gpadmin 5989 5978 0 14:07 ? 00:00:00 postgres: 40001, writer process gpadmin 5990 5979 0 14:07 ? 00:00:00 postgres: 40000, checkpointer process gpadmin 5991 5978 0 14:07 ? 00:00:00 postgres: 40001, checkpointer process gpadmin 5992 5979 0 14:07 ? 00:00:00 postgres: 40000, sweeper process gpadmin 5993 5978 0 14:07 ? 00:00:00 postgres: 40001, sweeper process gpadmin 5994 5978 0 14:07 ? 00:00:00 postgres: 40001, wal writer process gpadmin 5995 5979 0 14:07 ? 00:00:00 postgres: 40000, wal writer process
看到已经是初始化成功了,从库也是。在master上登录数据库看一下:
[email protected] sa]# su gpadmin [[email protected] sa]$ psql -d postgres could not change directory to "/home/sa" psql (8.3.23) Type "help" for help. postgres=# \l List of databases Name | Owner | Encoding | Access privileges -----------+---------+----------+--------------------- postgres | gpadmin | UTF8 | template0 | gpadmin | UTF8 | =c/gpadmin : gpadmin=CTc/gpadmin template1 | gpadmin | UTF8 | =c/gpadmin : gpadmin=CTc/gpadmin (3 rows) postgres=# select * from gp_segment_configuration; dbid | content | role | preferred_role | mode | status | port | hostname | address | replication_port ------+---------+------+----------------+------+--------+-------+----------+---------+------------------ 1 | -1 | p | p | s | u | 5432 | mdw | mdw | 2 | 0 | p | p | s | u | 40000 | sdw1 | sdw1 | 4 | 2 | p | p | s | u | 40000 | sdw2 | sdw2 | 3 | 1 | p | p | s | u | 40001 | sdw1 | sdw1 | 5 | 3 | p | p | s | u | 40001 | sdw2 | sdw2 | (5 rows)
OK,算是安装成功。