greenplum安装

浏览: 2358

1.参考文档:http://gpdb.docs.pivotal.io/4390/common/welcome.html

2.环境信息

linux: centos6.3 64 位

greenplum-db-4.3.9.1-build-1-rhel5-x86_64.zip

3. root用户安装

4.linux环境设置

4.1防火墙设置

# vi /etc/selinux/configSELINUX=disabled

# chkconfig iptables off

# chkconfig --list iptables

4.2配置IP映射和主机名

# hostname gp1

# vi /etc/sysconfig/network

HOSTNAME=gp1

# vi /etc/hosts

192.168.91.132 gp1

192.168.91.133 gp2

192.168.91.134 gp3

4.3系统参数设置

# 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

m.overcommit_memory = 2


# scp /etc/sysctl.conf gp2:/etc/sysctl.conf 


# vi /etc/security/limits.d/90-nproc.conf

* soft nofile 65536

* hard nofile 65536

* soft nproc 131072

* hard nproc 131072

# scp /etc/security/limits.d/90-nproc.conf gp3:/etc/security/limits.d/90-nproc.conf

4.4修改IO调度策略

# vi /boot/grub/menu.lst

kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=87ddf71c-00e9-47ea-be4b-e99e1a8ff94a rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet elevator=deadline

该文件不能scp,而是使用手动添加

#vi /etc/rc.d/rc.local

#disk block

blockdev --setra 16384 /dev/sd*

4.5安装包准备

在gp1操作

# cd /usr/local/

# unzip greenplum-db-4.3.9.1-build-1-rhel5-x86_64.zip

# ./greenplum-db-4.3.9.1-build-1-rhel5-x86_64.bin

...

Do you accept the Pivotal Database license agreement? [yes|no]

yes

Provide the installation path for Greenplum Database or press ENTER to accept the default installation path: /usr/local/greenplum-db-4.3.9.1

Install Greenplum Database into /usr/local/greenplum-db-4.3.9.1? [yes|no]

yes

/usr/local/greenplum-db-4.3.9.1 does not exist.Create /usr/local/greenplum-db-4.3.9.1 ? [yes|no](Selecting no will exit the installer)

yes

#cd greenplum-db

# source greenplum_path.sh 

# vi all_host

gp1

gp2

gp3

4.6设置免密码和用户

# gpssh-exkeys -f /usr/local/greenplum-db/all_host

批量安装

# gpseginstall -f /usr/local/greenplum-db/all_host -u gpadmin -p gpadmin

检查批量安装情况

# gpssh -f /usr/local/greenplum-db/all_host -e ls -l $GPHOME //个节点目录一致就正常

4.7创建数据存储目录

在gp1上

# mkdir -p /data/master

# chown -R gpadmin.gpadmin /data

在其他主机创建

# gpssh -h gp2 -e 'mkdir -p /data/master'

# gpssh -h gp2 -e 'chown -R gpadmin.gpadmin /data'

创建数据存储

# gpssh -f /usr/local/greenplum-db/all_host -e 'mkdir -p /data/primary'

# gpssh -f /usr/local/greenplum-db/all_host -e 'mkdir -p /data/mirror'

# gpssh -f /usr/local/greenplum-db/all_host -e 'chown -R gpadmin.gpadmin /data/primary'

# gpssh -f /usr/local/greenplum-db/all_host -e 'chown -R gpadmin.gpadmin /data/mirror'

4.8时间同步

# vi /etc/ntp.confserver 192.168.91.132 //master的ip地址

fudge 192.168.91.132 stratum 10

# gpssh -f /usr/local/greenplum-db/all_host -e 'service ntpd restart'

4.9检查

# gpcheck -f /usr/local/greenplum-db/all_host -m gp1

# gpcheckperf -f /usr/local/greenplum-db/all_host -r N -d /tmp > subnet1.out

# gpcheckperf -f /usr/local/greenplum-db/all_host -r ds -D  -d /data1/primary -d /data2/primary  -d /data1/mirror -d /data2/mirror

5.0 gp初始化

# su gpadmin

$ mkdir /home/gpadmin/gpconfigs

$ cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config

$ vi gpinitsystem_config 

declare -a DATA_DIRECTORY=(/data/primary /data/primary /data/primary)

MASTER_HOSTNAME=gp1

可选配置

MIRROR_PORT_BASE=50000

REPLICATION_PORT_BASE=41000

MIRROR_REPLICATION_PORT_BASE=51000

declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror /data/mirror)

配置环境变量

$ vi .bashrc

$ vi .bash_profile

source /usr/local/greenplum-db/greenplum_path.shexport 

MASTER_DATA_DIRECTORY=/data/master

$ source .bashrc

$ source .bash_profile

$ gpinitsystem -c gpinitsystem_config -h all_host

...

Continue with Greenplum creation Yy/Nn>

y

...

[INFO]:-Greenplum Database instance successfully created

日志文件:/home/gpadmin/gpAdminLogs

6.0测试

[gpadmin@gp1 gpconfigs]$ createdb gpdb -E utf-8

[gpadmin@gp1 gpconfigs]$ psql -d gpdb

psql (8.2.15)Type "help" for help.

gpdb=# help

You are using psql, the command-line interface to PostgreSQL.

Type: \copyright for distribution terms

 \h for help with SQL commands 

 \? for help with psql commands

 \g or terminate with semicolon to execute query

 \q to quit

gpdb=# select version(); 

 version ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PostgreSQL 8.2.15 (Greenplum Database 4.3.9.1 build commit:095e92e4ecbbbb6764897ca98b1cb7705ad0c805) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Aug 24 2016 06:30:45

(1 row)

gpdb=# create table gpdb_tab_01(id int primary key,name varchar(24));

NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "gpdb_tab_01_pkey" for table "gpdb_tab_01"CREATE TABLE

gpdb=# insert into gpdb_tab_01 select 1,'lily';

INSERT 0 1

gpdb=# select * from gpdb_tab_01; id | name ----+------ 1 | lily

(1 row)

gpdb=# \q

至此,3节点的gp安装成功。


有道笔记分享:http://note.youdao.com/noteshare?id=277154abaa05d82ad242acdb7e46bda9

推荐 2
本文由 平常心 创作,采用 知识共享署名-相同方式共享 3.0 中国大陆许可协议 进行许可。
转载、引用前需联系作者,并署名作者且注明文章出处。
本站文章版权归原作者及原出处所有 。内容为作者个人观点, 并不代表本站赞同其观点和对其真实性负责。本站是一个个人学习交流的平台,并不用于任何商业目的,如果有任何问题,请及时联系我们,我们将根据著作权人的要求,立即更正或者删除有关内容。本站拥有对此声明的最终解释权。

0 个评论

要回复文章请先登录注册