跳转至

配置

PXF总体配置说明

默认配置目录为:$SDHOME/pxf_conf,配置目录下下共有conf, keytabs, lib, logs, servers, templates六个文件夹, 主要关注lib, servers, logs, templates四个文件夹。其中:

lib文件夹
存放需要加到pxf classpath中的jar包,例如连接hive元数据数据库需要的jar包,连接jdbc需要的jar包等,使用的过程中根据需要添加。
servers文件夹

存放服务配置文件,默认有一个default文件夹,一个文件夹对应一个数据库中的一个server name。

server配置文件可以分为两类,一类是core-site.xml,hive-site.xml,hbase-site.xml这类,对应hadoop端配置的配置文件。另一类是pxf-site.xml, *-user.xml这种。第二类配置文件可以指定这个服务是否可以用户映射,jdbc的密码等。具体的文件说明参见对应数据源的说明文档。

通用配置文件pxf-site.xml示例

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <property>
        <name>pxf.service.kerberos.principal</name>
        <value>scadmin/_HOST@EXAMPLE.COM</value>
        <description>Kerberos principal pxf service should use. _HOST is replaced automatically with hostnames FQDN</description>
    </property>
    <property>
        <name>pxf.service.kerberos.keytab</name>
        <value>${pxf.conf}/keytabs/pxf.service.keytab</value>
        <description>Kerberos path to keytab file owned by pxf service with permissions 0400</description>
    </property>
    <property>
        <name>pxf.service.user.impersonation</name>
        <value>${pxf.service.user.impersonation.enabled}</value>
        <description>End-user identity impersonation, set to true to enable, false to disable</description>
    </property>
    <property>
        <name>pxf.service.user.name</name>
        <value>${user.name}</value>
        <description>
            The pxf.service.user.name property is used to specify the login
            identity when connecting to a remote system, typically an unsecured
            Hadoop cluster. By default, it is set to the user that started the
            PXF process. If PXF impersonation feature is used, this is the
            identity that needs to be granted Hadoop proxy user privileges.
            Change it ONLY if you would like to use another identity to login to
            an unsecured Hadoop cluster
        </description>
    </property>
</configuration>
其中:pxf.service.user.impersonation设为true,则使用用户映射。pxf.service.user.name是目标用户的用户名。注意例如hdfs,hive这种server的保留关键字因为已经存在默认配置文件,用户映射无效。

logs文件夹
存放pxf运行和启动的日志。
templates文件夹
存放日志模板,每个选项有对应的说明信息。
杂项说明
pxf的copy选项,如果format是'text',会按照text解析数据,如果format不是'text',是默认格式的csv。