Hive使用過程當中踩過的坑

hive啓動時錯誤1

Cannot execute statement:impossible to write to binary long since BINLOG_FORMAT = STATEMENT...
當啓動時報錯
Caused by: javax.jdo.JDOException:Couldnt obtain a new sequence(unique id):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-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITED.
NestedThrowables: 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 COMMITED or READ UNCOMMITED.複製代碼

緣由:這是因爲hive的元數據存儲MYSQL配置不當引發的

解決方案1(臨時解決):mysql> set global binlog_format='MIXED'

解決方案2(永久解決):
修改/etc/my.cnf,添加屬性
# binary logging format - mixed recommended 
binlog_format=mixed複製代碼

hive啓動時錯誤2

Exception in thread "main" java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:230)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:209)
    at org.apache.hadoop.hive.cli.CliDriver.setupConsoleReader(CliDriver.java:787)
    at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:721)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)複製代碼

緣由:
hadoop目錄下存在老版本jline:
/hadoop-2.7.2/share/hadoop/yarn/lib:
-rw-r--r-- 1 root root   87325 Mar 10 18:10 jline-0.9.94.jar

解決:
將hive安裝路徑下的lib目錄下的jline-版本號.jar文件拷貝到hadoop安裝目錄/share/hadoop/yarn/lib下便可
如:cp -r /hive/lib/jline-2.12.jar /hadoop-2.7.2/share/hadoop/yarn/lib複製代碼

hive建表時出現

Error: Error while processing statement: FAILED: 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.) (state=08S01,code=1)。複製代碼

緣由:在建立mysql時使用的字符集不對,須要修改hive數據庫的字符集。
解決:在mysql中使用命令修改hive數據庫字符集:alter database hive character set latin1;複製代碼

在drop表時卡死

緣由:因爲是先建立的表,以後再修改的hive數據庫的字符集,因此卡死。
解決:
1. 進入mysql,將mysql下創建的元數據庫hive刪除,再使用mysql從新建立,建立後修改字符集爲latin1,在mysql刪除hive數據庫時,須要將hive中止,否則mysql也會卡死。
2. 也能夠修改/etc/my.cnf文件,將裏邊涉及到字符的屬性都設置爲latin1複製代碼

歡迎關注下方公衆號,獲取更多文章信息
1
相關文章
相關標籤/搜索