无法通过JDBC连接创建Hive表

时间:2015-09-28 14:18:00

标签: hadoop jdbc hive

我在我的ubuntu上运行Hive2并试图通过hive接口和beeline \ jdbc创建表。 我通过hive接口创建表没有问题,但是当通过jdbc访问时,我得到一个权限被拒绝错误。

 FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:Got exception: org.apache.hadoop.security.AccessControlException Permission denied: user=hive, access=WRITE, inode="/user/hive/warehouse/page_view":cto:supergroup:drwxrwxr-x

从异常中我看到它试图在一个不存在的目录中创建表(/ user / hive / warehouse /...)

我的hive-default.xml具有以下配置:

<property>
    <name>hive.metastore.warehouse.dir</name>
    <value>/usr/local/apache-hive-1.2.1-bin/metastore_db</value>
    <description>location of default database for the warehouse</description>
  </property>
  <property>
    <name>hive.metastore.uris</name>
    <value/>
    <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
  </property>
  <property>
    <name>hive.metastore.connect.retries</name>
    <value>3</value>
    <description>Number of retries while opening a connection to metastore</description>
  </property>
  <property>
    <name>hive.metastore.failure.retries</name>
    <value>1</value>
    <description>Number of retries upon failure of Thrift metastore calls</description>
  </property>
  <property>
    <name>hive.metastore.client.connect.retry.delay</name>
    <value>1s</value>
    <description>
      Expects a time value with unit (d/day, h/hour, m/min, s/sec, ms/msec, us/usec, ns/nsec), which is sec if not specified.
      Number of seconds for the client to wait between consecutive connection attempts
    </description>
  </property>
  <property>
    <name>hive.metastore.client.socket.timeout</name>
    <value>600s</value>
    <description>
      Expects a time value with unit (d/day, h/hour, m/min, s/sec, ms/msec, us/usec, ns/nsec), which is sec if not specified.
      MetaStore Client socket timeout in seconds
    </description>
  </property>
  <property>
    <name>hive.metastore.client.socket.lifetime</name>
    <value>0s</value>
    <description>
      Expects a time value with unit (d/day, h/hour, m/min, s/sec, ms/msec, us/usec, ns/nsec), which is sec if not specified.
      MetaStore Client socket lifetime in seconds. After this time is exceeded, client
      reconnects on the next MetaStore operation. A value of 0s means the connection
      has an infinite lifetime.
    </description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>mine</value>
    <description>password to use against metastore database</description>
  </property>
  <property>
    <name>hive.metastore.ds.connection.url.hook</name>
    <value/>
    <description>Name of the hook to use for retrieving the JDO connection URL. If empty, the value in javax.jdo.option.ConnectionURL is used</description>
  </property>
  <property>
    <name>javax.jdo.option.Multithreaded</name>
    <value>true</value>
    <description>Set this to true if multiple threads access metastore through JDO concurrently.</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:derby:;databaseName=/usr/local/apache-hive-1.2.1-bin/metastore_db;create=true</value>
    <description>JDBC connect string for a JDBC metastore</description>
  </property>

那么为什么要尝试在/ user / hive / warehouse下创建metastore_db?

1 个答案:

答案 0 :(得分:0)

我的问题是我没有按照我的意愿将hive-default.xml.template名称更改为hive-site.xml