zoukankan      html  css  js  c++  java
  • phoenix kerberos 连接配置

    1. 官网资料

    Use JDBC to get a connection to an HBase cluster like this:

    Connection conn = DriverManager.getConnection("jdbc:phoenix:server1,server2:3333",props);

    where props are optional properties which may include Phoenix and HBase configuration properties, and the connection string which is composed of:

    jdbc:phoenix [ :<zookeeper quorum> [ :<port number> [ :<root node> [ :<principal> [ :<keytab file> ] ] ] ] ] 

    For any omitted parts, the relevant property value, hbase.zookeeper.quorum, hbase.zookeeper.property.clientPort, and zookeeper.znode.parent will be used from hbase-site.xml configuration file. The optional principal and keytab file may be used to connect to a Kerberos secured cluster. If only principal is specified, then this defines the user name with each distinct user having their own dedicated HBase connection (HConnection). This provides a means of having multiple, different connections each with different configuration properties on the same JVM.

    For example, the following connection string might be used for longer running queries, where the longRunningProps specifies Phoenix and HBase configuration properties with longer timeouts:

    Connection conn = DriverManager.getConnection(“jdbc:phoenix:my_server:longRunning”, longRunningProps);
    while the following connection string might be used for shorter running queries:
    Connection conn = DriverManager.getConnection("jdbc:phoenix:my_server:shortRunning", shortRunningProps);

    Please read the relevant FAQ entry for example URLs.

    2. 源码其他配置方法

    经过查看phoenix源代码,发现
    getConnection还有一个带properties的接口,应该是连接属性,

    properties.setProperty("hbase.zookeeper.quorum", "172.16.31.165,172.16.31.166,172.16.31.167");
    properties.setProperty("hbase.master.kerberos.principal", "hbase/_HOST@COM");
    properties.setProperty("hbase.master.keytab.file", "/etc/security/keytabs/hbase.service.keytab");
    properties.setProperty("hbase.regionserver.kerberos.principal", "hbase/_HOST@COM"); 
    properties.setProperty("hbase.regionserver.keytab.file", "/etc/security/keytabs/hbase.service.keytab");
    properties.setProperty("phoenix.queryserver.kerberos.principal", "hbase/_HOST@COM"); 
    properties.setProperty("phoenix.queryserver.keytab.file", "/etc/security/keytabs/hbase.service.keytab");
    properties.setProperty("hbase.security.authentication", "kerberos"); 
    properties.setProperty(
    "hadoop.security.authentication", "kerberos");
    properties.setProperty(
    "zookeeper.znode.parent", "/hbase");
    con
    = DriverManager.getConnection("jdbc:phoenix:172.16.31.165,172.16.31.166,172.16.31.167:2181:/hbase:"+principal+":"+keytab, properties);
  • 相关阅读:
    『ORACLE』 DBLINK(11g)
    『ORACLE』 对永久表空间进行DDL操作(11g)
    『ORACLE』 对永久表空间进行DML操作(11g)
    『ORACLE』 数据库suspend模式(11g)
    『ORACLE』 数据库quiesce模式(11g)
    『ORACLE』 数据库restricted模式(11g)
    [转]为什么不去读顶级会议上的论文
    learn from 德国老师
    IDA 调试 Android
    L#中 int.TryParse 有问题
  • 原文地址:https://www.cnblogs.com/felixzh/p/11586897.html
Copyright © 2011-2022 走看看