Greenplum集群
官方网站:
目录
系统需求:
环境:
一.系统初始化
1.禁用selinux
2.禁用防火墙
3.内核参数
4.资源限制
5.xfs文件系统挂载参数(/etc/fstab)
6.磁盘I/O策略(deadline)
i.centos7(grub2)
ii.centos6(/boot/grub/grub.conf)
7.磁盘read-ahead
8./etc/hosts
9.禁用透明大页
i.centos7(grub2)
ii.centos6(/boot/grub/grub.conf)
10.禁用IPC object removal
11.创建greenplum管理员
12.安装依赖包
13.系统重启
二.安装greenplum master&segment
1.master,segment ssh key认证
2.解压安装greenplum
三.确认安装
四.greenplum存储路径
1.master
2.segment
五.greenplum初始化
1.创建初始化主机配置文件hostfile_gpinitsystem
2.创建初始化配置文件gpinitsystem_config
3.初始化db
4.设置greenplum环境变量
6.建库
六.配置ntp
系统需求:
环境:
CentOS7.2.1511
greenplum-4.3.9.0
本次部署包括master*1,segment*3
greenplum-master: 172.25.178.50
greenplum-segment1: 172.25.155.51
greenplum-segment2: 172.25.155.52
greenplum-segment3: 172.25.155.53
gpadmin初始密码gpassword
greenplum存储路径
/mnt/data/greenplum/primary
/mnt/data/greenplum/master
一.系统初始化
提示: 在所有greenplum节点(master,segment)上操作
1.禁用selinux
修改/etc/sysconfig/selinux
SELINUX=disabled
2.禁用防火墙
systemctl stop iptables
systemctl disable iptables
iptables-save >/etc/sysconfig/iptables
systemctl stop firewalld
systemctl disable firewalld
3.内核参数
cat >>/etc/sysctl.conf <<EOF
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.ip_forward = 0
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 = 1025 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.overcommit_memory = 2
EOF
4.资源限制
cat >>/etc/security/limits.conf <<EOF
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
EOF
cat >>/etc/security/limits.d/20-nproc.conf
<<EOF
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
EOF
5.xfs文件系统挂载参数(/etc/fstab)
rw,noatime,inode64,allocsize=16m
6.磁盘I/O策略(deadline)
echo deadline > /sys/block/sdb/queue/scheduler
i.centos7(grub2)
grubby --update-kernel=ALL
--args="elevator=deadline"
提示: grubby会自动将内核参数添加到grub2配置文件对应的 linux16行末
ii.centos6(/boot/grub/grub.conf)
kernel /vmlinuz-2.6.18-274.3.1.el5 ro root=LABEL=/
elevator=deadline crashkernel=128M@16M quiet
console=tty1
console=ttyS1,115200 panic=30 transparent_hugepage=never
initrd /initrd-2.6.18-274.3.1.el5.img
7.磁盘read-ahead
/sbin/blockdev --setra 16384 /dev/sdb
8./etc/hosts
172.25.178.50 greenplum-master
172.25.155.51 greenplum-segment1
172.25.155.52 greenplum-segment2
172.25.155.53 greenplum-segment3
9.禁用透明大页
echo never >
/sys/kernel/mm/transparent_hugepage/enabled
i.centos7(grub2)
grubby --update-kernel=ALL
--args="transparent_hugepage=never"
ii.centos6(/boot/grub/grub.conf)
kernel /vmlinuz-2.6.18-274.3.1.el5 ro root=LABEL=/
elevator=deadline crashkernel=128M@16M quiet
console=tty1
console=ttyS1,115200 panic=30 transparent_hugepage=never
initrd /initrd-2.6.18-274.3.1.el5.img
10.禁用IPC
object removal
修改/etc/systemd/logind.conf [Login]段落
RemoveIPC=no
systemctl restart systemd-logind
11.创建greenplum管理员
useradd -r -m gpadmin
echo 'gpassword'|passwd --stdin gpadmin
12.安装依赖包
yum -y install ed
注意:
greenplum依赖ed,否则无法初始化成功
13.系统重启
重启后检查相关内核参数是否生效
二.安装greenplum
master&segment
提示: 在master节点上操作
1.master,segment ssh key认证
提前先在master节点上做好各节点的ssh key认证
su - root
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa -q -b 2048
ssh-copy-id root@greenplum-master
ssh-copy-id root@greenplum-segment1
ssh-copy-id root@greenplum-segment2
ssh-copy-id root@greenplum-segment3
su - gpadmin
ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa -q -b 2048
ssh-copy-id gpadmin@greenplum-master
ssh-copy-id gpadmin@greenplum-segment1
ssh-copy-id gpadmin@greenplum-segment2
ssh-copy-id gpadmin@greenplum-segment3
2.解压安装greenplum
su - root
unzip
greenplum-db-appliance-4.3.9.0-build-1-RHEL5-x86_64.zip
cat >hostfile <<EOF
greenplum-master
greenplum-segment1
greenplum-segment2
greenplum-segment3
EOF
./greenplum-db-appliance-4.3.9.0-build-1-RHEL5-x86_64.bin
[root@greenplum-master ~]#
./greenplum-db-appliance-4.3.9.0-build-1-RHEL5-x86_64.bin
======================================================================
Greenplum DB
Appliance Automated
Installer
----------------------------------------------------------------------
Timestamp ......... : Wed Oct
26 10:28:04 UTC 2016
Product Installer.. :
greenplum-db-appliance-4.3.9.0-build-1-RHEL5-x86_64.bin
Product Version ... :
4.3.9.0
Build Number ......
:
Install Dir ....... :
/usr/local/GP-4.3.9.0
Install Log file .. :
/root/install-261016-102804.log
======================================================================
Creating
/usr/local/GP-4.3.9.0
======================================================================
Executing Post Appliance
Installation Steps
======================================================================
Executing: source
/usr/local/GP-4.3.9.0/greenplum_path.sh
Executing: gpseginstall --file
hostfile -c csv 2>&1 | tee -a
/root/install-261016-102804.log
20161026:10:28:11:014995
gpseginstall:greenplum-master:root-[INFO]:-Installation
Info:
link_name
greenplum-db
binary_path
/usr/local/GP-4.3.9.0
binary_dir_location
/usr/local
binary_dir_name
GP-4.3.9.0
20161026:10:28:11:014995
gpseginstall:greenplum-master:root-[INFO]:-check cluster password
access
20161026:10:28:13:014995
gpseginstall:greenplum-master:root-[INFO]:-de-duplicate
hostnames
20161026:10:28:13:014995
gpseginstall:greenplum-master:root-[INFO]:-master hostname:
greenplum-master
20161026:10:28:14:014995
gpseginstall:greenplum-master:root-[INFO]:-chown -R gpadmin:gpadmin
/usr/local/greenplum-db
20161026:10:28:14:014995
gpseginstall:greenplum-master:root-[INFO]:-chown -R gpadmin:gpadmin
/usr/local/GP-4.3.9.0
20161026:10:28:14:014995
gpseginstall:greenplum-master:root-[INFO]:-rm -f
/usr/local/GP-4.3.9.0.tar; rm -f
/usr/local/GP-4.3.9.0.tar.gz
20161026:10:28:14:014995
gpseginstall:greenplum-master:root-[INFO]:-cd /usr/local; tar cf
GP-4.3.9.0.tar GP-4.3.9.0
20161026:10:28:16:014995
gpseginstall:greenplum-master:root-[INFO]:-gzip
/usr/local/GP-4.3.9.0.tar
20161026:10:28:43:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: mkdir -p
/usr/local
20161026:10:28:44:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: rm -rf
/usr/local/GP-4.3.9.0
20161026:10:28:45:014995
gpseginstall:greenplum-master:root-[INFO]:-scp software to remote
location
20161026:10:28:49:014995
gpseginstall:greenplum-master:root-[INFO]:-remote com mand: gzip -f
-d /usr/local/GP-4.3.9.0.tar.gz
20161026:10:28:54:014995
gpseginstall:greenplum-master:root-[INFO]:-md5 check on remote
location
20161026:10:28:56:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: cd
/usr/local; tar xf GP-4.3.9.0.tar
20161026:10:28:57:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: rm -f
/usr/local/GP-4.3.9.0.tar
20161026:10:28:58:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: cd
/usr/local; rm -f greenplum-db; ln -fs GP-4.3.9.0
greenplum-db
20161026:10:28:59:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: chown -R
gpadmin:gpadmin /usr/local/greenplum-db
20161026:10:29:00:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: chown -R
gpadmin:gpadmin /usr/local/GP-4.3.9.0
20161026:10:29:01:014995
gpseginstall:greenplum-master:root-[INFO]:-rm -f
/usr/local/GP-4.3.9.0.tar.gz
20161026:10:29:01:014995
gpseginstall:greenplum-master:root-[INFO]:-version string on
master: gpssh version 4.3.9.0 build 1
20161026:10:29:01:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: .
/usr/local/greenplum-db/./greenplum_path.sh;
/usr/local/greenplum-db/./bin/gpssh --version
20161026:10:29:02:014995
gpseginstall:greenplum-master:root-[INFO]:-remote command: .
/usr/local/GP-4.3.9.0/greenplum_path.sh;
/usr/local/GP-4.3.9.0/bin/gpssh --version
20161026:10:29:09:014995
gpseginstall:greenplum-master:root-[INFO]:-SUCCESS -- Requested commands
completed
======================================================================
Installation
complete
======================================================================
安装完成后,segment节点上会多出greenplum的安装目录
三.确认安装
提示: 在master节点上操作
su - gpadmin
cat >hostfile_exkeys <<EOF
greenplum-master
greenplum-segment1
greenplum-segment2
greenplum-segment3
EOF
source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f hostfile_exkeys -e ls -l $GPHOME
如果所有节点安装正常,则无需密码即可显示$GPHOME
提示: 如果期间有提示输入密码,可以通过以下命令来再次ssh key认证
gpssh-exkeys -f hostfile_exkeys
四.greenplum存储路径
提示: 在master节点上操作
1.master
su - root
mkdir -p /mnt/data/greenplum/{primary,master}
chown -R gpadmin: /mnt/data/greenplum
提示: master不存放user data,只存放system catalog tables and system
metadata,因此空间没必要和segment一样那么大,合理归化就行
2.segment
su - root
cat >hostfile_gpssh_segonly <<EOF
greenplum-segment1
greenplum-segment2
greenplum-segment3
EOF
source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f hostfile_gpssh_segonly -e 'mkdir -p
/mnt/data/greenplum/{primary,mirror}'
gpssh -f hostfile_gpssh_segonly -e 'chown -R gpadmin:
/mnt/data/greenplum'
提示: 无需登录到segment主机,在master上即可完成
五.初始化db
提示: 在master节点上操作
1.创建初始化主机配置文件hostfile_gpinitsystem
su - gpadmin
cat >hostfile_gpinitsystem <<EOF
greenplum-segment1
greenplum-segment2
greenplum-segment3
EOF
注意: 这里仅填入segment节点
2.创建初始化配置文件gpinitsystem_config
su - gpadmin
source /usr/local/GP-4.3.9.0/greenplum_path.sh
mkdir gpconfigs
cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config
/home/gpadmin/gpconfigs/gpinitsystem_config
修改项
ARRAY_NAME="ULE Greenplum
DW"
MASTER_HOSTNAME=greenplum-master
declare -a
DATA_DIRECTORY=(/mnt/data/greenplum/primary)
MASTER_DIRECTORY=/mnt/data/greenplum/master
3.初始化db
su - gpadmin
source /usr/local/GP-4.3.9.0/greenplum_path.sh
gpinitsystem -c gpconfigs/gpinitsystem_config -h
hostfile_gpinitsystem
中间会提示是否继续,按y/Y
[gpadmin@greenplum-master ~]$
gpinitsystem -c gpconfigs/gpinitsystem_config -h
hostfile_gpinitsystem
20161027:05:35:10:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Checking
configuration parameters, please wait...
20161027:05:35:10:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Reading Greenplum
configuration file gpconfigs/gpinitsystem_config
20161027:05:35:10:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Locale has not been
set in gpconfigs/gpinitsystem_config, will set to default
value
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Locale set to
en_US.utf8
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-No DATABASE_NAME set,
will exit following template1 updates
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-MASTER_MAX_CONNECT
not set, will set to default value 250
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Checking
configuration parameters, Completed
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Commencing multi-home
checks, please wait...
...
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Configuring build for
standard array
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Commencing multi-home
checks, Completed
20161027:05:35:11:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Building primary
segment instance array, please wait...
...
20161027:05:35:13:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Checking Master
host
20161027:05:35:13:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Checking new segment
hosts, please wait...
...
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Checking new segment
hosts, Completed
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Greenplum Database
Creation Parameters
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:---------------------------------------
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master
Configuration
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:---------------------------------------
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master instance name
= ULE Greenplum DW
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master hostname =
greenplum-master
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master port =
5432
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master instance dir =
/mnt/data/greenplum/master/gpseg-1
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master LOCALE =
en_US.utf8
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Greenplum segment
prefix = gpseg
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master Database
=
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master connections =
250
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master buffers =
128000kB
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Segment connections =
750
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Segment buffers =
128000kB
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Checkpoint segments =
8
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Encoding =
UNICODE
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Postgres param file =
Off
20161027:05:35:17:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Initdb to be used =
/usr/local/greenplum-db/./bin/initdb
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-GP_LIBRARY_PATH is =
/usr/local/greenplum-db/./lib
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Ulimit check =
Passed
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Array host connect
type = Single hostname per node
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master IP address [1]
= ::1
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master IP address [2]
= 172.25.178.50
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Master IP address [3]
= fe80::f816:3eff:fe6a:623
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Standby Master = Not
Configured
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Primary segment # =
1
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Total Database
segments = 3
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Trusted shell =
ssh
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Number segment hosts
= 3
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Mirroring config =
OFF
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:----------------------------------------
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Greenplum Primary
Segment Configuration
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:----------------------------------------
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-greenplum-segment1
/mnt/data/greenplum/primary/gpseg0 40000 2 0
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-greenplum-segment2
/mnt/data/greenplum/primary/gpseg1 40000 3 1
20161027:05:35:18:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-greenplum-segment3
/mnt/data/greenplum/primary/gpseg2 40000 4 2
Continue with Greenplum
creation Yy/Nn>
y
20161027:05:35:24:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Building the Master
instance database, please wait...
20161027:05:36:16:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Starting the Master
in admin mode
20161027:05:36:21:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Commencing parallel
build of primary segment instances
20161027:05:36:21:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Spawning parallel
processes batch [1], please wait...
...
20161027:05:36:22:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Waiting for parallel
processes batch [1], please wait...
............................................................................
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:------------------------------------------------
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Parallel process exit
status
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:------------------------------------------------
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Total processes
marked as completed = 3
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Total processes
marked as killed = 0
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Total processes
marked as failed = 0
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:------------------------------------------------
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Deleting distributed
backout files
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Removing back out
file
20161027:05:37:38:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-No errors generated
from parallel processes
20161027:05:37:39:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Restarting the
Greenplum instance in production mode
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Starting gpstop with args:
-a -i -m -d /mnt/data/greenplum/master/gpseg-1
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Gathering information and
validating the environment...
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Obtaining Greenplum Master
catalog information
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Obtaining Segment details
from master...
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Greenplum Version:
'postgres (Greenplum Database) 4.3.9.0 build 1'
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-There are 0 connections to
the database
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Commencing Master instance
shutdown with mode='immediate'
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Master
host=greenplum-master
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Commencing Master instance
shutdown with mode=immediate
20161027:05:37:39:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Master segment instance
directory=/mnt/data/greenplum/master/gpseg-1
20161027:05:37:40:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Attempting forceful
termination of any leftover master process
20161027:05:37:40:008319
gpstop:greenplum-master:gpadmin-[INFO]:-Terminating processes for
segment /mnt/data/greenplum/master/gpseg-1
20161027:05:37:40:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Starting gpstart with
args: -a -d /mnt/data/greenplum/master/gpseg-1
20161027:05:37:40:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Gathering information and
validating the environment...
20161027:05:37:40:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Greenplum Binary Version:
'postgres (Greenplum Database) 4.3.9.0 build 1'
20161027:05:37:40:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Greenplum Catalog Version:
'201310150'
20161027:05:37:40:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Starting Master instance
in admin mode
20161027:05:37:41:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Obtaining Greenplum Master
catalog information
20161027:05:37:41:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Obtaining Segment details
from master...
20161027:05:37:41:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Setting new master
era
20161027:05:37:41:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Master
Started...
20161027:05:37:41:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Shutting down
master
20161027:05:37:43:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Commencing parallel
segment instance startup, please wait...
..
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Process
results...
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:- Successful segment starts
= 3
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:- Failed segment starts =
0
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:- Skipped segment starts
(segments are marked down in configuration) = 0
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:-
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Successfully started 3 of 3 segment
instances
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:05:37:45:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Starting Master instance
greenplum-master directory
/mnt/data/greenplum/master/gpseg-1
20161027:05:37:46:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Command pg_ctl reports
Master greenplum-master instance active
20161027:05:37:46:008406
gpstart:greenplum-master:gpadmin-[INFO]:-No standby master
configured. skipping...
20161027:05:37:46:008406
gpstart:greenplum-master:gpadmin-[INFO]:-Database successfully
started
20161027:05:37:46:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Completed restart of
Greenplum instance in production mode
20161027:05:37:46:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Loading
gp_toolkit...
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Scanning utility log
file for any warning messages
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Log file scan check
passed
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Greenplum Database
instance successfully created
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-------------------------------------------------------
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-To complete the
environment configuration, please
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-update gpadmin
.bashrc file with the following
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-1. Ensure that the
greenplum_path.sh file is sourced
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-2. Add "export
MASTER_DATA_DIRECTORY=/mnt/data/greenplum/master/gpseg-1"
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:- to access the
Greenplum scripts for this instance:
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:- or, use -d
/mnt/data/greenplum/master/gpseg-1 option for the Greenplum
scripts
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:- Example gpstate -d
/mnt/data/greenplum/master/gpseg-1
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Script log file =
/home/gpadmin/gpAdminLogs/gpinitsystem_20161027.log
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-To remove instance,
run gpdeletesystem utility
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-To initialize a
Standby Master Segment for this Greenplum instance
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Review options for
gpinitstandby
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-------------------------------------------------------
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-The Master
/mnt/data/greenplum/master/gpseg-1/pg_hba.conf post
gpinitsystem
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-has been configured
to allow all hosts within this new
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-array to
intercommunicate. Any hosts external to this
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-new array must be
explicitly added to this file
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-Refer to the
Greenplum Admin support guide which is
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-located in the
/usr/local/greenplum-db/./docs directory
20161027:05:37:48:060275
gpinitsystem:greenplum-master:gpadmin-[INFO]:-------------------------------------------------------
一切顺利的话,db正常初始化成功
4.设置greenplum环境变量
su - gpadmin
cat >>.bashrc <<EOF
source /usr/local/greenplum-db/greenplum_path.sh
export
MASTER_DATA_DIRECTORY=/mnt/data/greenplum/master/gpseg-1
EOF
source .bashrc
提示:
greenplum配置文件都放在/mnt/data/greenplum/master/gpseg-1目录下
5.确认greenplum状态
su - gpadmin
gpstate -s
[gpadmin@greenplum-master ~]$
gpstate -s
20161027:07:08:02:011423
gpstate:greenplum-master:gpadmin-[INFO]:-Starting gpstate with
args: -s
20161027:07:08:02:011423
gpstate:greenplum-master:gpadmin-[INFO]:-local Greenplum Version:
'postgres (Greenplum Database) 4.3.9.0 build 1'
20161027:07:08:02:011423
gpstate:greenplum-master:gpadmin-[INFO]:-master Greenplum Version:
'PostgreSQL 8.2.15 (Greenplum Database 4.3.9.0 build 1) on
x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled
on Aug 8 2016 05:36:26'
20161027:07:08:02:011423
gpstate:greenplum-master:gpadmin-[INFO]:-Obtaining Segment details
from master...
20161027:07:08:02:011423
gpstate:greenplum-master:gpadmin-[INFO]:-Gathering data from
segments...
.
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:--Master Configuration
& Status
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Master host =
greenplum-master
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Master postgres process
ID = 8467
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Master data directory =
/mnt/data/greenplum/master/gpseg-1
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Master port =
5432
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Master current role =
dispatch
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Greenplum initsystem
version = 4.3.9.0 build 1
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Greenplum current version
= PostgreSQL 8.2.15 (Greenplum Database 4.3.9.0 build 1) on
x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled
on Aug 8 2016 05:36:26
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Postgres version =
8.2.15
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Master standby = No
master standby configured
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:-Segment Instance Status
Report
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Segment Info
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Hostname =
greenplum-segment1
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Address =
greenplum-segment1
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Datadir =
/mnt/data/greenplum/primary/gpseg0
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Port = 40000
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Status
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- PID = 7362
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Configuration reports
status as = Up
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Database status =
Up
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Segment Info
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Hostname =
greenplum-segment2
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Address =
greenplum-segment2
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Datadir =
/mnt/data/greenplum/primary/gpseg1
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Port = 40000
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Status
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- PID = 6473
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Configuration reports
status as = Up
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Database status =
Up
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:-----------------------------------------------------
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Segment Info
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Hostname =
greenplum-segment3
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Address =
greenplum-segment3
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Datadir =
/mnt/data/greenplum/primary/gpseg2
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Port = 40000
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Status
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- PID = 5830
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Configuration reports
status as = Up
20161027:07:08:03:011423
gpstate:greenplum-master:gpadmin-[INFO]:- Database status =
Up
提示: 启动和停止 gpstart|gpstop
6.建库
su - gpadmin
psql postgres gpadmin -c 'CREATE DATABASE mydatbase'
+
psql postgres gpadmin -c 'DROP DATABASE mydatbase'
图形化客户端工具gpadmin
六.配置ntp
提示: 在所有greenplum节点(master,segment)上操作
su - root
yum -y install ntpdate
echo "*/10 * * * * /usr/sbin/ntpdate 172.25.130.31"
>>/var/spool/cron/root
补充:
一.oracle兼容函数
1.安装
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
psql -d testdb -f
$GPHOME/share/postgresql/contrib/orafunc.sql
2.卸载
$GPHOME/share/postgresql/contrib/uninstall_orafunc.sql
二.卸载greenplm
unlink /usr/local/greenplum-db
rm -rf /usr/local/GP-4.3.9.0/
rm -rf /mnt/data/greenplum/
三.扩展greenplum standby master &
segment
1.ssh key(root)
su - root
cat >new_hosts_file <<EOF
greenplum-smaster
greenplum-segment4
greenplum-segment5
greenplum-segment6
EOF
source /usr/local/greenplum-db/greenplum_path.sh
gpssh-exkeys -e existing_hosts_file -x
new_hosts_file
2.创建greenplum系统用户gpadmin
su - root
source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f new_hosts_file 'useradd -rm gpadmin'
gpssh -f new_hosts_file 'echo gpassword | passwd --stdin
gpadmin'
gpssh -f new_hosts_file ls -l /home
3.ssh key(gpadmin)
su - gpadmin
cat >new_hosts_file <<EOF
greenplum-smaster
greenplum-segment4
greenplum-segment5
greenplum-segment6
EOF
source /usr/local/greenplum-db/greenplum_path.sh
gpssh-exkeys -e existing_hosts_file -x
new_hosts_file
4.初始化greenplum segment
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
gpexpand -f new_hosts_file
或以root用户通过gpseginstall快速安装segment
gpseginstall功能
i.同步master端的greenplum安装目录到指定主机(hostfile_exkeys)的相同目录并设置好目录权限
ii.自动创建系统用户gpadmin,默认初始密码changeme(可以参数指定)
iii.自动建立ssh key认证(root,gpadmin)
su - root
cat >hostfile_exkeys <<EOF
greenplum-smaster
greenplum-segment4
greenplum-segment5
greenplum-segment6
EOF
source /usr/local/greenplum-db/greenplum_path.sh
gpseginstall -f hostfile_exkeys -u gpadmin -p gpassword
附录:
greenplum初始化报错
报错1:UNKOWN_HOST
.gphostcache缓存了旧的副本,删除即可
报错2:
3个segment中只有segment1成功,其它两失败
原因:
环境差异,因为segment2,segment3漏装了ed软件包