hive元数据使用mysql,发现hive启动和在hive中创建表失败的BUG。
启动失败报错提示:
Caused by: java.sql.SQLException: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
创建表失败:
Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask.
MetaException(message:For direct MetaStore DB connections, we don’t support retries at the client level.)
原始是配置元数据库mysql不当造成的错误。
解决方法:
- 在数据库中修改hive库的编码格式。
root ~]# mysql -u root -prootmysql> drop databases hive;
mysql> create database hive;
mysql> alter database hive character set latin1;
-
编辑my.cnf文件
vim /usr/my.cnf
添加
binlog_format=mixed -
重启mysql服务和hive
service mysql restart
sh hive
即可。