使用MySQL作为Hive的Metastore
使用MySQL作为Hive的Metastore
前提是成功安装了HIVE和MYSQL
在hive-site.xml中添加如下内容,指定METASTORE的地址以及连接方式
[gpadmin1@hadoop5 hive-0.6.0]$ bin/hiveHive history file=/tmp/gpadmin1/hive_job_log_gpadmin1_201106081130_544334815.txthive> show table; FAILED: Parse Error: line 0:-1 mismatched input '<EOF>' expecting EXTENDED in show statementhive> show tables;OKTime taken: 5.173 secondshive> CREATE TABLE u_tmp1 (id1 INT, > id2 int > ) > ROW FORMAT DELIMITED > FIELDS TERMINATED BY ',';OKTime taken: 0.266 secondshive> show tables; OKu_tmp1Time taken: 0.197 secondshive>
注:
修改数据库的binlog
Java代码
set global binlog_format='MIXED';
READ-COMMITTED需要把bin-log以mixed方式来记录
否则进入hive,会如下错误
FAILED: Error in metadata: javax.jdo.JDOException: Couldnt obtain a new sequence (unique id) : Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'