商城首页欢迎来到中国正版软件门户

您的位置: 首页 > 文章列表 > 系统应用 > centos6.6下如何安装GreenPlum4.3.5.2?

centos6.6下如何安装GreenPlum4.3.5.2?

  发布于2026-06-06 阅读(0)

扫一扫,手机访问

在GP官网上找了一圈,发现关于CentOS的最新版本信息不太明确,其实直接用Red Hat的对应版本就行,两者兼容性很好。

前言

Greenplum的安装思路大致是:选一台主机当Master,其他机器当Segment节点。机器不够?那就用虚拟机开三个CentOS 6.6,采用1+2模式(一个Master,两个Segment)。

安装的时候有个省事的办法:先在Master机上装好Greenplum,然后通过 gpssh-exkeys 在Master和Segment之间建立互信,接着用 gpssh 就能登录所有机器,做建用户、拷贝安装包等一系列操作。当然,装之前有人会调内核参数、限制参数什么的,看自己需求。我这虚拟机硬件根本达不到官方最低要求,索性跳过这一步。

安装前准备(可选)

1. 在Master机的 /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.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

改完后重启机器或执行 sysctl -p 生效。

2. 在Master机的 /etc/security/limits.conf 中添加

* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

⚠️ 注意:对于Red Hat 6.x和CentOS 6.x,/etc/security/limits.d/90-nproc.conf 里的参数会覆盖上面的设置。如果两个文件都配置了,记得确保 90-nproc.conf 中的参数也正确。

3. 关闭防火墙

chkconfig iptables off   # 永久关闭,重启后不启动
service iptables stop    # 临时关闭,重启后还会启动
# 用 service iptables status 检查状态

开始GP安装

1. 在Master上安装GP(root权限)

把下载的 greenplum-db-4.3.5.2-build-1-RHEL5-x86_64.zip 放到某个目录,解压(unzip),会得到一个ReadMe和一个.bin文件。默认GP装到 /usr/local/greenplum,其实装哪都行,这里我们选 /opt/greenplum/

执行bin文件:./greenplum-db-4.3.5.2-build-1-RHEL5-x86_64.bin,一路按空格看协议,直到提示输入 yes|no,打 yes。然后输入安装目录 /opt/greenplum/greenplum-db-4.3.5.2,接着一路 yes 就装好了,挺快的。

2. 创建gpadmin用户

习惯在Master机上先建一个负责GP数据库的用户 gpadmin,后面Segment机的同名用户通过 gpssh 远程添加。

groupadd -g 530 gpadmin
useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin
passwd gpadmin              # 设置密码
chown -R gpadmin:gpadmin /home/gpadmin
chown -R gpadmin:gpadmin /opt/greenplum

然后加载Greenplum的环境变量:

source /opt/greenplum/greenplum-db/greenplum_path.sh
# 注意:/opt/greenplum/greenplum-db 是 /opt/greenplum/greenplum-db-4.3.5.2 的软链接,如果没有就自己创建:
# ln -s /opt/greenplum/greenplum-db-4.3.5.2 /opt/greenplum/greenplum-db

3. 建立主机间的互信

首先,在Master机上编辑 /etc/hosts,把Master和Segment的IP与主机名写进去,比如:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.127.136 mdw   # master
192.168.127.137 sdw1  # segment
192.168.127.138 sdw2  # segment

接着,在某个目录(比如 /var)下建两个文件:hostlists(包含所有主机名)和 seg_hosts(只包含Segment主机名)。

/var/hostlists 内容:

mdw
sdw1
sdw2

/var/seg_hosts 内容:

sdw1
sdw2

开始建立互信:

gpssh-exkeys -f /var/hostlists
# 输出示例:
[STEP 1 of 5] create local ID and authorize on local host
 ... /home/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 mdw
 ... send to sdw1
 ***
 *** Enter password for sdw1: 
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
 ... finished key exchange with mdw
 ... finished key exchange with sdw1
[INFO] completed successfully

如果提示没有密钥,执行 ssh-keygen -t rsassh-add /root/.ssh/id_rsa。如果 ssh-add 报错“Could not open a connection to your authentication agent”,先执行 ssh-agent bash 即可。

互信建立后,就能用 gpssh -f /var/seg_hosts 访问所有Segment机器了。

本文转载于:https://www.jb51.net/os/RedHat/534343.html 如有侵犯,请联系zhengruancom@outlook.com删除。
免责声明:正软商城发布此文仅为传递信息,不代表正软商城认同其观点或证实其描述。

热门关注