Hive(16):hiveserver2服务

1、hiveserver2功能

    优势:将hive变成一个服务对外开放,通过客户端去链接。开启hiveserver2,然后使用beeline客户端访问,有验证的方法,从而限制用户访问权限,保证数据库安全。

2、启动hiveserver2并且连接方法

(1)单独启动hiveserver2和beeline

    启动服务  

bin/hiveserver2

    启动客户端

bin/beeline
!connect jdbc:hive2://bigdata.ibeifeng.com:10000

(2)一步到位

bin/beeline -u jdbc:hive2://bigdata.ibeifeng.com:10000 -n beifeng -p beifeng

3.配置方法

(1)在操作beeline的时候,hiveserver2会有回显信息,操作成功会有ok,失败会有错误信息
          所以在开启bin/hiveserver2的时候,使用nohup让进程在后台启动,并且把回显的数据添加到文本中

nohup bin/hiveserver2  > myout.file 2>&1 &

(2)hiveserver2如果链接不上,超时,可以修改参数,把L去掉,添加到hive-site.xml

        <property>
            <name>hive.server2.long.polling.timeout</name>
            <value>5000L</value>
            <description>Time in milliseconds that HiveServer2 will wait, before responding to asynchronous calls that use long polling</description>
        </property>

(3)会发现hiveserver2几乎没有权限验证,是因为配置文件中,默认没有开启

     <property>
        <name>hive.server2.authentication</name>
        <value>NONE</value>
        <description>
          Expects one of [nosasl, none, ldap, kerberos, pam, custom].
          Client authentication types.
            NONE: no authentication check
            LDAP: LDAP/AD based authentication
            KERBEROS: Kerberos/GSSAPI authentication
            CUSTOM: Custom authentication provider
                    (Use with property hive.server2.custom.authentication.class)
            PAM: Pluggable authentication module
            NOSASL:  Raw transport
        </description>
      </property>

猜你喜欢

转载自blog.csdn.net/u010886217/article/details/83926160
今日推荐