您的位置:首页 > 其它

[原]greenplum安装详细过程

2016-07-20 20:17 483 查看
  今天又帮其他项目装了一遍GP,加上之前的两次,这是第三次了,虽然每次都有记录,但这次安装还是发现漏写了一些步骤,在此详细记录一下,需要的童鞋可以借鉴。

1、准备

  这里准备了4台服务器,1台做master,1台做standby,4台都做存储,为了保密真实的IP地址和主机名都换成“艺名”了。

OS:RedHatEnterpriseLinuxServerrelease6.4(Santiago)
GP:greenplum-db-4.3.6.2-build-1-RHEL5-x86_64.zip
JDK:1.7+

192.168.1.100  bj-gp-node1(segmentmaster)
192.168.1.101  bj-gp-node2(segmentstandby)
192.168.1.102  bj-gp-node3(segment)
192.168.1.103  bj-gp-node4(segment)


greenplum官网下载地址:http://gpn.greenplum.com/download.php(注:需要注册后才能下载)

2、系统参数配置

  系统参数配置的修改需要在每个节点服务器上执行

2.1.修改Linux内核参数

[root@bj-gp-node1~]#vi/etc/sysctl.conf
#KernelsysctlconfigurationfileforRedHatLinux
#
#Forbinaryvalues,0isdisabled,1isenabled.Seesysctl(8)and
#sysctl.conf(5)formoredetails.
#
#Use'/sbin/sysctl-a'tolistallpossibleparameters.

#ControlsIPpacketforwarding
net.ipv4.ip_forward=0

#Controlssourcerouteverification
net.ipv4.conf.default.rp_filter=1

#Donotacceptsourcerouting
net.ipv4.conf.default.accept_source_route=0

#ControlstheSystemRequestdebuggingfunctionalityofthekernel
kernel.sysrq=1

#ControlswhethercoredumpswillappendthePIDtothecorefilename.
#Usefulfordebuggingmulti-threadedapplications.
kernel.core_uses_pid=1

#ControlstheuseofTCPsyncookies
net.ipv4.tcp_syncookies=1

#Disablenetfilteronbridges
#net.bridge.bridge-nf-call-ip6tables=0
#net.bridge.bridge-nf-call-iptables=0
#net.bridge.bridge-nf-call-arptables=0

#Controlsthedefaultmaxmimumsizeofamesagequeue
kernel.msgmnb=65536

#Controlsthemaximumsizeofamessage,inbytes
kernel.msgmax=65536
kernel.msgmni=2048

kernel.sem=2505120001002048

#Controlsthemaximumsharedsegmentsize,inbytes
#kernel.shmmax=68719476736
kernel.shmmax=500000000
kernel.shmmni=4096

#Controlsthemaximumnumberofsharedmemorysegments,inpages
#kernel.shmall=4294967296
kernel.shmall=4000000000

net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_max_syn_backlog=4096
net.ipv4.ip_local_port_range=102565535
net.core.netdev_max_backlog=10000
vm.overcommit_memory=2
net.ipv4.conf.all.arp_filter=1
net.core.rmem_max=2097152
net.core.wmem_max=2097152


2.2.修改Linux最大限制

[root@bj-gp-node1~]#vi/etc/security/limits.conf
#greenplumconfigs
*softnofile65536
*hardnofile65536
*softnproc131072
*hardnproc131072


2.3.I/O调整优化

[root@bj-gp-node1~]#vi/boot/grub/menu.lst
#greenplumconfigs
elevator=deadline


2.4.添加所有节点到HOST

[root@bj-gp-node1~]#vi/etc/hosts

192.168.1.100  bj-gp-node1
192.168.1.101  bj-gp-node2
192.168.1.102  bj-gp-node3
192.168.1.103  bj-gp-node4


2.5.关闭防火墙

[root@bj-gp-node1~]#chkconfig--listiptables
[root@bj-gp-node1~]#chkconfig--level0123456iptablesoff


2.6.设置SELINUX

[root@bj-gp-node1~]#vi/etc/selinux/config
SELINUX=disabled


2.7.重启系统使配置生效

[root@bj-gp-node1~]#reboot


3、GP安装

  GP的安装操作都是在主节点master上执行的

3.1.创建gpadmin用户

[root@bj-gp-node1~]#useraddgpadmin
[root@bj-gp-node1~]#passwdgpadmin


3.2.设置gpadmin用户环境

[gpadmin@bj-gp-node1~]$cd/home/gpadmin
[gpadmin@bj-gp-node1~]$vi.bashrc

[gpadmin@bj-gp-node1~]$vi.bash_profile

.bashrc和.bash_profile最后都添加下面两行

source/usr/local/greenplum-db/greenplum_path.sh
exportMASTER_DATA_DIRECTORY=/data1/gpdata/master/gpseg-1


设置完后记得source一下使其立即生效

3.3.上传并解压安装包

将greenplum-db-4.3.6.2-build-1-RHEL5-x86_64.zip上传至master的/opt/目录下

[root@bj-gp-node1opt]#/bin/bashgreenplum-db-4.3.6.2-build-1-RHEL5-x86_64.bin


按提示输入回车或yes这一步会将安装包解压到/usr/local/下,并建立软连接greenplum-db

3.4.准备节点服务器信息文件

后面的批量安装会用到这两个文件,如果all_host和all_segment内容一样,可以只创建一个文件

[root@bj-gp-node1opt]#mkdir-p/opt/gpinit/
[root@bj-gp-node1gpinit]#touchall_host
[root@bj-gp-node1gpinit]#touchall_segment
all_host和all_segment内容:
bj-gp-node1
bj-gp-node2
bj-gp-node3
bj-gp-node4


3.5.建立节点服务器间的信任

[root@bj-gp-node1local]#gpssh-exkeys-f/opt/gpinit/all_host


按照提示输入root密码,记住这一步不能输入gpadmin的密码,因为批量安装时需要在/usr/local下创建目录,需要root权限

3.6.批量安装

[root@bj-gp-node1local]#gpseginstall-f/opt/gpinit/all_host-ugpadmin-pgpadmin


这一步其实就是将master上的greenplum打包通过scp命令传到all_host中的主机上,并赋予目录gpadmin的权限

3.7.检查批量安装情况

[root@bj-gp-node1local]#gpssh-f/opt/gpinit/all_host-els-l$GPHOME


返回结果中各节点目录一致则成功

3.8.创建存储目录

master
[root@bj-gp-node1local]#mkdir-p/data1/gpdata/master
[root@bj-gp-node1local]#chowngpadmin:gpadmin/data1/gpdata/master

segment
[root@bj-gp-node1local]#gpssh-f/opt/gpinit/all_host-e'mkdir-p/data1/gpdata/primary'
[root@bj-gp-node1local]#gpssh-f/opt/gpinit/all_host-e'chowngpadmin:gpadmin/data1/gpdata/primary'

mirror
[root@bj-gp-node1local]#gpssh-f/opt/gpinit/all_segment-e'mkdir-p/data1/gpdata/mirror'
[root@bj-gp-node1local]#gpssh-f/opt/gpinit/all_segment-e'chowngpadmin:gpadmin/data1/gpdata/mirror'



3.9.设置时钟同步

vi/etc/ntp.conf在server第一行添加下面两行
server192.168.1.1
server192.168.1.2
重启ntpd服务/etc/init.d/ntpdrestart
查看ntp同步情况ntpq-p
使ntpd服务重启服务器后也启动chkconfig--level0123456ntpdon


3.10.创建GP初始化文件

[gpadmin@bj-gp-node1~]$mkdir/home/gpadmin/gpconfigs
[gpadmin@bj-gp-node1~]$cp/usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config/home/gpadmin/gpconfigs/gpinitsystem_config
[gpadmin@tj-soc-c04-csfb1gpconfigs]$chmod775gpinitsystem_config


3.10修改GP初始化文件

[gpadmin@bj-gp-node1gpconfigs]$vigpinitsystem_config


#FILENAME:gpinitsystem_config


#Configurationfileneededbythegpinitsystem


################################################
####REQUIREDPARAMETERS
################################################


####NameofthisGreenplumsystemenclosedinquotes.
ARRAY_NAME="BJGreenplumDW"


####Namingconventionforutility-generateddatadirectories.
SEG_PREFIX=gpseg


####Basenumberbywhichprimarysegmentportnumbers
####arecalculated.
PORT_BASE=40000


####Filesystemlocation(s)whereprimarysegmentdatadirectories
####willbecreated.Thenumberoflocationsinthelistdictate
####thenumberofprimarysegmentsthatwillgetcreatedper
####physicalhost(ifmultipleaddressesforahostarelistedin
####thehostfile,thenumberofsegmentswillbespreadevenlyacross
####thespecifiedinterfaceaddresses).
declare-aDATA_DIRECTORY=(/data1/gpdata/primary/data1/gpdata/primary)


####OS-configuredhostnameorIPaddressofthemasterhost.
MASTER_HOSTNAME=bj-gp-node1


####Filesystemlocationwherethemasterdatadirectory
####willbecreated.
MASTER_DIRECTORY=/data1/gpdata/master


####Portnumberforthemasterinstance.
MASTER_PORT=5432


####Shellutilityusedtoconnecttoremotehosts.
TRUSTED_SHELL=ssh


####MaximumlogfilesegmentsbetweenautomaticWALcheckpoints.
CHECK_POINT_SEGMENTS=8


####Defaultserver-sidecharactersetencoding.
ENCODING=UNICODE


################################################
####OPTIONALMIRRORPARAMETERS
################################################


####Basenumberbywhichmirrorsegmentportnumbers
####arecalculated.
MIRROR_PORT_BASE=50000


####Basenumberbywhichprimaryfilereplicationport
####numbersarecalculated.
REPLICATION_PORT_BASE=41000


####Basenumberbywhichmirrorfilereplicationport
####numbersarecalculated.
MIRROR_REPLICATION_PORT_BASE=51000


####Filesystemlocation(s)wheremirrorsegmentdatadirectories
####willbecreated.Thenumberofmirrorlocationsmustequalthe
####numberofprimarylocationsasspecifiedinthe
####DATA_DIRECTORYparameter.
declare-aMIRROR_DATA_DIRECTORY=(/data1/gpdata/mirror/data1/gpdata/mirror)



################################################
####OTHEROPTIONALPARAMETERS
################################################


####Createadatabaseofthisnameafterinitialization.
DATABASE_NAME=bj_gp


####Specifythelocationofthehostaddressfilehereinsteadof
####withthethe-hoptionofgpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem



3.11.初始化GP

[gpadmin@bj-gp-node1~]$gpinitsystem-c/home/gpadmin/gpconfigs/gpinitsystem_config-h/opt/gpinit/all_host
中间需要输入一次:Y


如果没有报ERROR,GP数据库就安装好了。下面讲一些附加操作

4、附加项

4.1增加standby

一个gp集群只有一个master肯定会让人不放心,还好有备用,当master宕掉后,会自动启用standby作为master,下面来看一下standby怎么添加

在standby服务器上执行
[root@bj-gp-node2~]#mkdir/data1/gpdata/master
[root@bj-gp-node2~]#chowngpadmin:gpadmin/data1/gpdata/master

在master服务器上执行
[gpadmin@bj-gp-node1~]$gpinitstandby-sbj-gp-node2
中间输入一次Y


4.2.增加mirror

mirror就是镜像,也叫数据备份。mirror对于数据存储来说很重要,因为我们的服务器指不定什么时候出毛病,有mirror就好很多了,因为两台存储节点同时宕掉的几率还是很小的。如果前面在GP初始化文件里忘记配置mirror了,请按照下面的方法添加

[gpadmin@bj-gp-node1~]$gpaddmirrors-p1000
运行过程中需要输入两次mirror路径:/data1/gpdata/mirror


4.3.设置访问权限

打开/data1/gpdata/master/gpseg-1/pg_hba.conf按照最下面的格式添加客户端ip或网段

#userdefine
hostallall192.168.1.0/24trust
hostallall127.0.0.1/28trust


4.4.访问方式

可以通过gpAdmin桌面客户端来访问,也可以用命令行来访问,下面来说一下命令行访问的方式,loach是后面添加的用户

[gpadmin@bj-gp-node1~]$psql-dtj_csfb-hbj-gp-node1-p5432-Ugpadmin
[gpadmin@bj-gp-node1~]$psql-dtj_csfb-hbj-gp-node1-p5432-Uloach


4.5.创建用户

通过命令行登录以后,执行下面的命令

CREATEROLEloachWITHLOGIN;
ALTERROLEloachWITHPASSWORD'loach';
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: