高效使用hive

來源:互聯網
上載者:User

標籤:hive   hadoop   shell   

工作中經常使用hive,熟練使用hvie的配置參數可以更加高效的使用Hive

Hive option:

        hive -f   script.hql : 從檔案script.hql中的讀取hql執行

        hive -e ‘select * from xxx‘: 啟動hive時指定執行的hql,此種方式hql會先經過shell解釋,然後再用hive執行,因此需要注意hql中被shell轉義的字元

        hive -S :安靜模式執行hql,這樣標準輸出中只有hql執行的結果,沒有進度等資訊,便於對結果進行過濾

        hive -i  .hiverc  :指定啟動的hiverc檔案

        hive --help:顯示協助資訊

        hive --serverice:啟動hive service,可用的service: beeline cli help hiveserver2 hiveserver hwi jar lineage metastool rcfilecat

        hive --service service_name --help: 顯示hive service的協助資訊

        hive --define/-d/--hivevar:命令列傳遞hive變數

 Hive set  var Option:

        可用在hive命令列中查看hive配置參數和所有的變數,hive中的變數有不同的命名空間和存取權限:

        hivevar:可讀/可寫:使用者自訂變數

        hiveconf: 可讀/可寫:hive想配置屬性

        system: 可讀/可寫:Java定義配置屬性

        env: 只可讀: Shell環境變數

       set; 顯示hiveconf, hivevar,env,system中變數

       set hivevar/env/system:var_name 顯示具體某一個空間中的某個變數

      set -v : 顯示所有變數,包括hadoop相關配置

常用hive配置:

       set hive.cli.print.header=true; 輸出資料行名

       set hive.cli.print.current.db=true; 輸出current db

        set hive.mapred.mode=nostrict; 使用nostrict模式,允許order by 而不limit

        set hive.exec.mode.local.auto=true; 盡量以高效地本地模式執行hql


 hive  ql 注釋:  --command

 hive執行hdfs cmd: dfs command, 類似hadoop fs command

 hive執行shell:!shell_cmd

  hive 曆史命令:.hivehistory

  hive預設配置: hivedefault.xml.template

  hive log配置:hive-log4j.properties, 更改hive.root.logger=DEBUG, console可將調試資訊輸出到console 


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.