2

我是 hive 的新手,并试图以相对安全的方式为测试环境设置它。我想使用远程元存储,以便 MR 作业可以访问数据库。我似乎几乎可以正常工作,但是当具有凭据的用户尝试创建数据库时,我得到:

hive> show databases;
OK
default
hive> create database testdb;
FAILED: Error in metadata: MetaException(message:Got exception: org.apache.hadoop.ipc.RemoteException User: hdfs/hadoopserver.sub.dom.com@SUB.DOM.COM is not allowed to impersonate myuserid@SUB.DOM.COM)
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

我可以运行“显示数据库”了。我以 hdfs/hadoopserver.sub.dom.com@SUB.DOM.COM 作为主体作为 hdfs 运行“hive --service metastore”。我在同一个盒子上运行 hive 作为“myuserid”。我不知道它是否相关,但如果我尝试从另一个系统运行 hive,我会收到 GSS Initiate 错误,除非我对 hive 使用相同的主体 (hdfs/hadoopserver.sub.dom.com@SUB.DOM.COM) .metastore.kerberos.principal。这是预期的吗?

当我尝试用谷歌搜索时,我看到了类似的问题,但他们关于无法模拟的消息只显示了对我来说显示领域的单部分用户名。我尝试使用 auth_to_local 属性,但没有帮助。Map Reduce 和 HDFS 操作运行良好。

在 core-site.xml 我有:

<property>
  <name>hadoop.proxyuser.hdfs.hosts</name>
  <value>*</value>
</property>

<property>
  <name>hadoop.proxyuser.hdfs.groups</name>
  <value>*</value>
</property>

在 hive-site.xml 我有:

<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://localhost/metastore</value>
  <description>the URL of the MySQL database</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
</property>

<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>hive</value>
</property>

<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>password</value>
</property>

<property>
  <name>datanucleus.autoCreateSchema</name>
  <value>false</value>
</property>

<property>
  <name>datanucleus.fixedDatastore</name>
  <value>true</value>
</property>

<property>
  <name>hive.metastore.uris</name>
  <value>thrift://hadoopserver.sub.dom.com:9083</value>
</property>

<property>
  <name>hive.security.authorization.enabled</name>
  <value>true</value>
</property>

<property>
  <name>hive.metastore.sasl.enabled</name>
  <value>true</value>
</property>

<property>
  <name>hive.metastore.kerberos.keytab.file</name>
  <value>/etc/hadoop/hdfs.keytab</value>
</property>

<property>
  <name>hive.metastore.kerberos.principal</name>
  <value>hdfs/hadoopserver.sub.dom.com@SUB.DOM.COM</value>
</property>

<property>
    <name>hive.metastore.execute.setugi</name>
    <value>true</value>
</property>

有任何想法吗?

4

2 回答 2

0

Run hive metastore as user "hive" (hive/domain@Realm) and then configure hadoop.proxyuser.hive.hosts and hadoop.proxyuser.hive.groups to '*'. This works.

于 2013-09-03T11:32:57.810 回答
0

在 core-site.xml 中添加代理配置后,例如 hadoop.proxyuser.hdfs.groups,其中 hdfs 是启动 hiveserver 的用户,然后添加 hive.server2.enable.doAs=false 以模拟其他用户/组。

于 2015-01-25T11:43:27.740 回答