安装greenplum扩展

安装hstore

greenplum5.x当前还不支持create extension 的方式创建hstore扩展,但是可以以执行sql文件的形式创建hstore相关的函数,能达到相同的效果

这些函数创建方式存放在:$GPHOME/share/postgresql/contrib/hstore.sql
执行SQL文件即可:
$ psql -d data_sas -f $GPHOME/share/postgresql/contrib/hstore.sql

安装Madlib

参考文档:https://gpdb.docs.pivotal.io/550/ref_guide/extensions/madlib.html
1、下载扩展包并解压

下载扩展包到集群的master服务器(standby 不需要,由于也无法安装),扩展包的版本需要与greenplum版本保持一致,下载地址:
https://network.pivotal.io/products/pivotal-gpdb

[root@l-test5 /export]$ ll
-rw-r--r--  1 root     root         3003497 Feb 27 18:28 madlib-1.13-gp5-rhel6-x86_64.tar.gz

[root@l-test5 /export]# tar -zxvf madlib-1.13-gp5-rhel6-x86_64.tar.gz 
madlib-1.13-gp5-rhel6-x86_64/
madlib-1.13-gp5-rhel6-x86_64/._madlib-1.13-gp5-rhel6-x86_64.gppkg
madlib-1.13-gp5-rhel6-x86_64/madlib-1.13-gp5-rhel6-x86_64.gppkg
madlib-1.13-gp5-rhel6-x86_64/._open_source_license_MADlib_1.13_GA.txt
madlib-1.13-gp5-rhel6-x86_64/open_source_license_MADlib_1.13_GA.txt
madlib-1.13-gp5-rhel6-x86_64/ReleaseNotes.txt

# chown -R gpadmin: madlib*
$ ll
drwxr-xr-x  2 gpadmin     gpadmin            4096 Jan  6 03:23 madlib-1.13-gp5-rhel6-x86_64
-rw-r--r--  1 gpadmin     gpadmin         3003497 Feb 27 18:28 madlib-1.13-gp5-rhel6-x86_64.tar.gz

2、安装madlib扩展

[gpadmin@l-test5 /export/madlib-1.13-gp5-rhel6-x86_64]$ gppkg -i madlib-1.13-gp5-rhel6-x86_64.gppkg 
.
.
20180228:14:22:22:021216 gppkg:l-test5:gpadmin-[ERROR]:-
Traceback (most recent call last):
  File "/opt/greenplum-db/lib/python/gppylib/commands/base.py", line 243, in run
    self.cmd.run()
  File "/opt/greenplum-db/lib/python/gppylib/operations/__init__.py", line 53, in run
    self.ret = self.execute()
  File "/opt/greenplum-db/lib/python/gppylib/operations/utils.py", line 52, in execute
    raise ret
IOError
.
.
.
20180228:14:22:22:021216 gppkg:l-test5:gpadmin-[CRITICAL]:-gppkg failed. (Reason='') exiting...

发现安装报错,并且Reason='',没有提示报错信息,经排查,是由于segment服务器中的/opt/greenplum-db 权限不足导致,执行chown -R gpadmin: /opt/greenplum-db* 即可

[gpadmin@l-test5 /export/madlib-1.13-gp5-rhel6-x86_64]$ gppkg -i madlib-1.13-gp5-rhel6-x86_64.gppkg 
.
.
.
usage:  madpack install [-s schema_name] -p greenplum -c user@host:port/database
Example:
       $ $GPHOME/madlib/bin/madpack install -s madlib -p greenplum -c gpadmin@mdw:5432/testdb
       This will install MADlib objects into a Greenplum database named "testdb"
       running on server "mdw" on port 5432. Installer will try to login as "gpadmin"
       and will prompt for password. The target schema will be "madlib".
       To upgrade to a new version of MADlib from version v1.0 or later, use option "upgrade",
       instead of "install" 
For additional options run:
$ madpack --help
Release notes and additional documentation can be found at http://madlib.apache.org
20180228:14:59:33:030019 gppkg:l-test5:gpadmin-[INFO]:-madlib-1.13-gp5-rhel6-x86_64.gppkg successfully installed.

3、增加madlib 函数到指定的数据库

----解析参数:-s 指定数据库中的schema  
             -p 指定要安装的平台,这里是统一的 greenplum
             -c 指定连接数据库的方式,需要账户名、host、port、dbname

[gpadmin@l-pgdata5.vc.cn6 /export/madlib-1.13-gp5-rhel6-x86_64]$ /opt/greenplum-db/madlib/bin/madpack install -s public -p greenplum -c gpadmin@l-pgdata5.vc.cn6:65432/data_sas
madpack.py: INFO : Detected Greenplum DB version 5.5.0.
madpack.py: INFO : *** Installing MADlib ***
madpack.py: INFO : MADlib tools version    = 1.13 (/opt/greenplum-db-5.5.0/madlib/Versions/1.13/bin/../madpack/madpack.py)
madpack.py: INFO : MADlib database version = None (host=l-pgdata5.vc.cn6:65432, db=data_sas, schema=public)
madpack.py: INFO : Testing PL/Python environment...
madpack.py: INFO : > Creating language PL/Python...
madpack.py: INFO : > PL/Python environment OK (version: 2.7.12)
madpack.py: INFO : Installing MADlib into PUBLIC schema...
madpack.py: INFO : > Creating PUBLIC.MigrationHistory table
madpack.py: INFO : > Writing version info in MigrationHistory table
madpack.py: INFO : > Creating objects for modules:
madpack.py: INFO : > - array_ops
madpack.py: INFO : > - bayes
madpack.py: INFO : > - crf
madpack.py: INFO : > - elastic_net
madpack.py: INFO : > - linalg
madpack.py: INFO : > - pmml
madpack.py: INFO : > - prob
madpack.py: INFO : > - sketch
madpack.py: INFO : > - svec
madpack.py: INFO : > - svm
madpack.py: INFO : > - tsa
madpack.py: INFO : > - stemmer
madpack.py: INFO : > - conjugate_gradient
madpack.py: INFO : > - knn
madpack.py: INFO : > - lda
madpack.py: INFO : > - stats
madpack.py: INFO : > - svec_util
madpack.py: INFO : > - utilities
madpack.py: INFO : > - assoc_rules
madpack.py: INFO : > - convex
madpack.py: INFO : > - glm
madpack.py: INFO : > - graph
madpack.py: INFO : > - linear_systems
madpack.py: INFO : > - recursive_partitioning
madpack.py: INFO : > - regress
madpack.py: INFO : > - sample
madpack.py: INFO : > - summary
madpack.py: INFO : > - kmeans
madpack.py: INFO : > - pca
madpack.py: INFO : > - validation
madpack.py: INFO : MADlib 1.13 installed successfully in PUBLIC schema.

安装成
上一篇:Greenplum 在Linux环境安装


下一篇:《C Primer Plus(第6版)中文版》一1.5 高级计算机语言和编译器