Quantcast
Channel: CodeSection,代码区,数据库(综合) - CodeSec
Viewing all articles
Browse latest Browse all 6262

Greenplum安装在CentOS6.8

$
0
0

第一次接触分布式的数据库,对于各种配置都不是很熟悉,经过网上各种查资料,显示仔细阅读,了解原理,终于功夫不负有心人,经历一次失败后,让我配置成功了!因此做了总结以便以后查看,也用来和大家交流经验。

下面我就详细说一下安装步骤:

一、安装环境

系统:centos 6.8

服务器:四台,每台2个CPU,每个CPU是4核

二、安装要求

1、服务器的基本配置

192.168.0.101 master

192.168.0.102 seg1

192.168.0.103 seg2

192.168.0.104 seg3

四台服务器都做存储,每台上起四个primary,并且有四个mirror。

三、初始化服务器系统环境(四台都要操作)

1、设置系统参数和IP等参数

[root@master ~]# vi /etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat linux

#

# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and

# sysctl.conf(5) for more details.

#

# Use '/sbin/sysctl -a' to list all possible parameters.

# Controls IP packet forwarding

net.ipv4.ip_forward = 0

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 1

# Controls whether core dumps will append the PID to the core filename.

# Useful for debugging multi-threaded applications.

kernel.core_uses_pid = 1

# Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges

#net.bridge.bridge-nf-call-ip6tables = 0

#net.bridge.bridge-nf-call-iptables = 0

#net.bridge.bridge-nf-call-arptables = 0

# Controls the default maxmimum size of a mesage queue

kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes

kernel.msgmax = 65536

kernel.msgmni = 2048

kernel.sem = 250 512000 100 2048

# Controls the maximum shared segment size, in bytes

#kernel.shmmax = 68719476736

kernel.shmmax = 500000000

kernel.shmmni = 4096

# Controls the maximum number of shared memory segments, in pages

#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 = 1025 65535

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、修改hosts文件

[root@master ~]# vi /etc/hosts

添加如下:

192.168.0.101 master

192.168.0.102 seg1

192.168.0.103 seg2

192.168.0.104 seg3

3、修改/etc/sysconfig/network文件hostname


Greenplum安装在CentOS6.8

Greenplum安装在CentOS6.8

设置名字和上面配置名字要统一

4、关闭防火墙


Greenplum安装在CentOS6.8

Greenplum安装在CentOS6.8

5、设置selinux


Greenplum安装在CentOS6.8

Greenplum安装在CentOS6.8

6、添加用户

#useradd gpadmin

#passwd gpadmin

7、修改Linux最大限制:/etc/security/limits.conf


Greenplum安装在CentOS6.8

Greenplum安装在CentOS6.8

8、重启服务器

#reboot

四、在master上安装

1、在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

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

注意:加红的是master的数据目录,要与你下面创建的数据目录一致

2、准备服务器通信文件

mkdir -p /opt/gpinit/all_host


Greenplum安装在CentOS6.8

Greenplum安装在CentOS6.8

mkdir -p /opt/gpinit/all_segment


Greenplum安装在CentOS6.8

Greenplum安装在CentOS6.8

3、将下载安装包移动到指定文件夹

4、解压安装包


Greenplum安装在CentOS6.8

5、安装软件


Greenplum安装在CentOS6.8

五、节点安装软件(使用gpssh同步安装)

1、建立节点之间的通信


Greenplum安装在CentOS6.8

2、创建数据存储目录

需要几个节点就要创建多少个文件

像我安装的系统我创建了四个primary文件和四个mirror,因为是master所以还有一个master文件


Greenplum安装在CentOS6.8

3、批量安装

本步主要是将master上的安装后的文件拷贝到其他segment服务器上,看自己喜好,可以用gpssh也可以分别操作。

4、同步时钟


Greenplum安装在CentOS6.8

六、初始化Greenplum

1、创建初始化文件


Greenplum安装在CentOS6.8

2、执行文件

[gpadmin@master 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="BJ 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).

这属性目的:设置节点上实例对应的数据存储目录,与上面创建的目录要对应。只添加primary的。

declare -a DATA_DIRECTORY=(/data1/gpdata/primary /data1/gpdata/primary)

#### OS-configured hostname or IP address of the master host.

这个属性设置主机的名字

MASTER_HOSTNAME=master

#### File system location where the master data directory

#### will be created.

设置master的目录

MASTER_DIRECTORY=/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

下面的属性是用来设置mirror的配置

################################################

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

这个属性和上面一样的作用;设置mirror的目录,要与上面创建的一致

declare -a MIRROR_DATA_DIRECTORY=(/data1/gpdata/mirror /data1/gpdata/mirror)

################################################

#### OTHER OPTIONAL PARAMETERS

################################################

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

初始化的后创建的数据库的名字

DATABASE_NAME=gp_db_my

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

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

#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem

七、测试Greenplum

1、gpstart

不报错就说明安装成功了。

2、gpstate -c/-m

可以查看各个实例的状态。


Viewing all articles
Browse latest Browse all 6262

Trending Articles