首页 > 云计算 > 开源云工具 > greenplum麒麟安装笔记
本周尝试在中标麒麟操作系统下安装greenplum。中标麒麟操作系统采用强化的Linux内核,我们首先准备好三台已安装中标麒麟服务版系统的虚拟机。规划他们的IP地址分别为:
Master:10.81.2.20
Segment1:10.81.2.21
Segment2:10.81.2.22
通过查找greenplum的官方网站可知,greenplum支持的操作系统如下:
Red Hat Enterprise Linux 64-bit 7.x (See the following Note.)
Red Hat Enterprise Linux 64-bit 6.x
CentOS 64-bit 7.x
CentOS 64-bit 6.x
Ubuntu 18.04 LTS
Oracle Linux 64-bit 7, using the Red Hat Compatible Kernel (RHCK)
为了验证是否可在麒麟操作系统下安装,我们首先看下麒麟操作系统:
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 26 13:46:27 CST 2015 x86_64 x86_64 x86_64 GNU/Linux
由此可知,麒麟操作系统支持greenplum的安装。
下一步我们需要配置三台主机的静态IP,通过修改/etc/sysconfig/network-scripts/ifcfg-enoXXXX文件,具体修改如下:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16780032
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16780032
UUID=d1e5a4a9-4a63-4c56-a51d-6cf971293f24
DEVICE=eno16780032
ONBOOT=yes
IPADDR=10.81.2.20
GATEWAY=10.81.2.1
NETMASK=255.255.255.0
DNS1=202.117.80.6
DNS2=202.117.80.7
其中,三台主机的IP分别为:Master:10.81.2.20;Segment1:10.81.2.21;Segment2:10.81.2.22。这样我们还可以通过termius软件远程访问, Termius是一款功能十分强劲且受用户喜爱的跨平台SSH工具,比用虚拟机直接操作更加方便便捷。
在安装greenplum之前我们需要先关闭selinux和防火墙,以后如果要打开防火墙,可以只允许greenplum数据库端口即可。SELinux 全称 Security Enhanced Linux (安全强化 Linux),是Linux内核的安全保镖。防火墙主要是借助硬件和软件的作用于内部和外部网络的环境间产生一种保护的屏障,从而实现对计算机不安全网络因素的阻断。只有在防火墙同意情况下,用户才能够进入计算机内,如果不同意就会被阻挡于外。
关闭或者开启防火墙的命令如下:
systemctl start firewalld.service#启动firewall
systemctl stop firewalld.service#停止firewall
systemctl disable firewalld.service#禁止firewall开机启动
systemctl enable firewalld.service#允许firewall开机启动
关闭selinux的命令如下:
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
修改完后需要重启系统让命令生效
开启防火墙,并预留gp端口命令如下:
firewall-cmd --zone=public --permanent --add-port=5432/tcp
重载服务命令如下:
firewall-cmd --reload
检测端口是否开启命令如下:
firewall-cmd --query-port=5432/tcp
然后需要在/etc/sysctl.conf文件中加入有关共享内存与网络参数配置的内容,具体命令如下:
vi /etc/sysctl.conf
加入以下内容
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.sem = 250 64000 100 512
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.core.netdev_max_backlog = 10000
vm.overcommit_memory = 2
net.ipv4.conf.all.arp_filter = 1
修改完后,输入“:”,wq保存命令并退出。
然后在/etc/security/limits.conf文件中加入限制参数,修改后内容如下:
cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - a user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open file descriptors
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
#
#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
# End of file
然后执行命令“sysctl -p”让修改的参数生效,也可以重启系统。
下一步需要下载greenplum并编译安装。
1.下载(克隆)greenplum源码。
先安装git,通过yum install -y git命令安装,这里出现一个问题:yum通过配置的镜像源下载失败,通过查找资料发现原因是镜像源地址发生了更新变化,所以修改yum镜像源地址:具体通过修改yum配置文件:cat /etc/yum.repos.d/ns7-x86_64.repo更新镜像源地址。然后输入命令“yum install -y git”安装git,输入“git clone https://github.com/greenplum-db/gpdb”克隆greenplum源码,这里出现一个问题,git克隆失败,所以换另一种方法,在外部机器下载好greeplum的zip压缩包然后上传到麒麟虚拟机内部。
2.因为是编译安装greenplum,所以需要下载大量的依赖包,具体罗列如下:yum install -y curl-devel bzip2-devel python-devel openssl-devel wget perl-ExtUtils-Embed libxml2-devel openldap-devel pam pam-devel
yum install -y gcc-c++ libtool libaio bison vim-common.x86_64 vim-enhanced.x86_64 flex net-tools.x86_64 apr-devel
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install psi lockfile paramiko setuptools epydoc psutil
pip install --upgrade setuptools
这里出现一个问题:有时候yum install -y 某依赖包会出现失败的情况,反复尝试安装几次就可以成功。
3.编译安装greenplum
①进入gpdb目录(/opt/gpdb-master)。具体编译命令如下,我的安装目录在(/opt/gpsql):
cd /opt/gpdb-master
./configure --prefix=/opt/gpsql --with-gssapi --with-pgport=5432 --with-libedit-preferred --with-perl --with-python
原文作者:NWPU-WLAN;如有侵权,请联系管理员删除。