(1)编辑/etc/sysctl.conf,以下是最小配置(把没有的输进去,不一样的修改之)
vi /etc/sysctl.conf
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
(2)
修改文件打开数等限制
编辑/etc/security/limits.conf,添加一下几行(注意*也需要添加)
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
(3)在正式安装之前关闭防火墙(包括从节点)
检测防火墙
# /sbin/chkconfig --list iptables
关闭状态:iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
使用以下命令关闭
/sbin/chkconfig iptables off
修改/etc/selinux/config文件
SELINUX=disabled
出现以下情形则关闭成功(每台机器都要关闭)
4.编辑
/boot/grub/grub.conf
新增elevator=deadline
[dong-read @localhost~]# more /boot/grub/grub.conf
...elevator=deadline
crashkernel=auto ...
1. 在主节点上安装greenplum
(1)下载greenplum (没有特定centOS版本的,选择第一条即可)
https://network.pivotal.io/products/pivotal-gpdb#/releases/4990
(2)新建greenplum用户 在root用户下:
useradd gpadmin
passwd yourpassword
3)将下载的gp解压并进行安装:
unzip greenplum-db-*.*.*.*-build-1-RHEL5-x86_64.zip
得到greenplum-db-*.*.*.*-build-1-RHEL5-x86_64.bin文件,将其拷贝到/usr/local文件夹下进行安装(因为官网默认在此目录安装,为了不至于后面配置参数之类的太麻烦,我们也在这个目录下安装)。
/bin/bash greenplum-db-*.*.*.*-build-1-RHEL5-x86_64.bin
执行以上命令进行安装,过程中可能要按照提示输入几次yes。
4)修改Greenplum所有者
# 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-*.*.*.*
5)配置环境变量:
其环境变量在/usr/local/greenplum-db/greenplum_path.sh文件中也有,可以参考
打开/etc/profile对环境变量修改:
vim /etc/profile 添加以下文件:
GPHOME=/usr/local/greenplum-db-4.3.6.2
PATH=$GPHOME/bin:$GPHOME/ext/Python/bin:$PATH
export GPHOME
export PATH
6)设置Master主机上的数据目录,指定数据存放位置,空间要足够。
# mkdir /gpmaster
# chown -R gpadmin /gpmaster
# chgrp -R gpadmin /gpmaster
切记,在设置这个文件夹后需要修改gpadmin的环境变量,否则初始化GP的时候会找不到master的存储文件夹 在gpadmin用户下:
vim ~/.bashrc 在末尾添加:
MASTER_DATA_DIRECTORY=/gpmaster
export MASTER_DATA_DIRECTORY
之后记得
source ~/.bashrc
2. 在各个区段服务器上安装GP 可以在每台机器上采用和主机master一样的安装方法,这样的话机器一多了就很麻烦,在此就不介绍这种方法了,参照主节点的安装即可;我们直接通过master主机对每台segment安装GP
(1)对每台主机修改主机名(这个步骤我是单独到每台机器上去修改的):
修改主机名要在两个地方做修改:
a. /etc/hosts文件下:
vim /etc/hosts 将第一行:
127.0.0.1 localhost localhost.localdomainlocalhost4 localhost4.localdomain4
改为:
127.0.0.1 localhost sdw1localhost4 localhost4.localdomain4
(这里的sdw1表示segment1节点,其他机器类似,这里主节点叫mdw)
b.
修改 /etc/sysconfig/network
vim /etc/sysconfig/network 然后修改成下图形式,退出后加上一行命令 hostname mdw
(mdw是主节点的主机名,从节点是sdw1和sdw2)
# FILE NAME: gpinitsystem_config
# Configuration file needed by the gpinitsystem
################################################
#### REQUIRED PARAMETERS
################################################
#### Name of this Greenplum system enclosed in quotes.
ARRAY_NAME="EMC Greenplum DW"
#### Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg
#### Base number by which primary segment port numbers
#### are calculated.
PORT_BASE=40000
#### File system location(s) where primary segment data directories
#### will be created. The number of locations in the list dictate
#### the number of primary segments that will get created per#### physical host (if multiple addresses for a host are listed in
#### the hostfile, the number of segments will be spread evenly across
#### the specified interface addresses).
declare -a DATA_DIRECTORY=(/home/gpadmin/primary)
#### OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=mdw
#### File system location where the master data directory
#### will be created.
MASTER_DIRECTORY=/gpmaster
#### Port number for the master instance.
MASTER_PORT=5432
#### Shell utility used to connect to remote hosts.
TRUSTED_SHELL=ssh
#### Maximum log file segments between automatic WAL checkpoints.
CHECK_POINT_SEGMENTS=8
#### Default server-side character set encoding.
ENCODING=UNICODE
################################################
#### OPTIONAL MIRROR PARAMETERS
################################################
#### Base number by which mirror segment port numbers
#### are calculated.
#MIRROR_PORT_BASE=50000
#### Base number by which primary file replication port
#### numbers are calculated.
#MIRROR_REPLICATION_PORT_BASE=51000
#### File system location(s) where mirror segment data directories
#### will be 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=(/home/gpadmin/mirror /home/gpadmin/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror)
declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/mirror)
################################################
#### Create a database of this name after initialization.
#DATABASE_NAME=name_of_database
DATABASE_NAME=gpexmp
#### 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
(4)初始化数据库:
gpinitsystem -c /home/gpadmin/gpconfigs/gpinitsystem_config
会出现很多info或者warn,如果有以下信息,说明初始化成功, 然后输入Y。
(5)刚刚我们编辑gpinitsystem_config文件时,修改了下面两句
#DATABASE_NAME=name_of_database
DATABASE_NAME=gpexmp
这里在初始化之后建立了一个叫example的数据库,我们可以进行测试:
在gpadmin下: 执行以下查询
Psql -d gpexmp
Gpexmp=# select current_timestamp;
好了,如果出现以上结果就说明你安装成功了,可以对数据库进行操作了!恭喜!!!
--dc20170506