美文网首页数客联盟程序员我爱编程
Phoenix程序如何加载hbase-site.xml

Phoenix程序如何加载hbase-site.xml

作者: Woople | 来源:发表于2017-05-27 21:55 被阅读366次

    背景

    使用java或者scala写一个通过JDBC方式连接Phoenix进行查询的程序时,需要调整一些Phoenix的参数,例如线程的数量phoenix.query.threadPoolSize,但是按照官方文档只是说把参数加到hbase-site.xml中,但是并没有说hbase-site.xml应该放到什么位置,所以导致无法读到hbase-site.xml里面的配置。

    The configuration is done through a series of Phoenix-specific properties specified both on client and server-side hbase-site.xml files.

    解决方案

    首先说一下结论,Phoenix程序是在user.dir目录下去找hbase-site.xml的。所以有两种解决方案:

    • 在执行java -cp之前cd到存放hbase-site.xml的路径

    • 运行命令中设置user.dir,例如执行java -Duser.dir=${APP_HOME}/conf -cp ${CLASSPATH} com.MyMain

    这样程序中就可以加载到hbase-site.xml配置的参数了。

    注:本文使用的是HDP发布的phoenix-4.7.0.2.5.0.0-1245版本

    相关文章

      网友评论

        本文标题:Phoenix程序如何加载hbase-site.xml

        本文链接:https://www.haomeiwen.com/subject/fsfcfxtx.html