Hive分区异常

45次阅读

共计 1373 个字符,预计需要花费 4 分钟才能阅读完成。

org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)

当向分区写入数据或刷分区的时候,报出这个异常。网上的说的办法有很多,综合起来就两个,这有点像小霸王的游戏卡,300 合 1 其实就是 4 合 1
一种是设置 MySQL 库的字符集为 latin1,我的库里本来就是 latin1,我还是又设置了一遍,重启 hive,果然无效;
另一种是替换其他版本的 mysql-connector-java,我替换了两个版本都不行。

最后的解决办法是修改元数据库的名字,不用 hive,换成其他的比如 hive_metastore,就可以了。

    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>root</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql:///hive_metastore?createDatabaseIfNotExists=true</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>

报错的信息在源码中如下,

  @Override
  public void reconnect() throws MetaException {if (localMetaStore) {
      // For direct DB connections we don't yet support reestablishing connections.
      throw new MetaException("For direct MetaStore DB connections, we don't support retries"+" at the client level.");
    } else {close();
      // Swap the first element of the metastoreUris[] with a random element from the rest
      // of the array. Rationale being that this method will generally be called when the default
      // connection has died and the default connection is likely to be the first array element.
      promoteRandomMetaStoreURI();
      open();}
  }

所以,虽然问题解决了,但这还是不排除原来的库连接有什么问题,毕竟换了新的元数据库了。

参考博客:https://blog.csdn.net/RUIMENG…

正文完
 0