美文网首页
2020-02-16 Greenplum安装(亲测)

2020-02-16 Greenplum安装(亲测)

作者: 鹏_70bd | 来源:发表于2020-02-16 21:04 被阅读0次

官网下载地址:https://network.pivotal.io/products/pivotal-gpdb#/releases/1502/file_groups/378

一、准备环境

1、配置hosts

    a、vi /etc/hosts

  10.10.134.11 dw-greenplum-1 mdw

  10.10.134.12 dw-greenplum-2 sdw1

  10.10.134.13 dw-greenplum-3 sdw2

b、scp到其他机器上

scp /etc/hosts root@10.10.134* :/etc/hosts

2、配置hostname

      a、vi /etc/hostname  各个机器 用自己名称

    mdw

b、vi /etc/sysconfig/network 各个机器 用自己名称

    mdw

c、reboot 重启

如果以上还不起作用

正常显示: 

3、要安装的工具

yum install -y ed s是为了解决这个问题(http://www.freeoa.net/osuport/db/greenplum-db-study-install_3097.html)

    yum -y install wget

    yum install -y unzip zip

      yum install -y unzip zip

      yum -y install lsof

    yum install -y net-tools which openssh-clients openssh-server less  zip unzip iproute

4、关闭防火墙

查看防火墙状态

firewall-cmd --state

停止firewall

systemctl stop firewalld.service

禁止firewall开机启动

systemctl disable firewalld.service

5、网络相互通

        ping IP

        ping hostname

        ssh  hostname 能登录到其他机器上

二、Greenplum初始化前期配置

    1、系统设置(所有机器)

a、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

    #sysctl -p

    b、limits.conf的设置

    # vi /etc/security/limits.conf

* soft nofile 65536

* hard nofile 65536

* soft nproc 131072

* hard nproc 131072

    分别copy其他机器上

    # scp  /etc/sysctl.conf root@swd1 : etc/sysctl.conf

    # scp  /etc/security/limits.conf root@swd1 : /etc/security/limits.conf

    其他优化配置在测试环境先不配置  不影响启动

    2、安装

  a、创建gpadmin组合用户

# groupdel gpadmin

# userdel gpadmin

# groupadd -g 530 gpadmin

# useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin

# passwd gpadmin

  b、解压介质

# unzip greenplum-db-4.3.7.2-build-2-RHEL5-x86_64.zip

# chown gpadmin:gpadmin greenplum-db-4.3.7.2-build-2-RHEL5-x86_64.bin

  c、创建安装目录

# mkdir -p /opt/greenplum

# chown -R gpadmin:gpadmin /opt/greenplum

    d、Install  [root@gpnode1 greenplum]

$ ./greenplum-db-4.3.7.2-build-2-RHEL5-x86_64.bin

确认license,输入yes

输入安装目录:/opt/greenplum

确认安装路径,yes

    3、安装和配置greenplum到所有主机(操作master)

    a、执行相应环境变量

    # . /opt/greenplum/greenplum_path.sh

  b、创建hostlist文件(所有机器的hostname)

     # cat /tmp/hostlist

        mdw

       sdw1

       sdw2

  c、创建只包含segment节点的hostname

    # cat /tmp/seg_hosts

      sdw1

      sdw2

  d、安装segment节点

    $ gpseginstall -f /tmp/seg_hosts -u gpadmin -p gpadmin

    报错后应注意的一点:要在gpadmin用户下进行,执行source greenplum_path.sh,成功后  会提示连接另一端数据库

  e、Check install

$ gpssh -f /tmp/hostlist -e ls -l $GPHOME 

    f、创建master 数据目录

     # mkdir /data/master

     # chown gpadmin /data/master

如有master-standby,则用如下命令创建相应目录:

# . /opt/greenplum/greenplum_path.sh

# gpssh -h standby-host -e 'mkdir /data/master'

# gpssh -h standby-host -e 'chown gpadmin /data/master'

    g、创建segment节点数据目录

# . /opt/greenplum/greenplum_path.sh

# gpssh -f /tmp/seg_hosts -e 'mkdir -p /data/primary'

# gpssh -f /tmp/seg_hosts -e 'mkdir -p /data/mirror'

# gpssh -f /tmp/seg_hosts -e 'chown gpadmin /data/primary'

# gpssh -f /tmp/seg_hosts -e 'chown gpadmin /data/mirror'

      h、配置ntp(测试环境可以不执行)

修改master的配置文件(/etc/ntp.conf )

server 127.0.0.1

修改segment的配置文件(/etc/ntp.conf )

server test1

Server standby-host

修改standby的配置文件(/etc/ntp.conf )

server ntp-server

Server test1

在master上执行如下命令同步时间:

# gpssh -f /tmp/seg_hosts -v -e 'ntpd' 

        4、check操作

$ gpcheck -f /tmp/hostlist

$ source /opt/greenplum-db/greenplum_path.sh

$ gpssh -f /tmp/hostlist #统一处理所有节点

$ gpssh-exkeys -f hostlist(比较关键)

5、配置./bash_profile

source /opt/greenplum-db/greenplum_path.sh

export MASTER_DATA_DIRECTORY=/data/master/gpseg-1

export GPPORT=5432

export PGDATABASE=test_DB

依次scp到更改节点

$ source .bash_profile

三、Greenplum初始化

1.创建gp的配置文件

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

$ cat  gpinitsystem_config |grep -v "^#" |grep -v "^$"

ARRAY_NAME="EMC Greenplum DW"

SEG_PREFIX=gpseg

PORT_BASE=40000

declare -a DATA_DIRECTORY=(/data/primary)

MASTER_HOSTNAME=test1

MASTER_DIRECTORY=/data/master

MASTER_PORT=5432

TRUSTED_SHELL=ssh

CHECK_POINT_SEGMENTS=8

ENCODING=UNICODE

MIRROR_PORT_BASE=50000

REPLICATION_PORT_BASE=41000

MIRROR_REPLICATION_PORT_BASE=51000

declare -a MIRROR_DATA_DIRECTORY=(/data/mirror)

2 .Run Initialization

$ gpinitsystem -c gpinitsystem_config -h /tmp/seg_hosts

出现以下日志说明初始化成功了

参考的文档:https://blog.csdn.net/king13127/article/details/83989704

                    http://gitop.cc/posts/install-greenplum-in-docker/

                    https://blog.csdn.net/xudailong_blog/article/details/79874923

官方下载地址:https://network.pivotal.io/products/pivotal-gpdb

四、数据库操作

$ psql -d postgres(其中的一个初始库)

$ psql -d postgres  #进入某个数据库

postgres=# \l # 查询数据库  List of databases

  Name    |  Owner  | Encoding |  Access privileges 

-----------+---------+----------+---------------------

gp_sydb  | gpadmin | UTF8    |

postgres  | gpadmin | UTF8    |

template0 | gpadmin | UTF8    | =c/gpadmin    : gpadmin=CTc/gpadmin

template1 | gpadmin | UTF8    | =c/gpadmin    : gpadmin=CTc/gpadmin

(4 rows)

postgres=# \i test.sql #执行sql

postgres=# copy 表名 to '/tmp/1.csv' with 'csv';      #快速导出单表数据

postgres=# copy 表名 from '/tmp/1.csv' with 'csv';    #快速导入单表数据

postgres=# \q          #退出数据库

五、集群状态

gpstate -e #查看mirror的状态

gpstate -f #查看standby master的状态

gpstate -s #查看整个GP群集的状态

gpstate -i #查看GP的版本

gpstate --help #帮助文档,可以查看gpstate更多用法

六、过程中遇到的问题

    1、在source .bash_profile的过程中导致 yum 不能用报:  Fatal Python error: pycurl: libcurl link-time version is older than compile-time version

Aborted

          原因:把 root 用户下 python环境变量unset掉了,总是在执行python2.6 其实应该执行python2.7

            解决:$  su root

                      # whereis python

                      # cd ~

                      # vi .bash_profile

                        #  source .bash_profile

相关文章

  • 2020-02-16 Greenplum安装(亲测)

    官网下载地址:https://network.pivotal.io/products/pivotal-gpdb#/...

  • CentOS7.3安装Greenplum4.3

    本文非自创,在前人的基础上进行了修改,以下步骤为本人亲测。改编自:Greenplum 4.3 For Centos...

  • 1.GREENPLUM的安装和部署

    GREENPLUM的安装和部署 在虚拟机上安装greenplum:1.操作系统redhat 2.6.18-53.e...

  • GreenPlum的那些事《二》——GreenPlun启动报错

    标签(空格分隔): GreenPlum 在配置好GreenPlum过程中,需要注意一下几点: 找好安装包 安装依赖...

  • mysql安装【亲测】

    本文主要为了记录mysql的安装过程,以供后续参考。 使用环境 1、VMware Workstation ...

  • MAC上如何安装MySql

    文章预读 Mac上安装MySQL 亲测OK!!! 以上!!!

  • Greenplum安装

    环境准备 本文只搭建一个虚拟机,适合初学者练习,同时本文也列出了现实中集群部署的操作与建议。 VMWare虚拟机分...

  • Greenplum安装

    一、环境准备 二、集群安装 三、集群初始化 四、简单测试

  • Greenplum安装

    1 安装说明 1.1 集群介绍 使用CentOS 8安装1个Master,3个Segment,每台机器命名及IP地...

  • 安装pyhive报错

    安装pyhive还需要安装其他依赖包 安装sasl遇到的问题 解决办法,亲测有效 安装结果

网友评论

      本文标题:2020-02-16 Greenplum安装(亲测)

      本文链接:https://www.haomeiwen.com/subject/nrimfhtx.html