1. Dblink Module Installation
Log in to the master node and switch to the GP user
[[Email protected] ~] #su-gpadmin
Download the source package and unzip it into the Dblink directory
[Email protected] ~]$ wget https://ftp.postgresql.org/pub/source/v8.2.23/postgresql-8.2.23.tar.gz[[email protected ] ~]$ tar xvf postgresql-8.2.23.tar.gz [[email protected] ~]$ CD postgresql-8.2.23/contrib/dblink/
Modify the makefile file to remove warning messages from compilation
[Email protected] dblink]$ vi Makefile pg_cppflags =-i$ (libpq_srcdir)-W
Compiling the Dblink module
[[email protected] dblink]$ make Use_pgxs=1 Install
View node information in the hosts
[Email protected] dblink]$ cat/etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 :: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6172.16.104.21 mdw172.16.104.22 smdw172.16. 104.23 sdw1172.16.104.24 sdw2172.16.104.25 SDW3
Copy the module to each node
[Email protected] dblink]$ gpscp-h smdw-h sdw1-h sdw2-h sdw3 dblink.so =:/usr/local/greenplum-db/lib/postgresql/dbl Ink.so
Initializing the Dblink module
[Email protected] dblink]$ psql-f dblink.sql gpdatabasecreate functioncreate functioncreate functioncreate Functionrevokerevokecreate functioncreate functioncreate functioncreate functioncreate FUNCTIONCREATE FUNCTIONCREATE Functioncreate functioncreate functioncreate functioncreate functioncreate functioncreate FUNCTIONCREATE Functioncreate functioncreate functioncreate functioncreate functioncreate functioncreate FUNCTIONCREATE Functioncreate functioncreate typecreate functioncreate functioncreate functioncreate FUNCTIONCREATE FUNCTIONCREATE Functioncreate functioncreate functioncreate functioncreate functioncreate functioncreate FUNCTION
Test
[[email protected] dblink]$ psql-d gpdatabasepsql (8.2.15) Type "Help" for help.gpdatabase=# select Dblink_connect (' Mycon n ', ' dbname=gpdatabase '); Dblink_connect----------------OK (1 row)
OK, the installation is successful.
2, install the Tablefunc module, the steps are basically as above,
Switch to the Tablefunc directory, compile
[[Email protected] ~]$ CD Postgresql-8.2.23/contrib/tablefunc/[[email protected] tablefunc]$ make Use_pgxs=1 Install
Upload the module to each node
[Email protected] dblink]$ gpscp-h smdw-h sdw1-h sdw2-h sdw3 tablefunc.so =:/usr/local/greenplum-db/lib/postgresql/ Tablefunc.so
Initializing the module
[Email protected] tablefunc]$ psql-f tablefunc.sql gpdatabasesetcreate functioncreate functioncreate TYPECREATE Typecreate typecreate functioncreate functioncreate functioncreate functioncreate FUNCTIONCREATE FUNCTIONCREATE Functioncreate functioncreate FUNCTION
Test
[[email protected] ~]$ psql-d gpdatabasepsql (8.2.15) Type ' Help ' for help.gpdatabase=# select * from Normal_rand (10, 5, 3 ); Normal_rand------------------6.49804853868727 5.94780258015849 3.76292085922418 2.26097995785225 1.06472447639215 1.83973228257959 3.4955971041885 3.95784964260771 7.32294513598636 9.51874065685311 (rows)
OK, the installation is successful.
This article is from the "Operations Notes" blog, make sure to keep this source http://quliren.blog.51cto.com/9849266/1945494
Greenplum Dblink and Tablefunc module installation