Greeplum 在centos上部署安装

前端之家收集整理的这篇文章主要介绍了Greeplum 在centos上部署安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Greeplum安装过程(centos)

一、安装说明

1. 最少准备3台机器(或虚拟机),单台机器设置多个网卡的方式也可以,不过我没有实际操作过;

2.3台centos在6.5以上,配置>1cpu,内存>=2G,磁盘空间>20G;

3.每台机器都有固定IP(方便设置),分别命名为mdw,sdw01,sdw02。

二、调整系统参数

1.vim /etc/sysctl.conf #(在GreenPlum安装包里面有个README,有同样的内容)

[root@localhost ~]# cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings,enter new settings here,or in an /etc/sysctl.d/<name>.conf file
#
# For more information,see sysctl.conf(5) and sysctl.d(5).
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
[root@localhost ~]#

2..在 /etc/security/limits.conf 后面添加

[root@localhost ~]# vi /etc/security/limits.conf
# /etc/security/limits.conf
#
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

# End of file

3..关闭防火墙
[root@localhost ~]#chkconfig iptables off
[root@localhost ~]#service iptables stop

centos7 使用 firewalld 替代了iptables,注意命令的不同

(4).编辑 /boot/grub/grub.conf
[root@localhost ~]# vi /boot/grub/grub.conf

elevator=deadline
crashkernel=auto

三、安装Greenplum

1.在主节点上安装 greenplum

(1).下载 greenplum 软件,保存文件到/usr/local/wjc(我下载的版本是4.3.8.0)

https://network.pivotal.io/products/pivotal-gpdb#/releases/1624/file_groups/391

(2).新建用户 gpadmin
useradd gpadmin

[root@localhost ~]# useradd gpadmin
[root@localhost ~]# passwd #gpadmin

(3).解压greenplumxx.zip,并把解压后的.bin文件copy至/usr/local(官方推荐的安装路径,省却麻烦)
unzip xxxxxxx.zip
[root@localhost wjc]# pwd
/usr/local/wjc
[root@localhost wjc]# ls
greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.zip
[root@localhost wjc]# unzip greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.zip
Archive: greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.zip
inflating: README_INSTALL
inflating: greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.bin
[root@localhost wjc]# ls
greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.bin greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.zip README_INSTALL
[root@localhost wjc]#

[root@localhost wjc]# mv greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.bin /usr/local
[root@localhost wjc]# ls
greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.zip README_INSTALL
[root@localhost wjc]#

#执行下面的命令进行安装,可能要输入多个yes进行确定
[root@localhost wjc]#/bin/bash greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.bin

#进行安装,出现下面的信息表示安装完成

...

...
(Selecting no will exit the installer)
********************************************************************************

yes

Extracting product to /usr/local/greenplum-db-4.3.8.0

********************************************************************************
Installation complete.
Greenplum Database is installed in /usr/local/greenplum-db-4.3.8.0

Pivotal Greenplum documentation is available
for download at http://docs.gopivotal.com/gpdb
********************************************************************************
[root@localhost local]#
#记住:默认安装路径在
/usr/local/greenplum-db-4.3.8.0
(4).修改Greenplum所有者

[root@localhost local]# chown -R gpadmin /usr/local/greenplum-db
[root@localhost local]# chgrp -R gpadmin /usr/local/greenplum-db
[root@localhost local]# chown -R gpadmin /usr/local/greenplum-db-*.*.*.*
[root@localhost local]# chgrp -R gpadmin /usr/local/greenplum-db-*.*.*.*

(5).配置环境变量

[root@localhost local]#vim /etc/profile

添加以下文件
GPHOME=/usr/local/greenplum-db-4.3.8.0
PATH=$GPHOME/bin:$GPHOME/ext/python/bin:$PATH
export GPHOME
export PATH

[root@localhost local]# source /etc/profile

(6).设置Master主机上的数据目录,指定数据的存放位置,空间要足够
[root@localhost local]#mkdir /gpmaster
[root@localhost local]#chown -R gpadmin /gpmaster
[root@localhost local]#chgrp -R gpadmin /gpmaster

(7).使用gpadmin用户登录修改gpadmin的环境变量,否则初始化GP的时候会找不到master的存储文件
修改 文件vim ~/.bashrc 添加下面信息,并刷新

MASTER_DATA_DIRECTORY=/gpmaster
export MASTER_DATA_DIRECTORY
-------------
[root@localhost local]# su - gpadmin
[gpadmin@localhost ~]$ ls

[gpadmin@localhost ~]$ vim ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
MASTER_DATA_DIRECTORY=/gpmaster
export MASTER_DATA_DIRECTORY

[gpadmin@localhost ~]$ source ~/.bashrc

-------------------------
2.在各个区段服务器上安装GP


方法1:每台segment可以和master一样的安装方法
方法2:直接通过master主机对每台segment安装GP
(1).每台机器修改主机名

172.31.9.210 mdw
172.31.9.211sdw01
172.31.9.212sdw02


(2).master节点添加对应segmetn服务器的IP以及主机名
[root@localhost ~]# vim /etc/hosts
127.0.0.1 mdw
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.31.9.210 mdw
172.31.9.211sdw01
172.31.9.212sdw02

(3).在gpadmin用户根路径下新建两个文件,经常备用

[gpadmin@mdw ~]$ touch all_hosts
[gpadmin@mdw ~]$ vim all_hosts
mdw
sdw01
sdw02
~

[gpadmin@mdw ~]$ touch all_segs
[gpadmin@mdw ~]$ vim all_segs
sdw01
sdw02

(4).gpadmin登录
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
gpssh-exkeys -f /home/gpadmin/all_hosts #输入root密码


[gpadmin@mdw ~]$ source /usr/local/greenplum-db/greenplum_path.sh

(5).生成无密码认证
[gpadmin@mdw ~]$ source /usr/local/greenplum-db/greenplum_path.sh
[gpadmin@mdw ~]$ gpssh-exkeys -f /home/gpadmin/all_hosts
[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 sdw01
***
*** Enter password for sdw01:
[ERROR sdw01] bad password
***
*** Enter password for sdw01:

[STEP 4 of 5] determine common authentication file content

[STEP 5 of 5] copy authentication files to all remote hosts
... finished key exchange with sdw01

[INFO] completed successfully
[gpadmin@mdw ~]$

(6).为每个区段建立gpadmin用户 #待验证 root登录

a.为每个区段建立gpadmin用户
gpssh -f /home/gpadmin/all_segs '/usr/sbin/useradd gpadmin -d /home/gpadmin -s bin/bash'

b.建立密码
gpssh -f /home/gpadmin/all_segs 'echo “gpadmin_password” | passwd gpadmin –1'

(7).复制greenplum软件到segment host

a.在主节点上创建安装GP的tar文件
cd /usr/local
gtar -cvf /home/gpadmin/gp.tar greenplum-db-*.*.*.*

b.用goscp命令将其安装到各个segment
source /usr/local/greenplum-db/greenplum_path.sh
gpscp -f /home/gpadmin/all_segs /home/gpadmin/gp.tar=:/usr/local

启动gpssh会话
gpssh -f /home/gpadmin/all_segs

在gpssh下解压
=>gtar
=> gtar --directory /usr/local -xvf /usr/local/gp.tar

建立gp当前版本目录连接:
=> ln -s /usr/local/greenplum-db-*.*.*.* /usr/local/greenplum-db

(8).修改目录所有者
=> chown -R gpadmin /usr/local/greenplum-db
=> chgrp -R gpadmin /usr/local/greenplum-db
=> chown -R gpadmin /usr/local/greenplum-db-*.*.*.*
=> chgrp -R gpadmin /usr/local/greenplum-db-*.*.*.*

(9).建立segment节点上的存储区
=>
=>mkdir /home/gpadmin/primary #主文件
=>mkdir /home/gpadmin/mirror #镜像文件
修改权限和所有者(同步骤(8))

=> chown -R gpadmin /home/gpadmin/primary
=> chgrp -R gpadmin /home/gpadmin/primary
=> chown -R gpadmin /home/gpadmin/mirror
=> chgrp -R gpadmin /home/gpadmin/mirror

------#######--------
[gpadmin@mdw ~]$ gpssh -f /home/gpadmin/all_segs
Note: command history unsupported on this machine ...
=> ln -s /usr/local/greenplum-db-*.*.*.* /usr/local/greenplum-db
[sdw01]
=> chown -R gpadmin /usr/local/greenplum-db
[sdw01]
=> chgrp -R gpadmin /usr/local/greenplum-db
[sdw01]
=> chown -R gpadmin /usr/local/greenplum-db-*.*.*.*
[sdw01]
=> chgrp -R gpadmin /usr/local/greenplum-db-*.*.*.*
[sdw01]
=> mkdir /home/gpadmin/primary
[sdw01]
=> mkdir /home/gpadmin/mirror
[sdw01]
=> chown -R gpadmin /home/gpadmin/primary
[sdw01]
=> chgrp -R gpadmin /home/gpadmin/primary
[sdw01]
=> chown -R gpadmin /home/gpadmin/mirror
[sdw01]
=> chgrp -R gpadmin /home/gpadmin/mirror
[sdw01]
=> exit

[gpadmin@mdw ~]$


(10).退出gpssh交互模式
=>exit

3.初始化GP

(1).同步时钟

[gpadmin@mdw ~]$gpssh -f /home/gpadmin/all_hosts -v data
[gpadmin@mdw ~]$gpssh -f /home/gpadmin/all_hosts -v ntpd

(2).系统检测
[gpadmin@mdw ~]$gpcheckos -f /home/gpadmin/all_hosts


(3).将/usr/local/greenplum-db-4.3.8.0/docs/cli_help/gpconfigs/gpinitsystem_config 复制到/home/gpadmin/gpconfigs目录(没有就新建个)下然后编辑:
cd /home/gpadmin
mkdir gpconfigs
cp /usr/local/greenplum-db-4.3.8.0/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs

vi gpinitsystem_config


[gpadmin@mdw ~]$ cd /home/gpadmin
[gpadmin@mdw ~]$ mkdir gpconfigs
[gpadmin@mdw ~]$ cp /usr/local/greenplum-db-4.3.8.0/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs
[gpadmin@mdw ~]$ ls gpconfigs
gpinitsystem_config
[gpadmin@mdw ~]$

文件内容以及变化

(a).
#### the specified interface addresses).
declare -a DATA_DIRECTORY=(/data1/primary /data1/primary /data1/primary /data2/primary /data2/primary /data2/primary)
============>
declare -a DATA_DIRECTORY=(/home/gpadmin/primary)

(b).

#### will be created.
MASTER_DIRECTORY=/data/master
============>
#### will be created.
MASTER_DIRECTORY=/gpmaster

(c).

#### DATA_DIRECTORY parameter.
#declare -a MIRROR_DATA_DIRECTORY=(/data1/mirror /data1/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror)
============>
##declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/mirror /home/gpadmin/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror)
declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/mirror)

(d).

#### Create a database of this name after initialization.
#DATABASE_NAME=name_of_database
============>
DATABASE_NAME=gpexmp

(e).

#### with the the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem
============>
#### Specify the location of the host address file here instead of
#### with the the -h option of gpinitsystem.
MACHINE_LIST_FILE=/home/gpadmin/all_segs

#如果上一步骤出现 不能修改的问题,则执行下面的授权

[gpadmin@mdw ~]$ cd gpconfigs/
[gpadmin@mdw gpconfigs]$ ls -lh
total 4.0K
-r--r--r--. 1 gpadmin gpadmin 2.6K Apr 24 23:16 gpinitsystem_config
[gpadmin@mdw gpconfigs]$ chmod 774 gpinitsystem_config
[gpadmin@mdw gpconfigs]$ ls -lh
total 4.0K
-rwxrwxr--. 1 gpadmin gpadmin 2.6K Apr 24 23:16 gpinitsystem_config
[gpadmin@mdw gpconfigs]$

(4).初始化数据库
[gpadmin@mdw gpconfigs]$source /usr/local/greenplum-db/greenplum_path.sh
[gpadmin@mdw gpconfigs]$gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config

##出现下面的信息表示安装成功

20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[INFO]:-Scanning utility log file for any warning messages
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[WARN]:-*******************************************************
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[WARN]:-were generated during the array creation
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[INFO]:-Please review contents of log file
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20160425.log
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[INFO]:-To determine level of criticality
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[INFO]:-These messages could be from a prevIoUs run of the utility
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[INFO]:-that was called today!
20160425:03:26:45:007989 gpinitsystem:mdw:gpadmin-[WARN]:-*******************************************************
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database instance successfully created
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-To complete the environment configuration,please
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-update gpadmin .bashrc file with the following
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/gpmaster/gpseg-1"
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:- to access the Greenplum scripts for this instance:
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:- or,use -d /gpmaster/gpseg-1 option for the Greenplum scripts
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:- Example gpstate -d /gpmaster/gpseg-1
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20160425.log
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-To remove instance,run gpdeletesystem utility
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-Review options for gpinitstandby
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-The Master /gpmaster/gpseg-1/pg_hba.conf post gpinitsystem
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-new array must be explicitly added to this file
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-located in the /usr/local/greenplum-db/./docs directory
20160425:03:26:46:007989 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------

(5).记住我们的数据库名字叫做gpexpmp,我们可以进行测试,在gpadmin下,执行以下查询:
psql -d gpexmp
gpexmp=#select current_timestamp;

[gpadmin@mdw ~]$ psql -d gpexmp
psql (8.2.15)
Type "help" for help.

gpexmp=# select current_timestamp;
now
-------------------------------
2016-04-25 03:27:28.866806-07
(1 row)

gpexmp=#

(6).安装完毕!

原文链接:https://www.f2er.com/centos/380838.html

猜你在找的CentOS相关文章