2017-05-09 16 views
0

對於我的單元測試,我在筆記本電腦上運行帶有配置單元上下文的本地火花。在啓動時,它會創建兩個目錄的臨時文件,一個/var下,一個/tmp下:從/ var和/ tmp目錄重定向嵌入式配置單元

... INFO SessionState: Created local directory: /var/folders/h3/... 
... INFO SessionState: Created HDFS directory: /tmp/hive/<username>/... 

這些文件夾由org.apache.hadoop.hive.ql.session.SessionState類創建。

爲了避免觸發某些本地安全服務,我需要將這些目錄重定向到不同的文件夾,例如, /Users/<username>/safe/

如何覆蓋這些默認設置以打開指定路徑下的臨時文件夾?

+0

我認爲這是'spark.sql.warehouse.dir'。請看看參數。你可以使用'SparkSession.config()'設置它# – philantrovert

+0

@philantrovert nope :( –

回答

0

在獨立蜂巢,SessionState有一些配置參數,從hive-site.xml所有可設置:

SCRATCHDIR("hive.exec.scratchdir", "/tmp/hive", 
    "HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. " + 
    "For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/<username> is created, " + 
    "with ${hive.scratch.dir.permission}."), 

LOCALSCRATCHDIR("hive.exec.local.scratchdir", 
    "${system:java.io.tmpdir}" + File.separator + "${system:user.name}", 
    "Local scratch space for Hive jobs"), 

DOWNLOADED_RESOURCES_DIR("hive.downloaded.resources.dir", 
    "${system:java.io.tmpdir}" + File.separator + "${hive.session.id}_resources", 
    "Temporary local directory for added resources in the remote file system."), 

HIVEHISTORYFILELOC("hive.querylog.location", 
    "${system:java.io.tmpdir}" + File.separator + "${system:user.name}", 
    "Location of Hive run time structured log file") 

我不熟悉星火究竟如何嵌入蜂巢,但我敢肯定有一個hive-site.xml(一鏈接是測試conf),這是控制值爲hive.exec.scratchdir,hive.exec.local.scratchdir和其他。