對於python,你可以這樣做:
mountName = ' abc '坐騎= (str(我)我dbutils.fs.ls (/ mnt /)]如果“FileInfo (path = ' dbfs: / mnt / + mountName +“/”, name = " + mountName + " /,大小= 0)”坐騎:打印(mountName +“已安裝”)其他:dbutils.fs。山(源= + mountName +“wasbs: / / @ < datalake_name >.blob.core.windows.net/”, mount_point = " / mnt /”+ mountName extra_configs = {" fs.azure.sas。“+ mountName +”。< datalake_name > .blob.core.windows.net”: dbutils.secrets.get (=“< secret_scope >”範圍,鍵= < key_name >)})
你好,
我猜你應該創建一個init腳本,該腳本將運行在集群啟動時。
我問的問題:
https://forums.www.eheci.com/questions/17305/mount-blob-storage-with-init-scripts.html
如果你使用scala湖山創2數據你可以試試這樣的東西
/收集相關的鍵/
var ServicePrincipalID = " "
var ServicePrincipalKey = " "
var DirectoryID = " "
/創建連接配置/
(“fs.azure.account.auth var款=地圖。類型”- >“OAuth”,
“fs.azure.account.oauth.provider。”- >“org.apache.hadoop.fs.azurebfs.oauth2類型。ClientCredsTokenProvider”、“fs.azure.account.oauth2.client。id”- > ServicePrincipalID,
“fs.azure.account.oauth2.client。fs.azure.account.oauth2.client秘密”- > ServicePrincipalKey。”端點”- > DirectoryID)
/ /可選地,您可以添加<目錄名稱>源URI的掛載點。
如果(dbutils.fs.mounts。地圖(mnt = > mnt.mountPoint) .contains (“/ mnt /凡”)){
“已安裝”
其他}{
dbutils.fs。山(源= " / ",掛載點=“/ mnt / extraConfigs =配置)}