greenplum 源码离线安装

由于之前想在完全隔离外网的情况下完成greenplum的源码安装,所以做了这个实验,我的实验思路是在安装的过程中根据报错安装缺失的包;主要思路是yum本地源安装或google/必应;

1.准备工作

1.1.源码下载: greenplum-db/gpdb

1.2.yum本地源配置

1.3.参考博客: Greenplum 源码安装教程 — 以 CentOS 平台为例

1.4.基本工具安装:

apr-1.6.3.tar.bz2
地址: https://archive.apache.org/dist/apr/apr-1.6.3.tar.bz2
步骤:
tar jxvf apr-1.6.3.tar.bz2
./configure --prefix=/usr    \
            --disable-static \
            --with-installbuilddir=/usr/share/apr-1/build
make
make install

libevent-2.1.8-stable.tar.gz 
地址: http://libevent.org/
步骤:
tar zxvf libevent-2.1.8-stable.tar.gz
./configure
make
make install

2.机器基本配置

操作系统      :        CentOS release 6.6 (Final)
基本配置      :
CPU:
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 60
Stepping:              3
CPU MHz:               2901.000
BogoMIPS:              5802.00
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              3072K
NUMA node0 CPU(s):     0,1

MEM:
             total       used       free     shared    buffers     cached
Mem:          1870       1727        142          0        154       1261
-/+ buffers/cache:        311       1558
Swap:         4095          0       4095

DISK:
Filesystem     Type   Size  Used Avail Use% Mounted on
/dev/sda3      ext4    45G   23G   20G  54% /
tmpfs          tmpfs  936M     0  936M   0% /dev/shm
/dev/sda1      ext4   190M   35M  146M  20% /boot

操作步骤

stp.0.工作基本信息记录

user    : demo
home_dir: /home/demo
work_dir: /home/demo/demo

stp.1.放包&&解压

[root@mdw]# cd /home/demo/demo
[root@mdw]# unzip gpdb-master.zip
[root@mdw]# chown -R demo.demo gpdb-master

stp.2.配置/etc/hosts

[root@mdw]# vi /etc/hosts
xxx.xxx.xxx.xxx mdw
:x

同步修改/etc/sysconfig/network
[root@mdw]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mdw
:x

stp.3.配置/etc/sysctl.conf

[root@mdw]# vi /etc/sysctl.conf
kernel.shmall                             = 4294967296
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
:x

stp.4.使配置/etc/sysctl.conf生效

[root@mdw]#  sysctl -p 

stp.5.修改文件打开限制[ /etc/security/limits.conf ]

[root@mdw]# vi /etc/security/limits.conf 
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
:x

stp.5.参数生效确认

[root@mdw]# su - demo
[root@mdw]# ulimit -n
[root@mdw]# ulimit -u

stp.6.关闭SELINUX安全设置

[root@mdw]# vi /etc/selinux/config 
...... [省略多余内容]
SELINUX=disabled
...... [省略多余内容]
:x

stp.7.关闭防火墙

[root@mdw]# chkconfig iptables off ##[永久性生效,重启后不会复原]
[root@mdw]# service iptables stop  ##[即时生效]

stp.8.解压代码编译安装

[root@mdw]# su - demo
[demo@mdw]$ cd /home/demo/demo/gpdb-master
[demo@mdw]$ mkdir /home/demo/gpdb
[demo@mdw]$ ./configure --prefix=/home/demo/gpdb
[demo@mdw]$ make
[demo@mdw]$ make install

stp.9.初始化数据库

[demo@mdw]$ mkdir ~/init

9.1.拷贝模板文件 
[demo@mdw]$ cd ~/init/
[demo@mdw]$ cp ~/gpdb/docs/cli_help/gpconfigs/gpinitsystem_config ~/init/

9.2.编写数据库启动参数文件
[demo@mdw]$ vi ~/init/gpinitsystem_config
ARRAY_NAME="EMC Greenplum DW"
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/home/demo/gpdata/primary)
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/home/demo/gpdata/master
MASTER_PORT=5555
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
:x

9.3.创建对应的数据目录
[demo@mdw]$ mkdir -p ~/gpdata/master
[demo@mdw]$ mkdir -p ~/gpdata/{primary,mirror}

9.4.加载环境变量
[demo@mdw]$ source ~/gpdb/greenplum_path.sh

9.5.编译配置文件all_hosts
[demo@mdw]$ vi ~/init/all_hosts
mdw
:x

9.6.编译配置文件all_segs
[demo@mdw]$ vi ~/init/all_segs
mdw
:x

9.7.打通信任
gpssh-exkeys -f ~/init/all_hosts

9.8.将~/gpdb目录打包,并发送到所有其他机器,并指定对应的属主
--由于这里只是单台机器的测试安装,如果需要完整版的集群安装,请参考引用博客,谢谢

9.9.初始化
[demo@mdw]$ gpinitsystem -c gpinitsystem_config -h all_segs

stp.9.配置~/.bash_profile

[demo@mdw]$ vi ~/.bash_profile
source ~/gpdb/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/home/demo/gpdata/master/gpseg-1
export PGPORT=5555
export PGDATABASE=postgres
:x

stp.10.添加mirror

[demo@mdw]$ source ~/.bash_profile
[demo@mdw]$ gpaddmirrors -p 100
20180303:03:02:30:002930 gpaddmirrors:mdw:demo-[INFO]:-Starting gpaddmirrors with args: -p 100
20180303:03:02:30:002930 gpaddmirrors:mdw:demo-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 5.0.0 build dev'
20180303:03:02:30:002930 gpaddmirrors:mdw:demo-[INFO]:-master Greenplum Version: 'PostgreSQL 8.3.23 (Greenplum Database 5.0.0 build dev) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11) compiled on Mar  3 2018 00:18:22'
20180303:03:02:30:002930 gpaddmirrors:mdw:demo-[INFO]:-Obtaining Segment details from master...
Enter mirror segment data directory location 1 of 1 >
/home/demo/gpdata/mirror     --路径

思路解决方式

python ImportError解题思路:
1.从https://pypi.python.org/packages 下载源码
2.解压源码&&进入目录&&[python setup.py --help]安装

rpm包缺少解题思路:
1.从必应/google/github搜索
2.采用源码方式安装

报错汇总

configure: error: apr-1-config is required for gpfdist, unable to find binary
地址: https://archive.apache.org/dist/apr/apr-1.6.3.tar.bz2

configure: error: libevent is required for gpfdist  /*libevent-2.1.8-stable.tar.gz*/
地址: http://libevent.org/

configure: WARNING: libyaml is not found. disabling transformations for gpfdist.
安装方式: yum install libyaml-devel 

Error: unable to import module: No module named psutil 
地址: https://github.com/giampaolo/psutil

distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pbr>=1.8')
地址: https://pypi.python.org/pypi/pbr/1.8.0#downloads

ImportError: No module named lockfile.pidlockfile
地址: https://pypi.python.org/pypi/lockfile/0.12.2#downloads

参考资料

http://www.cnblogs.com/arthurqin/p/5849354.html

    原文作者:晓-mini
    原文地址: https://zhuanlan.zhihu.com/p/34205786
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞