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();
}
}
所以,虽然问题解决了,但这还是不排除原来的库连接有什么问题,毕竟换了新的元数据库了。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。