一、 安装PXF3.3.0.0,这里所安装的pxf的包文件都包含在apache-hawq-rpm-2.3.0.0-incubating.tar.gz里面
下面步骤都是以root身份执行
这里注意,pxf插件要用到tomcat服务,必须使用安装包里面的7.0.62, 不能安装或升级为 tomcat8,这会造成依赖的catalina.jar包 版本不匹配,以致pxf启动!

安装时由于pxf的包都是el6版本的,但是我用的centos7,所以rpm带参数“--nodeps”以忽略RPM命令对依赖包的检测。

cd /opt/gpadmin/hawq_rpm_packagesrpm -ivh  apache-tomcat-7.0.62-el6.noarch.rpm
rpm -ivh --nodeps pxf-service-3.3.0.0-1.el6.noarch.rpm
rpm -ivh --nodeps pxf-hdfs-3.3.0.0-1.el6.noarch.rpm
rpm -ivh --nodeps pxf-hive-3.3.0.0-1.el6.noarch.rpm
rpm -ivh --nodeps pxf-hbase-3.3.0.0-1.el6.noarch.rpm
rpm -ivh --nodeps pxf-jdbc-3.3.0.0-1.el6.noarch.rpm
rpm -ivh --nodeps pxf-json-3.3.0.0-1.el6.noarch.rpm
rpm -ivh --nodeps pxf-3.3.0.0-1.el6.noarch.rpm

二、 配置PXF

1,由于hadoop为HDP版本,所以使用hdp相关的jar包配置

[root@ep-bd01 ~]cp  /etc/pxf/conf/pxf-privatehdp.classpath  /etc/pxf/conf/pxf-private.classpath[root@ep-bd01 ~]cp  /etc/pxf/conf/pxf-profiles.xml   /etc/pxf/conf/pxf-profiles.default.xml

2,修改pxf目录所有者:

[root@ep-bd01 ~] chown -R pxf:pxf /opt/pxf-3.3.0.0
[root@ep-bd01 ~] chown -R pxf:pxf /tmp/logs

3,建立软连接目录:

[root@ep-bd01 ~] ln -s /etc/pxf-3.3.0.0/conf /opt/pxf-3.3.0.0/conf
[root@ep-bd01 ~] ln -s /usr/lib/pxf  /opt/pxf-3.3.0.0/lib

4,建立一个init过程需要的目录和template文件

[root@ep-bd01 ~] mkdir /opt/pxf-3.3.0.0/conf-templates
[root@ep-bd01 ~] cp /opt/pxf/conf/pxf-privatehdp.classpath /opt/pxf/conf-templates/pxf-private-hdp.classpath.template

5,修改pxf-service文件为pxf,因为init过程需要建立同名的目录,同时需要修改init.d目录中的链接:

[root@ep-bd01 ~] mv /opt/pxf/pxf-service  /opt/pxf/pxf
[root@ep-bd01 ~] unlink /etc/init.d/pxf-service
[root@ep-bd01 ~] ln -s /opt/pxf/pxf   /etc/init.d/pxf-service

6,修改tomcat/conf目录的权限,同时在pxf目录中建立链接

[root@ep-bd01 ~] chmod 755 -R /opt/apache-tomcat/conf/
[root@ep-bd01 ~] ln -s /opt/apache-tomcat /opt/pxf-3.3.0.0/apache-tomcat

7,编辑/etc/pxf/conf/pxf-env.sh,修改 PARENT_SCRIPT_DIR和LD_LIBRARY_PATH的值

[root@ep-bd01 ~] vim /etc/pxf/conf/pxf-env.sh
export PARENT_SCRIPT_DIR=/opt/pxf-3.3.0.0export PXF_HOME=/opt/pxf-3.3.0.0
export LD_LIBRARY_PATH=/usr/hdp/current/hadoop-client/lib/native:${LD_LIBRARY_PATH}

8,修改pxf脚本文件,设置PXF_HOME

[root@ep-bd01 ~] vim /opt/pxf-3.3.0.0/pxf
export PARENT_SCRIPT_DIR=/opt/pxf-3.3.0.0
export PXF_HOME=/opt/pxf-3.3.0.0

9,编辑/etc/pxf/conf/pxf-public.classpath,添加一系列的jar包

[root@ep-bd01 pxf-3.3.0.0]# vim /etc/pxf-3.3.0.0/conf/pxf-public.classpath
/usr/hdp/current/hadoop-client/lib/commons-beanutils-1.9.3.jar
/usr/hdp/current/hadoop-client/lib/commons-cli-1.2.jar
/usr/hdp/current/hadoop-client/lib/commons-codec-1.11.jar
/usr/hdp/current/hadoop-client/lib/commons-collections-3.2.2.jar
/usr/hdp/current/hadoop-client/lib/commons-compress-1.4.1.jar
/usr/hdp/current/hadoop-client/lib/commons-configuration2-2.1.1.jar
/usr/hdp/current/hadoop-client/lib/commons-io-2.5.jar
/usr/hdp/current/hadoop-client/lib/commons-lang-2.6.jar
/usr/hdp/current/hadoop-client/lib/commons-lang3-3.4.jar
/usr/hdp/current/hadoop-client/lib/commons-logging-1.1.3.jar
/usr/hdp/current/hadoop-client/lib/commons-math3-3.1.1.jar
/usr/hdp/current/hadoop-client/lib/commons-net-3.6.jar
/usr/hdp/current/hadoop-client/lib/jersey-core-1.19.jar
/usr/hdp/current/hadoop-client/lib/jersey-json-1.19.jar
/usr/hdp/current/hadoop-client/lib/jersey-server-1.19.jar
/usr/hdp/current/hadoop-client/lib/jersey-servlet-1.19.jar
/usr/hdp/current/hadoop-client/lib/jsr311-api-1.1.1.jar
/usr/hdp/current/hadoop-client/lib/woodstox-core-5.0.3.jar
/usr/hdp/current/hadoop-client/lib/stax2-api-3.1.4.jar
/usr/hdp/current/hadoop-client/lib/htrace-core4-4.1.0-incubating.jar
/usr/hdp/current/hadoop-client/lib/re2j-1.1.jar
/usr/hdp/3.0.0.0-1634/hbase/lib/atlas-hbase-plugin-impl/commons-configuration-1.10.jar
/usr/hdp/current/hadoop-hdfs-datanode/hadoop-hdfs-rbf.jar
/usr/hdp/current/hadoop-hdfs-datanode/hadoop-hdfs-nfs.jar
/usr/hdp/current/hadoop-hdfs-datanode/hadoop-hdfs-native-client.jar
/usr/hdp/current/hadoop-hdfs-datanode/hadoop-hdfs-httpfs.jar
/usr/hdp/current/hadoop-hdfs-datanode/hadoop-hdfs-client-3.1.0.3.0.0.0-1634.jar
/opt/pxf-3.3.0.0/lib/pxf-service-3.3.0.0.jar
/opt/pxf-3.3.0.0/lib/pxf-api-3.3.0.0.jar
:wq

10,复制pxf-profiles.xml 为pxf-profiles-default.xml并编辑,添加profile配置

[root@ep-bd05 pxf-3.3.0.0]# cp /etc/pxf/conf/pxf-profiles.xml   /etc/pxf/conf/pxf-profiles-default.xml
[root@ep-bd05 pxf-3.3.0.0]# vim /etc/pxf/conf/pxf-profiles-default.xml
<profiles> <profile><name>HdfsTextSimple</name><description>This profile is suitable for using when reading delimited single line records from plain text fileson HDFS</description><plugins><fragmenter>org.apache.hawq.pxf.plugins.hdfs.HdfsDataFragmenter</fragmenter><accessor>org.apache.hawq.pxf.plugins.hdfs.LineBreakAccessor</accessor><resolver>org.apache.hawq.pxf.plugins.hdfs.StringPassResolver</resolver></plugins></profile><profile><name>HdfsTextMulti</name><description>This profile is suitable for using when reading delimited single or multi line records (with quotedlinefeeds) from plain text files on HDFS. It is not splittable (non parallel) and slower than HdfsTextSimple.</description><plugins><fragmenter>org.apache.hawq.pxf.plugins.hdfs.HdfsDataFragmenter</fragmenter><accessor>org.apache.hawq.pxf.plugins.hdfs.QuotedLineBreakAccessor</accessor><resolver>org.apache.hawq.pxf.plugins.hdfs.StringPassResolver</resolver></plugins></profile>
</profiles>

三、初始化pxf,必须使用pxf用户

1,设置pxf的密码

passwd pxf

2,初始化,需要使用用户pxf

[root@ep-bd03 pxf]# source /etc/pxf/conf/pxf-env.sh[root@ep-bd03 pxf]# sudo -u pxf service pxf-service init

Generating /opt/pxf-3.3.0.0/conf/pxf-private.classpath file from /opt/pxf-3.3.0.0/conf-templates/pxf-private-hdp.classpath.template ...

cp /opt/pxf/pxf-service/webapps/pxf/WEB-INF/lib/*.jar  /opt/pxf/lib/

四、启动PXF service

1,启动:

sudo -u pxf service pxf-service start

Checking if tomcat is up and running...
tomcat not responding, re-trying after 1 second (attempt number 1)
Checking if PXF webapp is up and running...
PXF webapp is listening on port 51200

2,测试:

使用pxf插件访问已经事先从oracle导入到HDFS上的数据(使用了sqoop的--compress选项,是gz压缩格式,但是HdfsTextSimple可以直接访问),下面是建立hawq外部表的命令,注意路径中的星号。

drop external table ext.yx_bw;
create external table ext.yx_bw (occur_time date, ......    ) location ('pxf://192.168.58.15:51200/var/data/ext/yx_bw/*?profile=hdfstextsimple') format 'text'(delimiter ',' null '');    

**注意** ,此处的主机地址,我直接使用的是主机的地址,如果使用主机名称则hawq访问失败,据我观察应该是没有正确转换,一直没能解决此问题,如果哪位大侠知道请一定不吝赐教,先谢过了!如果地址使用location ('pxf://bd05:51200/var/data/ext/yx_bw/*?profile=hdfstextsimple') ,外部表可以建立,但是访问数据时显示如下错误,且没有详细信息,pxf服务的log也找不到访问失败的记录!

epbd=> select * from ext.yx_bw;
ERROR:  remote component error (0): (libchurl.c:897)

下面是系统中的/etc/hosts文件和/etc/host.conf文件,由于本集群可以访问外网,可以看到nslookup返回了错误地址,但是ping和curl访问都是正确的。

root@ep-bd05 pg_log]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.58.11  ep-bd01 bd01
192.168.58.12  ep-bd02 bd02
192.168.58.13  ep-bd03 bd03
192.168.58.14  ep-bd04 bd04
192.168.58.15  ep-bd05 bd05

[root@ep-bd05 pg_log]# cat /etc/host.conf
multi off

[root@ep-bd05 pg_log]# nslookup bd01
Server:         211.137.160.5
Address:        211.137.160.5#53Non-authoritative answer:
Name:   bd01
Address: 211.137.170.246[root@ep-bd05 pg_log]# ping bd01
PING ep-bd01 (192.168.58.11) 56(84) bytes of data.
64 bytes from ep-bd01 (192.168.58.11): icmp_seq=1 ttl=64 time=0.156 ms
64 bytes from ep-bd01 (192.168.58.11): icmp_seq=2 ttl=64 time=0.160 ms
^C
--- ep-bd01 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.156/0.158/0.160/0.002 ms
[root@ep-bd05 pg_log]# curl http://bd01:51200/pxf/v0
Wrong version v0, supported version is v15[root@ep-bd05 pg_log]# 

五、可选操作:

1,修改/opt/pxf/pxf-service/conf/catalina.properties,修改 base.shutdown.port

#base.shutdown.port=-1
base.shutdown.port=8005

2,修改/opt/pxf/pxf-service/conf/tomcat-users.xml,给用户tomcat添加角色manager-gui ,以便可以在浏览器中管理webapps

[root@ep-bd01 ~] vim /opt/pxf/pxf-service/conf/tomcat-users.xml
<role rolename="tomcat"/>
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>

基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库04 —— 安装HAWQ插件PXF3.3.0.0...相关推荐

  1. ubuntu16.04安装NIVIDIA显卡驱动,cuda8.0,cuDNN6.0以及基于Anaconda安装Tensorflow-GPU

    一.安装NAVIDIA驱动 安装之前首先得下载NAVIDIA驱动,其中语言要选择Chinese 下载好以后看一下,应该在Download哪里 1.打开终端,先删除旧的驱动 sudo apt-get p ...

  2. Hadoop2.2.0伪分布式环境搭建(附:64位下编译Hadoop-2.2.0过程)

    Hadoop2.2.0伪分布式环境搭建: 写在前面:Hadoop2.2.0默认是支持32位的OS,如果想要在64位OS下运行的话,可以通过在64位OS下面编译Hadoop2.2.0来实现,编译的操作步 ...

  3. 基于CentOs下的Hadoop完全分布式集群环境搭建

    Hadoop配置 一.准备工作 1.下载虚拟机,安装centos 在VM中新建4台虚拟机(内存建议2-4G) VMware14下载 提取码:e6dn centos6.8和centos7下载 提取码:4 ...

  4. Ubuntu LNMPR环境搭建(Ubuntu 20.04 + Nginx1.8 + PHP 7.3 + Mysql8.0 + Redis5.0)

    本文环境 Windows10,Ubuntu 20.04,Nginx1.8,PHP 7.3,Mysql8.0,Redis5.0\ 不懂的可以评论或联系我邮箱:owen@owenzhang.com\ 著作 ...

  5. Ubuntu 12.04安装下载工具 UGet 1.8.0 及 aria2用法

    1. aria2用法 aria2是我今天新学到的一个命令行的下载工具,虽然还没研究透,但是他绝对比wget更好. aria2 是 Linux 下一个不错的高速下载工具.由于它具有分段下载引擎,所以支持 ...

  6. Ubuntu 20.04 安装CUDA11.1 和cudnn 8.0.5

    Install CUDA cuda 11.1 百度网盘链接 密码: bo6f sudo sh cuda_11.1.0_455.23.05_linux.run 把第一个X,用enter键去掉,去掉之后, ...

  7. optee3.12.0 qemu_v8的环境搭建篇(ubuntu20.04)

    快速链接: .

  8. ubuntu18.04安装gcc7.3.0g++7.3.0

    代码 sudo apt-get update sudo apt-get install aptitude sudo aptitude install gcc sudo apt install gcc ...

  9. 基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库01 —— 准备环境,搭建本地仓库,安装ambari...

    一.集群软硬件环境准备: 操作系统:  centos 7 x86_64.1804 Ambari版本:2.7.0 HDP版本:3.0.0 HAWQ版本:2.3.0 5台PC作为工作站: ep-bd01 ...

最新文章

  1. QIIME 2教程. 13训练特征分类器TrainingFeatureClassifiers(2021.2)
  2. PNAS-2018-玉米根际的大规模田间重复研究确定可遗传的微生物
  3. java多线程基本概述(二十)——中断
  4. SpringBoot 根据传参返回不同的内容
  5. 中断(interrupted()、isInterrupted())、Executor的中断
  6. 数据源 连接oracle
  7. BootStrap笔记-按钮相关
  8. Laravel核心解读--Database(二) 查询构建器
  9. 微信抢红包代码 python_python实现红包裂变算法
  10. ZF环境要求及如何配置
  11. java 发布应用_发布java应用程序的步骤
  12. python爬虫项目描述怎么写_爬虫项目咋写,爬取什么样的数据可以作为项目写在简历上?...
  13. 内核低分辨率定时器实现
  14. Ubuntu 下安装 GCC 的方法
  15. containsAll和contains
  16. ChatGPT专业应用:生成行业分析报告
  17. java abstrict class,java - implements Closeable或实现AutoCloseab
  18. 屏幕小于6英寸的手机_有什么6英寸以下的小屏手机推荐?
  19. 苹果cms模板_泛目录站群神器,万词无限模板站群黑帽SEO程序
  20. 建设部是否认可计算机软考,呼吁计算机技术与软考中级证书获得建设部的认可-房建监理-筑龙工程监理论坛...

热门文章

  1. LeetCode 54. Spiral Matrix
  2. L2-004. 这是二叉搜索树吗?-PAT团体程序设计天梯赛GPLT
  3. 携程ELK日志分析平台深耕之路
  4. oracle下创建id自增长
  5. SSL证书相关技巧 -- 为什么有时候访问某些加密网站是不需要证书的?
  6. 二、2.4版本之前的apache的安装
  7. agilent3070软件安装
  8. windows下mysql+apache+php配置
  9. 构建jQuery对象(转)
  10. 红帽发布虚拟化策略 产品即将上市