1、环境准备服务器分配192.168.100.101--mdw192.168.100.11--smdw192.168.100.12--sdw1192.168.100.13--sdw2 ms1与ms2之间的心跳ip配置10.10.10.1--mdw10.10.10.2--smdw 2、修改hosts文件(所有主机hosts文件必须全部修改) vi /etc/hosts192.168.100.101 mdw1
1、环境准备
服务器分配
192.168.100.101--mdw
192.168.100.11--smdw
192.168.100.12--sdw1
192.168.100.13--sdw2
ms1与ms2之间的心跳ip配置
10.10.10.1--mdw
10.10.10.2--smdw
2、修改hosts文件(所有主机hosts文件必须全部修改)
vi /etc/hosts
192.168.100.101 mdw
192.168.100.11 smdw
192.168.100.12 sdw1
192.168.100.13 sdw2
3、关闭iptables和selinux
[root@mdw ~]# service iptables stop
[root@mdw ~]#
[root@mdw ~]#
[root@mdw ~]#
[root@mdw ~]#
[root@mdw ~]# chkconfig iptables --list
iptables 0:鍏抽棴 1:鍏抽棴 2:鍏抽棴 3:鍏抽棴 4:鍏抽棴 5:鍏抽棴 6:鍏抽棴
[root@mdw ~]# export LANG=zh_CN
[root@mdw ~]# chkconfig iptables --list
iptables 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭
[root@mdw ~]# 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 these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@mdw ~]# setenforce 0
4、修改系统参数
1)vi /etc/sysctl.conf
[root@mdw ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
error: "kernel.msgmin" is an unknown key
vm.overcommit_memory = 2
error: "net.ipv4.cp_tw_recycle" is an unknown key
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
error: "Invalid argument" setting key "net.ipv4.ip_local_port_range"
net.core.netdev_max_backlog = 10000
error: "xfs_mount_options" is an unknown key
kernel.shmmni = 4096
kernel.sem = 250 512000 100 2048
net.ipv4.tcp_tw_recycle = 1
net.ipv4.conf.default.arp_filter = 1
kernel.msgmni = 2048
2) vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
在RHEL6.x版本需要修改文件 /etc/security/limits.d/90-nproc.conf,增加如下内容:
* softnproc 131072
* hardnproc 131072
4、修改完系统参数后重启服务器
5、创建gpadmin用户
useradd gpadmin
6、安装GP
1) 上传安装文件解压缩
2)执行安装文件
[root@mdw GPDB]# ./greenplum-db-4.2.6.3-build-2-RHEL5-x86_64.bin
I HAVE READ AND AGREE TO THE TERMS OF THE ABOVE EMC SOFTWARE
LICENSE AGREEMENT.
********************************************************************************
Do you accept the EMC 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-4.2.6.3
********************************************************************************
/home/gpadmin/GPDB/install
********************************************************************************
Install Greenplum Database into ? [yes|no]
********************************************************************************
yes
********************************************************************************
[Optional] Provide the path to a previous installation of Greenplum Database,
or press ENTER to skip this step. e.g. /usr/local/greenplum-db-4.1.1.3
This installation step will migrate any Greenplum Database extensions from the
provided path to the version currently being installed. This step is optional
and can be run later with:
gppkg --migrate
/home/gpadmin/GPDB/install
********************************************************************************
Extracting product to /home/gpadmin/GPDB/install
Skipping migration of Greenplum Database extensions...
************************* *******************************************************
Installation complete.
Greenplum Database is installed in /home/gpadmin/GPDB/install
Greenplum Database documentation is available for download
at http://powerlink.emc.com.
********************************************************************************
[root@mdw GPDB]#
[root@mdw install]# source greenplum_path.sh
[root@mdw install]#
3)准备allnotes文件
[root@mdw install]# pwd
/home/gpadmin/GPDB/install
[root@mdw install]#
[root@mdw install]#
[root@mdw install]#
[root@mdw install]# ls
allnotes bin demo docs etc ext GPDB-LICENSE.txt greenplum_path.sh include lib LICENSE.thirdparty sbin share
[root@mdw install]# cat allnotes
sdw1
sdw2
smdw
4)建立多机互信
[root@mdw install]# gpssh-exkeys -f allnotes
[STEP 1 of 5] create local ID and authorize on local host
... /root/.ssh/id_rsa file exists ... key generation skipped
[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
... send to sdw2
***
*** Enter password for sdw2:
... send to smdw
[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
[ERROR] unable to copy authentication files to sdw2
lost connection
[ERROR] unable to copy authentication files to smdw
lost connection
上述报错解决办法:删除mdw /root/.ssh/目录下的内容 重新执行gpssh-exkeys -f allnotes
5)创建存放数据的目录
[root@mdw GPDB]# mkdir data
[root@mdw GPDB]# mkdir data/master
[root@mdw GPDB]# chown gpadmin:gpadmin data -R
[root@mdw GPDB]#
[root@mdw GPDB]#
[root@mdw GPDB]# ll
鎬荤敤閲109588
drwxr-xr-x 3 gpadmin gpadmin 4096 2鏈 20 16:21 data
lrwxrwxrwx 1 root root 9 2鏈 20 16:02 greenplum-db -> ./install
-rwxr-xr-x 1 root root 56782500 10鏈 8 06:45 greenplum-db-4.2.6.3-build-2-RHEL5-x86_64.bin
-rw-r--r-- 1 root root 55417563 11鏈25 11:44 greenplum-db-4.2.6.3-build-2-RHEL5-x86_64.zip
drwxr-xr-x 11 root root 4096 2鏈 20 16:04 install
-r--r--r-- 1 root root 6935 10鏈 8 06:45 README_INSTALL
[root@mdw GPDB]#
6)其他机器安装GP
[root@mdw install]# cat allseg
smdw
sdw1
sdw2
使用gpseginstall安装
[root@mdw install]# gpseginstall -f allseg -u gpadmin
20140220:16:28:05:003251 gpseginstall:mdw:root-[INFO]:-Installation Info:
link_name greenplum-db
binary_path /home/gpadmin/GPDB/install
binary_dir_location /home/gpadmin/GPDB
binary_dir_name install
20140220:16:28:05:003251 gpseginstall:mdw:root-[INFO]:-check cluster password access
20140220:16:28:06:003251 gpseginstall:mdw:root-[INFO]:-de-duplicate hostnames
20140220:16:28:06:003251 gpseginstall:mdw:root-[INFO]:-master hostname: mdw
20140220:16:28:07:003251 gpseginstall:mdw:root-[INFO]:-check for user gpadmin on cluster
20140220:16:28:07:003251 gpseginstall:mdw:root-[INFO]:-add user gpadmin on master
20140220:16:28:08:003251 gpseginstall:mdw:root-[INFO]:-add user gpadmin on cluster
20140220:16:28:08:003251 gpseginstall:mdw:root-[INFO]:-chown -R gpadmin:gpadmin /home/gpadmin/GPDB/greenplum-db
20140220:16:28:08:003251 gpseginstall:mdw:root-[INFO]:-chown -R gpadmin:gpadmin /home/gpadmin/GPDB/install
20140220:16:28:08:003251 gpseginstall:mdw:root-[INFO]:-rm -f /home/gpadmin/GPDB/install.tar; rm -f /home/gpadmin/GPDB/install.tar.gz
20140220:16:28:08:003251 gpseginstall:mdw:root-[INFO]:-cd /home/gpadmin/GPDB; tar cf install.tar install
20140220:16:28:09:003251 gpseginstall:mdw:root-[INFO]:-gzip /home/gpadmin/GPDB/install.tar
20140220:16:28:22:003251 gpseginstall:mdw:root-[INFO]:-remote command: mkdir -p /home/gpadmin/GPDB
20140220:16:28:22:003251 gpseginstall:mdw:root-[INFO]:-remote command: rm -rf /home/gpadmin/GPDB/install
20140220:16:28:23:003251 gpseginstall:mdw:root-[INFO]:-scp software to remote location
20140220:16:28:38:003251 gpseginstall:mdw:root-[INFO]:-remote command: gzip -f -d /home/gpadmin/GPDB/install.tar.gz
20140220:16:28:40:003251 gpseginstall:mdw:root-[INFO]:-md5 check on remote location
20140220:16:28:42:003251 gpseginstall:mdw:root-[INFO]:-remote command: cd /home/gpadmin/GPDB; tar xf install.tar
20140220:16:28:43:003251 gpseginstall:mdw:root-[INFO]:-remote command: rm -f /home/gpadmin/GPDB/install.tar
20140220:16:28:44:003251 gpseginstall:mdw:root-[INFO]:-remote command: cd /home/gpadmin/GPDB; rm -f greenplum-db; ln -fs install greenplum-db
20140220:16:28:44:003251 gpseginstall:mdw:root-[INFO]:-remote command: chown -R gpadmin:gpadmin /home/gpadmin/GPDB/greenplum-db
20140220:16:28:45:003251 gpseginstall:mdw:root-[INFO]:-remote command: chown -R gpadmin:gpadmin /home/gpadmin/GPDB/install
20140220:16:28:45:003251 gpseginstall:mdw:root-[INFO]:-rm -f /home/gpadmin/GPDB/install.tar.gz
Please enter a password:
Confirm password:
20140220:16:29:19:003251 gpseginstall:mdw:root-[INFO]:-Changing system passwords ...
20140220:16:29:20:003251 gpseginstall:mdw:root-[INFO]:-exchange ssh keys for user root
20140220:16:29:23:003251 gpseginstall:mdw:root-[INFO]:-exchange ssh keys for user gpadmin
20140220:16:29:24:003251 gpseginstall:mdw:root-[INFO]:-Exception running cmd: su gpadmin -c "gpssh-exkeys -f allseg"
20140220:16:29:24:003251 gpseginstall:mdw:root-[INFO]:-write() argument 2 must be string or buffer, not None
20140220:16:29:24:003251 gpseginstall:mdw:root-[INFO]:-gppsh-exkeys failed running from within pexpect ... now try outside of pexpect
[STEP 1 of 5] create local ID and authorize on local host
... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] authorize current user on remote hosts
... send to smdw
***
*** Enter password for smdw:
... send to 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 smdw
... finished key exchange with sdw1
... finished key exchange with sdw2
[INFO] completed successfully
20140220:16:29:31:003251 gpseginstall:mdw:root-[INFO]:-/home/gpadmin/GPDB/greenplum-db/./sbin/gpfixuserlimts -f /etc/security/limits.conf -u gpadmin
20140220:16:29:31:003251 gpseginstall:mdw:root-[INFO]:-remote command: . /home/gpadmin/GPDB/greenplum-db/./greenplum_path.sh; /home/gpadmin/GPDB/greenplum-db/./sbin/gpfixuserlimts -f /etc/security/limits.conf
-u gpadmin
20140220:16:29:32:003251 gpseginstall:mdw:root-[INFO]:-version string on master: gpssh version 4.2.6.3 build 2
20140220:16:29:32:003251 gpseginstall:mdw:root-[INFO]:-remote command: . /home/gpadmin/GPDB/greenplum-db/./greenplum_path.sh; /home/gpadmin/GPDB/greenplum-db/./bin/gpssh --version
20140220:16:29:33:003251 gpseginstall:mdw:root-[INFO]:-remote command: . /home/gpadmin/GPDB/install/greenplum_path.sh; /home/gpadmin/GPDB/install/bin/gpssh --version
20140220:16:29:39:003251 gpseginstall:mdw:root-[INFO]:-SUCCESS -- Requested commands completed
[root@mdw greenplum-db-4.2.6.3]# gpssh -f allnotes mkdir -p /data/d1 /data/d2 /data/m1 /data/m2
[sdw1]
[sdw2]
[root@mdw greenplum-db-4.2.6.3]# gpssh -f allnotes chown gpadmin:gpadmin /data/d1 /data/d2 /data/m1 /data/m2 -R
[sdw1]
[sdw2]
安装完成
7、数据库初始化
1)创建数据节点文件
[root@mdw install]# cat notes
sdw1
sdw2
2) 创建初始化参数文件
[root@mdw install]# cat gpinitsystem_config
ARRAY_NAME="Greenplum"
SEG_PREFIX=gpseg
PORT_BASE=50000
declare -a DATA_DIRECTORY=(/home/gpadmin/GPDB/data/d1 /home/gpadmin/GPDB/data/d2)
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/home/gpadmin/GPDB/data/master
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
MIRROR_PORT_BASE=60000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/GPDB/data/m1 /home/gpadmin/GPDB/data/m2)
3) 数据初始化
su - gpadmin
[gpadmin@mdw install]$ gpinitsystem -c gpinitsystem_config -h notes
vi .bashrc
#greenplum
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
vi $MASTER_DATA_DIRECTORY/pg_hba.conf
host all all 0/0 md5
3) 数据初始化
su - gpadmin
[gpadmin@mdw install]$ gpinitsystem -c gpinitsystem_config -h notes