greenplum安装教程
1. 系统参数配置(在所有节点服务器上执行)
1.1修改Linux内核参数
[root@master ~]# vim /etc/sysctl.conf
kernel.shmmax= 500000000
kernel.shmmni= 4096
kernel.shmall= 4000000000
kernel.sem= 250 64000 100 512
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
1.2 修改Linux大限制(在limits.conf后添加如下几行)
[root@master ~]# vim /etc/security/limits.conf
#greenplumconfigs
* softnofile 65536
* hardnofile 65536
* softnproc 131072
*hard nproc 131072
1.3 I/O调整优化(在menu.lst后添加)
[root@master~]# vim /boot/grub/menu.lst
#greenplumconfigs
elevator=deadline
1.4 添加所有节点到host
[root@master ~]# vim /etc/hosts
10.139.*.* master
10.139.*.* seg1
10.139.*.* seg2
10.139.*.* seg3
注:修改主机名的方法如下:
1). 修改/etc/sysconfig下的network文件
[root@master~]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=master
2)重启(reboot)生效
在所有的服务器上安装ed包(本人选择包名如下)
执行如下命令:rpm –ivh ed-1.1-3.3.el6.x86_64.rpm
1.5 关闭防火墙
1.5.1 查看防火墙状态:[root@master ~]# service iptables status
结果为:iptables:未运行防火墙。(表示防火墙已经关闭)
1.5.2 关闭防火墙:[root@master ~]# chkconfig iptables off (重启后生效)
即时生效:[root@master ~]# service iptables stop-
1.6 设置selinux
[root@master ~]# vim/etc/selinux/config
SELINUX=disabled
2. master主机上安装gp(使用root用户)
2.1. 创建gpadmin用户(在全部服务器节点上创建)
[root@master~]# useradd gpadmin
[root@master~]# passwd gpadmin
2.2 使用root用户安装gp(只在master上运行)
[root@master ~]# unzip/tmp/gp/greenplum-db-4.3.9.0-build-1-RHEL5-x86_64.zip
[root@master ~]#/bin/bashgreenplum-db-4.2.2.4-build-1-CE-RHEL5-i386.bin
2.3 创建all_host和all_segment文件
1) 创建文件夹:[root@master~]# mkdir -p /opt/gpinit/
2) 创建all_host和all_segment文件,分别添加如下内容:
all_host
all_segment
master
seg1
seg2
seg3
seg1
seg2
seg3
3) 改变all_host和all_segment所属主和所属组
[root@master gpinit]# chown -Rgpadmin:gpadmin /opt/
2.4 使用gpadmin用户交换秘钥(也可以使用root用户,交换root用户秘钥):
1).导入gp工具环境变量:[root@master~]# source /home/gpadmin/.bashrc
2). 交换秘钥:[gpadmin@mastergpinit]$ gpssh-exkeys -f /opt/gpinit/all_hosts(需要创建目录时,需要手动创建)
3).批量安装(gpadmin用户):
3.1). 压缩安装的gp:(位于/usr/local/目录下)
[root@master local] tar -cfgreenplum-db-4.3.9.0.tar greenplum-db-4.3.9.0
[root@master local] chowngpadmin:gpadmin greenplum-db-4.3.9.0.tar
可能需要的步骤:[root@master local] gzip greenplum-db-4.3.9.0.tar
[root@master local] tar -cfgreenplum-db-4.3.9.0.tar greenplum-db-4.3.9.0
[root@master local] tar -cfgreenplum-db-4.3.9.0.tar greenplum-db-4.3.9.0
[gpadmin@bj-gp-node1 local]# gpseginstall-f /opt/gpinit/all_segment -u gpadmin -p 123456
4).检查是否批量安装成功:[gpadmin@mastergpinit]$ gpssh -f all_host -e ls -l $GPHOME
返回结果中各节点目录一致则成功
2.5 检查系统配置
执行以下命令:gpcheckos -f /opt/gpinit/all_hosts
根据错误信息修改/etc/sysctl.conf(以root身份来改)
错误信息中没有的,直接添加即可(添加时删除前面的sysctl)
3. 创建存储目录
1) master节点
[root@master ~]# mkdir -p /gp/data1/gpdata/primary
[root@master ~]# chown -R gpadmin:gpadmin /gp/
2) segment节点(需要先手动在各节点创建/gp/目录)
[gpadmin@master ~]#gpssh -f /opt/gpinit/all_segment -e 'mkdir -p /gp/data1/gpdata/primary/'
3) mirror目录
[gpadmin@master ~]#gpssh -f /opt/gpinit/all_segment -e 'mkdir -p /data1/gpdata/mirror'
4. 设置时钟同步
vim /etc/ntp.conf 在server行添加下面几行行(在所有的服务器节点上添加)
master节点:server127.127.1.0
sgement节点:server wggh_1prefer
重启ntpd服务/etc/init.d/ntpd restart
查看ntp同步情况 ntpq -p
使ntpd服务重启服务器后也启动chkconfig --level 0123456 ntpd on
5. 创建GP初始化文件
[gpadmin@master ~]$ mkdir /home/gpadmin/gpconfigs
[gpadmin@master ~]$cp /usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config
[gpadmin@tj-soc-c04-csfb1gpconfigs]$ chmod 775 gpinitsystem_config
6. 修改gp初始化文件
[gpadmin@mastergpconfigs]$ vi gpinitsystem_config
# FILENAME: gpinitsystem_config
#Configuration file needed by the gpinitsystem
################################################
####REQUIRED PARAMETERS
################################################
#### Nameof this Greenplum system enclosed in quotes.
ARRAY_NAME="BJGreenplum DW"
####Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg
#### Basenumber by which primary segment port numbers
#### arecalculated.
PORT_BASE=40000
#### Filesystem location(s) where primary segment data directories
#### willbe created. The number of locations in the list dictate
#### thenumber of primary segments that will get created per
####physical host (if multiple addresses for a host are listed in
#### thehostfile, the number of segments will be spread evenly across
#### thespecified interface addresses).
declare-a DATA_DIRECTORY=(/data1/gpdata/primary /data1/gpdata/primary)
####OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=bj-gp-node1
#### Filesystem location where the master data directory
#### willbe created.
MASTER_DIRECTORY=/data1/gpdata/master
#### Portnumber for the master instance.
MASTER_PORT=5432
####Shell utility used
connect to remote hosts.
TRUSTED_SHELL=ssh
####Maximum log file segments between automatic WAL checkpoints.
CHECK_POINT_SEGMENTS=8
#### Defaultserver-side character set encoding.
ENCODING=UNICODE
################################################
####OPTIONAL MIRROR PARAMETERS
################################################
#### Basenumber by which mirror segment port numbers
#### are calculated.
MIRROR_PORT_BASE=50000
#### Basenumber by which primary file replication port
####numbers are calculated.
REPLICATION_PORT_BASE=41000
#### Basenumber by which mirror file replication port
####numbers are calculated.
MIRROR_REPLICATION_PORT_BASE=51000
#### Filesystem location(s) where mirror segment data directories
#### willbe created. The number of mirror locations must equal the
####number of primary locations as specified in the
####DATA_DIRECTORY parameter.
####declare -a MIRROR_DATA_DIRECTORY=(/gp/data1/gpdata/mirror /gp/data1/gpdata/mirror)
################################################
####OTHER OPTIONAL PARAMETERS
################################################
####Create a database of this name after initialization.
DATABASE_NAME=bj_gp
####Specify the location of the host address file here instead of
#### withthe the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem
7 初始化gp
[gpadmin@master~]$ gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config -h/opt/gpinit/all_host
中间需要输入一次:Y
注:数据目录有错误时,需要修改。如果没有报ERROR,GP数据库就安装好了
8 增加standby
一个gp集群只有一个master肯定会让人不放心,还好有备用,当master宕掉后,会自动启用standby作为master,下面来看一下standby怎么添加.
在standby服务器上执行
[root@seg1 ~]#mkdir /data1/gpdata/master
[root@seg1 ~]#chown gpadmin:gpadmin /data1/gpdata/master
在master服务器上执行
[gpadmin@master~]$ gpinitstandby -s seg2
中间输入一次Y
本文来源:https://blog.csdn.net/u013088052/article/details/52930827
相关文章