centos7系统greenplum5.7集群详细安装配置文档-亲试通过

版权声明:更多精彩请关注:https://zhangdd.com https://blog.csdn.net/kingzdd/article/details/89228370

1.准备

这里准备了4台服务器,1台做master,1台做standby,3台都做存储。

ip host 配置 安装
10.0.0.2 mdw 2核64G 3*600G raid5 master
10.0.0.3 sdw1 2核128G 10*2TB raid10 segment
10.0.0.4 sdw2 2核128G 10*2TB raid10 segment
10.0.0.5 sdw3 2核128G 10*2TB raid10 segment+standbymaster

OS:Red Hat Centos  Linux Server release 7.3

GP:greenplum-db-5.7-build-1-RHEL5-x86_64.zip

JDK:1.7+

10.0.0.2  mdw

10.0.0.3  sdw1

10.0.0.4  sdw2

10.0.0.5  sdw3

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

2、系统参数配置

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

2.1.修改Linux内核参数

[root@mdw ~]$ vi /etc/sysctl.conf

kernel.shmmax = 500000000

kernel.shmmni = 4096

kernel.shmall = 4000000000

kernel.sem = 500 1024000 200 4096

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.2.修改Linux最大限制

[root@mdw ~]$ vi /etc/security/limits.conf

$greenplum configs

* soft nofile 65536

* hard nofile 65536

* soft nproc 131072

* hard nproc 131072

2.3.I/O调整优化

[root@mdw ~]$ vi /boot/grub/menu.lst

$greenplum configs

elevator=deadline

2.4.添加所有节点到HOST

[root@mdw ~]$ vi /etc/hosts

10.0.0.2  mdw

10.0.0.3  sdw1

10.0.0.4  sdw2

10.0.0.5  sdw3

2.5.关闭防火墙

[root@mdw ~]$ chkconfig –list iptables

[root@mdw ~]$ chkconfig –level 0123456 iptables off

2.6.设置SELINUX

[root@mdw ~]$ vi /etc/selinux/config

SELINUX=disabled

2.7.重启系统使配置生效

[root@mdw ~]$ reboot

3、GP安装

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

3.1.创建gpadmin用户

[root@mdw ~]$ groupadd -g 530 gpadmin

[root@mdw ~]$ useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin

[root@mdw ~]$ passwd gpadmin

3.2.设置gpadmin用户环境

[gpadmin@mdw ~]$ cd /home/gpadmin

[gpadmin@mdw ~]$ vi .bashrc

[gpadmin@mdw ~]$ vi .bash_profile

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

source/home/gpadmin/greenplum/greenplum_path.sh

export MASTER_DATA_DIRECTORY=/data/gpdata/master/gpseg-1

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

3.3.上传并解压安装包

将greenplum-db-5.7-build-1-RHEL5-x86_64.zip上传至master的/home/gpadmin目录下

[root@mdw opt]$ /bin/bash greenplum-db-5.7-build-1-RHEL5-x86_64.bin

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

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

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

cd  /home/gpadmin/greenplum

[root@mdw gpinit]$ touch hostlist

[root@mdw gpinit]$ touch seg_hosts

hostlist和seg_hosts内容:

hostlist:

mdw

sdw1

sdw2

sdw3

seg_hosts

sdw1

sdw2

sdw3

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

[root@mdw local]$ gpssh-exkeys –f  /home/gpadmin/greenplum/hostlist

按照提示输入gpadmin密码,记住这一步不能输入gpadmin的密码,

3.6.批量安装

[root@mdw local]$ gpseginstall -f /home/gpadmin/greenplum/hostlist -u gpadmin -p gpadmin

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

3.7.检查批量安装情况

[root@mdw local]$ gpssh -f /home/gpadmin/greenplum/hostlist -e ls -l $GPHOME

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

3.8.创建存储目录

master

[root@mdw local]$ mkdir -p /data/gpdata/master

[root@mdw local]$ chown gpadmin:gpadmin /data/gpdata/master

segment

[root@mdw local]$ gpssh -f /home/gpadmin/greenplum/hostlist -e ‘mkdir -p /data/gpdata/gpdatap1’

gpssh -f /home/gpadmin/greenplum/hostlist -e ‘mkdir -p /data/gpdata/gpdatap2’

mirror

[root@mdw local]$ gpssh -f /home/gpadmin/greenplum/seg_hosts -e ‘mkdir -p /data/gpdata/gpdatam1’

gpssh -f /home/gpadmin/greenplum/seg_hosts -e ‘mkdir -p /data/gpdata/gpdatam2’

3.9.设置时钟同步

vi /etc/ntp.conf 在server第一行添加下面两行

server 10.0.0.2

重启ntpd服务 /etc/init.d/ntpd restart

查看ntp同步情况 ntpq -p

使ntpd服务重启服务器后也启动 chkconfig –level 0123456 ntpd on

3.10.创建GP初始化文件

[gpadmin@mdw~]$ cp/home/gpadmin/greenplum/docs/cli_help/gpconfigs/gpinitsystem_config  /home/gpadmin/greenplum/gpinitsystem_config

[gpadmin@tj-soc-c04-csfb1 gpconfigs]$ chmod 775 gpinitsystem_config

3.10修改GP初始化文件

[gpadmin@mdw gpconfigs]$ vi gpinitsystem_config

$ FILE NAME: gpinitsystem_config

$ Configuration file needed by the gpinitsystem

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$$$$ REQUIRED PARAMETERS

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$$$$ Name of this Greenplum system enclosed in quotes.

ARRAY_NAME=” Greenplum ”

$$$$ 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=(/data/gpdata/gpdatap1  /data/gpdata/ gpdatap2)

$$$$ 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=/data/gpdata/master

$$$$ 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.

REPLICATION_PORT_BASE=41000

$$$$ Base number by which mirror 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=(/data/gpdata/gpdatam1 /data/gpdata/gpdatam2)

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$$$$ OTHER OPTIONAL PARAMETERS

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

$$$$ Create a database of this name after initialization.

DATABASE_NAME=sparkdb

$$$$ Specify the location of the host address file here instead of

$$$$ with the the -h option of gpinitsystem.

$MACHINE_LIST_FILE=/home/gpadmin/greenplum/hostfile

3.11.初始化GP

[gpadmin@mdw ~]$ gpinitsystem -c /home/gpadmin/greepplum/gpinitsystem_config -h /home/gpadmin/greenplum/ seg_hosts

中间需要输入一次:Y

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

4、附加项

4.1增加standby

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

在standby服务器上执行

[root@sdw3~]$ mkdir /data/gpdata/master

[root@sdw3 ~]$ chown gpadmin:gpadmin /data/gpdata/master

在master服务器上执行

[gpadmin@mdw ~]$ gpinitstandby -s sdw1

中间输入一次Y

4.2.增加mirror

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

[gpadmin@mdw ~]$ gpaddmirrors -p 1000

运行过程中需要输入两次mirror路径:/data/gpdata/gpdatam1

4.3.设置访问权限

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

$user define

host    all     all     192.168.1.0/24   trust

host    all     all     127.0.0.1/28    trust

4.4.访问方式

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

[gpadmin@mdw ~]$ psql -d sparkdb -h mdw -p 5432 -U gpadmin

[gpadmin@mdw ~]$ psql -d sparkdb -h mdw -p 5432 -U loach

4.5.创建用户

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

CREATE ROLE loach WITH LOGIN;

ALTER ROLE loach WITH PASSWORD ‘loach’;

本文出自张佃栋de博客,转载时请注明出处及相应链接。

本文永久链接: https://zhangdd.com/864.html

 

猜你喜欢

转载自blog.csdn.net/kingzdd/article/details/89228370