作者:lianghc
本文分为两部分
参数配置:【GP6安装配置】 Greenplum6.2.1 安装手记(上)
执行安装:【GP6安装配置】 Greenplum6.2.1 安装手记(下)
目录
3.3.3 使用gpssh-exkeys 工具,打通n-n的免密登陆
3.4.3 批量设置greenplum在gpadmin用户的环境变量
3. 集群软件安装
参考:https://gpdb.docs.pivotal.io/6-2/install_guide/install_gpdb.html
# 与旧版本差异点
gp4.x/gp5.x 以前安装分为三部分
1. 安装master(一般是个bin的可执行文件,安装,并可以指定安装目录)
2. gpseginstall 安装各个seg
3. gp群参数校验
4. gpinitsystem 集群初始化
gp6.2 开始不提供zip 格式压缩包,仅提供rpm包,安装分为两步
1. 安装master(rpm -ivh / yum install -y),不可以指定安装目录,默认安装到/usr/local/
2. gp6 没有 gpseginstall工具。所以要么自己打包master 安装好的gp目录并传到seg上,要么各个节点单独yum 安装。
1.每个节点主机,单独yum
2.打包主节点的安装目录,并分发给seg主机。
3. 集群性能校验
4. gpinitsystem 集群初始化
3.1 执行安装程序
执行安装脚本,默认安装到/usr/local/ 目录下。
yum install -y ./greenplum-db-6.2.1-rhel6-x86_64.rpm
或者使用rpm 安装
rpm -ivh greenplum-db-6.2.1-rhel6-x86_64.rpm
本次测试是内网机,无法联网下载所有的依赖包,也没有提前外网下载好依赖包。而是等安装时缺什么,再下载什么。现在缺少 libyaml,下载并上传至服务器,安装后再试运行gp安装程序。libyaml下载地址 http://rpmfind.net/linux/rpm2html/search.php?query=libyaml(x86-64)
[root@mdw gp_install_package]# yum install -y ./greenplum-db-6.2.1-rhel6-x86_64.rpm
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Examining ./greenplum-db-6.2.1-rhel6-x86_64.rpm: greenplum-db-6.2.1-1.el6.x86_64
Marking ./greenplum-db-6.2.1-rhel6-x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package greenplum-db.x86_64 0:6.2.1-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================================================
Installing:
greenplum-db x86_64 6.2.1-1.el6 /greenplum-db-6.2.1-rhel6-x86_64 493 M
Transaction Summary
=======================================================================================================================================================
Install 1 Package(s)
Total size: 493 M
Installed size: 493 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : greenplum-db-6.2.1-1.el6.x86_64 1/1
Verifying : greenplum-db-6.2.1-1.el6.x86_64 1/1
Installed:
greenplum-db.x86_64 0:6.2.1-1.el6
Complete!
3.2 创建hostfile_exkeys
在$GPHOME目录创建两个host文件(all_host,seg_host),用于后续使用gpssh,gpscp 等脚本host参数文件
all_host : 内容是集群所有主机名或ip,包含master,segment,standby等。
seg_host: 内容是所有 segment主机名或ip
若一台机器有多网卡,且网卡没有绑定成bond0模式时,需要将多网卡的ip 或者host都列出来。
[root@mdw ~]# cd /usr/local/
[root@mdw local]# ls
bin etc games greenplum-db greenplum-db-6.2.1 include lib lib64 libexec openssh-6.5p1 sbin share src ssl
[root@mdw local]# cd greenplum-db
[root@mdw greenplum-db]# ls
bin docs etc ext greenplum_path.sh include lib open_source_license_pivotal_greenplum.txt pxf sbin share
[root@mdw greenplum-db]# vi all_host
[root@mdw greenplum-db]# vi seg_host
[root@mdw greenplum-db]# cat all_host
mdw
sdw1
sdw2
[root@mdw greenplum-db]# cat seg_host
sdw1
sdw2
修改文件夹权限
[root@mdw greenplum-db]# chown -R gpadmin:gpadmin /usr/local/greenplum*
3.3 集群互信,免密登陆
## 与旧版本差异点
gp6.x 以前无需3.3.1 ssh-keygen生成密钥,3.3.2 的ssh-copy-id 步骤,直接gpssh-exkeys -f all_host。
3.3.1 生成密钥
我的Linux还没有公私钥对,所以,要先生成一个
[root@mdw greenplum-db]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
88:c0:be:87:6a:c2:40:ed:fd:ab:34:f0:35:60:47:0f root@mdw
The key's randomart image is:
+--[ RSA 2048]----+
| E |
| . . o |
| + o . . |
| o o..o. |
|. o.o .oS |
|. +o.. . |
|o o .+. |
|.+ .. .. |
|+ .... |
+-----------------+
3.3.2 将本机的公钥复制到各个节点机器的authorized_keys文件中
[root@mdw greenplum-db]# ssh-copy-id sdw1
[root@mdw greenplum-db]# ssh-copy-id sdw2
3.3.3 使用gpssh-exkeys 工具,打通n-n的免密登陆
[root@mdw greenplum-db]# gpssh-exkeys -f all_host
Problem getting hostname for gpzq-sh-mb: [Errno -3] Temporary failure in name resolution
Traceback (most recent call last):
File "/usr/local/greenplum-db/./bin/gpssh-exkeys", line 409, in <module>
(primary, aliases, ipaddrs) = socket.gethostbyaddr(hostname)
socket.gaierror: [Errno -3] Temporary failure in name resolution
# 没有做章节( 2.2.1 配置每台机器host )的内容,导致上述错误
[root@gjzq-sh-mb greenplum-db]# hostname mdw
[root@gjzq-sh-mb greenplum-db]# gpssh-exkeys -f all_host
[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] retrieving credentials from remote hosts
... 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 sdw1
... finished key exchange with sdw2
[INFO] completed successfully
3.3.4 验证gpssh
[root@mdw ~]# source /usr/local/greenplum-db/greenplum_path.sh
[root@mdw ~]# g