1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      greenplum使用gplink連接外部數(shù)據(jù)源

          作為一個基于postgresql開發(fā)的數(shù)據(jù)倉庫,隨著近幾年大數(shù)據(jù)概念的興起也備受關(guān)注。

      創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站設(shè)計、成都網(wǎng)站設(shè)計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的隰縣網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

          由于GP是近近幾年才開源的數(shù)據(jù)庫,網(wǎng)上資料很少,不像MySQL這樣爛大街,基本上遇到的問題網(wǎng)上都可以搜到。而GP遇到問題只能靠自己判斷了,很多時候只能看官方文檔,而文檔全為英文,對于英文很爛的本人表示真的很無力。。。

      gplink的原理:

          greenplum 支持gpfdist協(xié)議外部表,gpfdist協(xié)議支持自定義transform。

          gplink 使用jdbc連接外部數(shù)據(jù)源,定義transform,將jdbc數(shù)據(jù)源的數(shù)據(jù)轉(zhuǎn)換為text格式導(dǎo)入GP或HAWQ。

          官方提供的有g(shù)reenplum、sqlserver、hive、oracle數(shù)據(jù)庫的模版,現(xiàn)在需要連接的是mysql數(shù)據(jù)庫,有點(diǎn)麻煩,踩了幾個坑,在文章最后面會提到。

      所需軟件下載地址

      gplink下載地址

      https://github.com/pivotalguru/gplink

      mysql JDBC下載地址

      https://dev.mysql.com/downloads/connector/j/

      這是官方文檔的安裝步驟

      1.  Download latest version from PivotalGuru.com                                  

      2.  Unzip .zip

      3.  source gplink_path.sh and add this to your .bashrc file                      

      4.  Edit gplink.properties with correct Greenplum or Hawq connection information  

      5.  Download 3rd party JDBC drivers and place it in $GPLINK_HOME/jar  

      6.  Define source configurations in $GPLINK_HOME/connections/  

      7.  Define external table names and columns in $GPLINK_HOME/tables/  

      8.  Define SQL statements to execute in the source in $GPLINK_HOME/sql/  

      9.  Create the External Table with gpltable

      個人翻譯的中文(翻譯得不好見諒)

      1、從pivotalguru.com下載最新版本

      2、解壓壓縮包

      3、source gplink_path.sh并添加到 .bashrc文件

      4、在gplink.properties中編輯Greenplum或Hawq的連接信息

      5、下載第三方JDBC驅(qū)動程序并將其放入$GPLINK_HOME/jar

      6、在$GPLINK_HOME/connections/修改源數(shù)據(jù)庫配置信息

      7、在$GPLINK_HOME/tables/定義外部表名和列

      8、在$GPLINK_HOME/sql/定義要在源數(shù)據(jù)庫執(zhí)行的sql語句

      9、用gpltable創(chuàng)建外部表

      下面開始安裝

          安裝之前要先在mysql端(172.16.104.71:3306)給GP開放訪問權(quán)限,要關(guān)閉iptables,或iptables開放mysql端口。

          這里為了方便測試mysql給了最大權(quán)限,在實(shí)際環(huán)境中不能這么做

      [root@s121 ~]# mysql -uroot -p123
      mysql> grant all on *.* to "root"@"%" identified by '123';
      mysql> flush privileges;

      1、從pivotalguru.com下載最新版本

      [root@mdw ~]# su - gpadmin
      [gpadmin@mdw ~]$wget https://codeload.github.com/pivotalguru/gplink/zip/master

      2、解壓壓縮包

      [gpadmin@mdw ~]$unzip master

      3、source gplink_path.sh并添加到 .bashrc文件

      [gpadmin@mdw ~]$source gplink-master/gplink_path.sh
      [gpadmin@mdw ~]$vi .bashrc 
      source /home/gpadmin/gplink-master/gplink_path.sh

      4、在gplink.properties中編輯Greenplum或Hawq的連接信息

      [gpadmin@mdw ~]$ vi $GPLINK_HOME/gplink.properties 
      connectionUrl=jdbc:postgresql://mdw:5432/gpdb     #gpdb為gp的數(shù)據(jù)庫
      classForName=org.postgresql.Driver
      readCommitted=true
      userName=gpadmin                                  #gp用戶名
      password=123456                                   #密碼,注意后面不能有空格
      gplinkHome=/usr/local/gplink
      gplinkLog=//usr/local/gplink/log/gplink
      gplinkYml=/usr/local/gplink/yml/gplink.yml
      gplinkPortLower=24000
      gplinkPortUpper=25000

      5、下載第三方JDBC驅(qū)動程序并將其放入$GPLINK_HOME/jar

      [gpadmin@mdw ~]$ wget https://dev.mysql.com/downloads/file/?id=470332
      [gpadmin@mdw ~]$ tar xvf mysql-connector-java-5.1.42.tar.gz 
      [gpadmin@mdw ~]$ cp mysql-connector-java-5.1.42/mysql-connector-java-5.1.42-bin.jar gplink-master/jar/

       6、在$GPLINK_HOME/connections/修改配置

      [gpadmin@mdw ~]$ cp $GPLINK_HOME/connections/oracle.properties $GPLINK_HOME/connections/mysql.properties
      [gpadmin@mdw ~]$ vi $GPLINK_HOME/connections/mysql.properties 
      connectionUrl=jdbc:mysql://172.16.104.71:3306/test       #test為mysql的數(shù)據(jù)庫
      classForName=com.mysql.jdbc.Driver
      readCommitted=true
      userName=root                                            #mysql用戶名
      password=123                                             #mysql密碼
      extraProps=defaultRowPrefetch=2000                       #每次讀取的數(shù)據(jù)量

      7、在$GPLINK_HOME/tables/定義外部表名和列

      [gpadmin@mdw ~]$ cp $GPLINK_HOME/tables/public.oracle_example.sql $GPLINK_HOME/tables/public.mysql.sql 
      [gpadmin@mdw ~]$ vi $GPLINK_HOME/tables/public.mysql.sql 
      tableName=public.mysql
      columns=first_name text, last_name text

      8、在$GPLINK_HOME/sql/定義要在源數(shù)據(jù)庫執(zhí)行的sql語句

      [gpadmin@mdw ~]$ cp $GPLINK_HOME/sql/oracle_example.sql $GPLINK_HOME/sql/mysql_example.sql

       9、用gpltable創(chuàng)建外部表

      [gpadmin@mdw ~]$gpltable -s $GPLINK_HOME/connections/mysql.properties -t $GPLINK_HOME/gplink.properties -f $GPLINK_HOME/sql/mysql_example.sql -a $GPLINK_HOME/tables/public.mysql.sql

      此時登錄GP數(shù)據(jù)庫,發(fā)現(xiàn)多了一個mysql表

      [gpadmin@mdw ~]$ psql -d gpdatabase
      psql (8.2.15)
      Type "help" for help.
      
      gpdatabase=# \dx
                       List of relations
       Schema |     Name     | Type  |  Owner  | Storage  
      --------+--------------+-------+---------+----------
       public | mysql        | table | gpadmin | external
      (1 rows)

      測試

      [gpadmin@mdw ~]$ gplstart -t $GPLINK_HOME/gplink.properties 
      Started all ports needed.
      [gpadmin@mdw ~]$ gpldata -s $GPLINK_HOME/connections/mysql.properties -f $GPLINK_HOME/sql/mysql_example.sql
      jon|roberts
      JON|ROBERTS

      OK,該狀態(tài)說明連接成功。

      至于怎么從mysql把數(shù)據(jù)導(dǎo)入greenplum,本人還未研究,自己慢慢摸索吧。

      刪除表命令

      [gpadmin@mdw ~]$ gpldrop -t $GPLINK_HOME/connections/gplink.properties -n public.mysql

      安裝過程中踩到的幾個坑

      1、mysql.properties 中的ClassForName不對,因為沒有mysql的模版,是拷貝oracle的模版來用

      [gpadmin@mdw ~]$ gpldata -s $GPLINK_HOME/connections/mysql.properties -f $GPLINK_HOME/sql/mysql_example.sql
      Exception in thread "main" java.sql.SQLException: mysql.jdbc.driver.MysqlDriver
      	at ExternalData.main(ExternalData.java:25)

      2、jdbc版本不對,下載了最新版,用不了

      [gpadmin@mdw ~]$ gpldata -s $GPLINK_HOME/connections/mysql.properties -f $GPLINK_HOME/sql/mysql_example.sql
      Exception in thread "main" java.lang.UnsupportedClassVersionError: com/mysql/jdbc/Driver : Unsupported major.minor version 52.0

      3、連接失敗,mysql主機(jī)的防火墻沒關(guān)或沒開放mysql端口

      [gpadmin@mdw ~]$ gpldata -s $GPLINK_HOME/connections/mysql.properties -f $GPLINK_HOME/sql/mysql_example.sql
      Exception in thread "main" java.sql.SQLException: Communications link failure
      
      The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any 
      	at ExternalData.main(ExternalData.java:25)

      4、密碼錯誤,原因是mysql.properties文件中的密碼后面有空格

      [gpadmin@mdw ~]$ gpldata -s $GPLINK_HOME/connections/mysql.properties -f $GPLINK_HOME/sql/mysql_example.sql
      Exception in thread "main" java.sql.SQLException: Access denied for user 'root'@'172.16.104.21' (using password: YES)
      	at ExternalData.main(ExternalData.java:25)

      本文標(biāo)題:greenplum使用gplink連接外部數(shù)據(jù)源
      標(biāo)題鏈接:http://ef60e0e.cn/article/jsgies.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        崇信县| 漳浦县| 奈曼旗| 天津市| 舟曲县| 弋阳县| 饶河县| 开封市| 松桃| 鱼台县| 柳河县| 和硕县| 新营市| 名山县| 江川县| 南召县| 探索| 柯坪县| 延安市| 卓尼县| 江山市| 个旧市| 西昌市| 彝良县| 石阡县| 吴忠市| 曲水县| 县级市| 南投县| 南宫市| 措勤县| 盐山县| 佛教| 平乐县| 乌兰浩特市| 大荔县| 什邡市| 将乐县| 海丰县| 班玛县| 贵德县|