Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT…

轉載:http://blog.csdn.net/cjfeii/article/details/49363653

1 Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT…

當啓動Hive的時候報錯:

<code class="hljs applescript has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">Caused <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">by</span>: javax.jdo.JDOException: Couldnt obtain a new sequence (unique <span class="hljs-property" style="box-sizing: border-box;">id</span>) : Cannot execute statement: impossible <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> <span class="hljs-command" style="box-sizing: border-box;">write</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> binary <span class="hljs-command" style="box-sizing: border-box;">log</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">since</span> BINLOG_FORMAT = STATEMENT <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">and</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">at</span> least one table uses a storage engine limited <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> row-based logging. InnoDB <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> limited <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> row-logging when <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">transaction</span> isolation level <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> READ COMMITTED <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">or</span> READ UNCOMMITTED.
NestedThrowables:
java.sql.SQLException: Cannot execute statement: impossible <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> <span class="hljs-command" style="box-sizing: border-box;">write</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> binary <span class="hljs-command" style="box-sizing: border-box;">log</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">since</span> BINLOG_FORMAT = STATEMENT <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">and</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">at</span> least one table uses a storage engine limited <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> row-based logging. InnoDB <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> limited <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">to</span> row-logging when <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">transaction</span> isolation level <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">is</span> READ COMMITTED <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">or</span> READ UNCOMMITTED.</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>

這個問題是由於hive的元數據存儲MySQL配置不當引起的,可以這樣解決:

<code class="hljs vbnet has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">mysql> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">set</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">global</span> binlog_format=<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">'MIXED';</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

2 For direct MetaStore DB connections, we don’t support retries at the client level.

當在Hive中創建表的時候報錯:

<code class="hljs vbnet has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">create table years (year <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">string</span>, <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">event</span> <span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">string</span>) row format delimited fields terminated <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">by</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">'\t';</span>
FAILED: Execution <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">Error</span>, <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">return</span> code <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">from</span> org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">For</span> direct MetaStore DB connections, we don<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">'t support retries at the client level.)</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

這是由於字符集的問題,需要配置MySQL的字符集:

<code class="hljs applescript has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">mysql> alter database hive <span class="hljs-property" style="box-sizing: border-box;">character</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">set</span> latin1;</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

3 HiveConf of name hive.metastore.local does not exist

當執行Hive客戶端時候出現如下錯誤:

<code class="hljs applescript has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">WARN conf.HiveConf: HiveConf <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">of</span> <span class="hljs-property" style="box-sizing: border-box;">name</span> hive.metastore.<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">local</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">does</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">not</span> exist</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

這是由於在0.10 0.11或者之後的HIVE版本 hive.metastore.local 屬性不再使用。將該參數從hive-site.xml刪除即可。

4 Permission denied: user=anonymous, access=EXECUTE, inode=”/tmp”

在啓動Hive報如下錯誤:

<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">(<span class="hljs-constant" style="box-sizing: border-box;">Permission</span> <span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">denied:</span> user=anonymous, access=<span class="hljs-constant" style="box-sizing: border-box;">EXECUTE</span>, inode=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"/tmp"</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:hadoop</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:supergroup</span><span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">:drwx------</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

這是由於Hive沒有hdfs:/tmp目錄的權限,賦權限即可:

<code class="hljs lasso has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">hadoop dfs <span class="hljs-attribute" style="box-sizing: border-box;">-chmod</span> <span class="hljs-attribute" style="box-sizing: border-box;">-R</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">777</span> /tmp</code>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章