04hive常見屬性設定

2021-09-25 21:04:37 字數 1788 閱讀 5675

16.1.default資料倉儲的最原始位置

是在hdfs上的:/user/hive/warehouse路徑下。
16.2.在倉庫目錄下,沒有對預設的資料庫default建立資料夾。
如果某張表屬於default資料庫,直接在資料倉儲目錄下建立乙個資料夾。
(將hive-default.xml.template如下配置資訊拷貝到hive-site.xml檔案中)

hive.metastore.warehouse.dir

/user/hive/warehouse

location of default database for the warehouse

16.4.配置同組使用者有執行許可權
bin/hdfs dfs -chmod g+w /user/hive/warehouse
17.1.在hive-site.xml檔案中新增如下配置資訊,就可以實現顯示當前資料庫,以及查詢表的頭資訊配置。
hive.cli.print.header

true

hive.cli.print.current.db

true

17.2.重新啟動hive查詢資訊,對比配置前後差異。
修改後會顯示表頭。
18.1.hive的log預設存放在"/tmp/當前使用者名稱/hive.log"目錄下

18.2.修改hive-log4j.properties.template檔名稱為hive-log4j.properties(將template去除掉)

cp hive-log4j.properties.template hive-log4j.properties

18.3.在hive-log4j.properties檔案中修改log存放位置

hive.log.dir=/root/hivedata/logs
19.1.檢視當前所有的配置資訊
set;
19.2.(第一種)配置檔案方式
預設配置檔案:hive-default.xml 

使用者自定義配置檔案:hive-site.xml

注意:使用者自定義配置會覆蓋預設配置。

另外,hive也會讀入hadoop的配置,因為hive是作為hadoop的客戶端啟動的,hive的配置會覆蓋hadoop的配置。

配置檔案的設定對本機啟動的所有hive程序都有效。

19.3.(第二種)命令列引數方式
啟動hive時,可以在命令列新增-hiveconf param=value來設定引數。

例如:bin/hive -hiveconf mapred.reduce.tasks=10;

注意:僅對本次hive啟動有效

檢視引數設定:

set mapred.reduce.tasks;

19.4.(第三種)引數宣告方式
可以在hql中使用set關鍵字設定引數

例如:set mapred.reduce.tasks=100;

注意:僅對本次hive啟動有效。

檢視引數設定

set mapred.reduce.tasks;

19.5.上述三種設定方式的優先順序依次遞增
即"配置檔案 < 命令列引數 < 引數宣告"

注意某些系統級的引數,例如log4j相關的設定,必須用前兩種方式設定,因為那些引數的讀取在會話建立以前已經完成了。

04 常見函式

字元函式 函式結果 大小寫控制函式 lower sql course sql course 大小寫控制函式 upper sql course sql course 字元控制函式 concat hello world helloworld 字元控制函式 substr helloworld 1,5 he...

hive常見命令

clear 清屏 dfs lsr hive 執行dfs命令 show databases 檢視所有資料庫 okdefault time taken 1.693 seconds,fetched 1 row s 我們發現只有乙個default庫 於是我們使用default 資料庫 hive use de...

hive常見命令

hive常用命令 1 進入hive資料庫 hive 2 檢視hive中的所有資料庫 show databases 3 用default資料庫 use default 4 檢視所有的表 show tables 5 查詢表結構 desc mytest 表名 6 查詢表資料 select from myt...