beeline配置使用问题

老师,使用beeline连接时,有如下 错误:
beeline> !connect jdbc:hive2://127.0.0.1:10000/default
Connecting to jdbc:hive2://127.0.0.1:10000/default
Enter username for jdbc:hive2://127.0.0.1:10000/default: root
Enter password for jdbc:hive2://127.0.0.1:10000/default: *****
16/12/25 01:44:49 [main]: WARN jdbc.HiveConnection: Failed to connect to 127.0.0.1:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://127.0.0.1:10000/default: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: hdfs is not allowed to impersonate root (state=08S01,code=0)
beeline> 
  ----hive-site.xml---
<property>
        <name>hive.server2.thrift.port</name>
        <value>10000</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://localhost:10770/metastore?createDatabaseIfNotExist=true</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>mysql</value>
    </property>
这里的root/mysql是连接mysql使用的用户名/密码。   另外按网上的方法,在core-site.xml里也加入了如下:
<!--add root-->
  <property>
   <name>hadoop.proxyuser.root.hosts</name>
   <value>*</value>
  </property>
  <property>
   <name>hadoop.proxyuser.root.groups</name>
   <value>*</value>
  </property>
  <!--add done-->
可还是不好使,请老师指点下。 谢谢 老师,我的hive是好用的,hiveserver2也启动了的。

wangxiaolei

赞同来自:

    <property>         <name>javax.jdo.option.ConnectionURL</name>         <value>jdbc:mysql://localhost:10770/metastore?createDatabaseIfNotExist=true</value>     </property> 10770对吗?mysql端口默认是3306

带刀锦衣卫

赞同来自:

老师,后端mysql使用的端口是10770,不是默认的3306

wangxiaolei

赞同来自:

!connect jdbc:hive2://127.0.0.1:10000 root mysql 这个连接试试

带刀锦衣卫

赞同来自:

 
beeline> !connect jdbc:hive2://127.0.0.1:10000 root mysql
Connecting to jdbc:hive2://127.0.0.1:10000
16/12/25 03:23:07 [main]: WARN jdbc.HiveConnection: Failed to connect to 127.0.0.1:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://127.0.0.1:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: hdfs is not allowed to impersonate root (state=08S01,code=0)
beeline> 
老师,也是同样的错。之前启动hive里,已经 在mysql里创建了metastore库了。

wangxiaolei

赞同来自:

帐号远程访问权限有吗

wangxiaolei

赞同来自:

使用用命令 netstat -antp | grep 10000 看看10000端口监听的ip是多少

带刀锦衣卫

赞同来自:

[hdfs@centos1 logs]$ netstat -ntpl | grep 10000
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:10000           0.0.0.0:*               LISTEN      31436/java          
[hdfs@centos1 logs]$ 
老师 我这样登录时:
beeline> !connect jdbc:hive2://127.0.0.1:10000 hdfs hdfs
Connecting to jdbc:hive2://127.0.0.1:10000
16/12/25 04:40:50 [main]: WARN jdbc.HiveConnection: Failed to connect to 127.0.0.1:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://127.0.0.1:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: hdfs is not allowed to impersonate hdfs (state=08S01,code=0)
java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://127.0.0.1:10000: Failed to open new session: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: hdfs is not allowed to impersonate hdfs
最后一句中前一个hdfs指的什么?后一个hdfs指代的是什么呐?  

带刀锦衣卫

赞同来自:

老师好,的hdfs目录如下:
[hdfs@centos1 hadoop-hdfs]$ hadoop fs -ls /
Found 5 items
drwxr-xr-x   - hdfs hadoop          0 2016-12-16 17:39 /benchmarks
drwxr-xr-x   - hdfs hadoop          0 2016-12-17 06:53 /flume
drwx-wx-wx   - hdfs hadoop          0 2016-12-24 18:39 /tmp
drwx------   - hdfs hadoop          0 2016-12-25 05:00 /user
drwxr-xr-x   - hdfs hadoop          0 2016-12-24 18:40 /warehouse
[hdfs@centos1 hadoop-hdfs]$ hadoop fs -ls /user/
Found 3 items
drwxr-xr-x   - hdfs hadoop          0 2016-12-22 23:02 /user/bigdata
drwx------   - hdfs hadoop          0 2016-12-22 18:26 /user/hdfs
drwxr-xr-x   - hdfs hadoop          0 2016-12-16 18:45 /user/history
[hdfs@centos1 hadoop-hdfs]$ 
如果把hive-site.xml里加上hive.server2.enabled.doAs = false就可以连接了?为什么呢?这个变量=true 我使用hdfs用户进入beeline命令行下,执行!connect jdbc:hive2://127.0.0.1:10000  hdfs hdfs也不行。按这个变量=true的解释这样会以hdfs执行查询,应该可以的呀。  

要回复问题请先登录注册