導航:首頁 > 文件目錄 > hadoop獲取hdfs文件路徑

hadoop獲取hdfs文件路徑

發布時間:2023-06-16 14:05:55

㈠ hadoop hdfs的默認目錄問題

frostfish425說的是對的!/user/hadoop是安裝目錄,就是說你hadoop相關的配置和代碼都是放在這個位置,這個你自己定就可以了,但是要注意你配置文件和環境變數中的相關配置都要相應的發生改變。而/tmp/hadoop-hadoop/dfs/name是你配置的hdfs目錄,也就是數據存放目錄,在hdfs-site.xml中配置的,當然你也可以改變這個目錄!這個目錄掛載的磁碟要足夠大,不然數據存放不下,你初始化的時候報的這個Storage directory /tmp/hadoop-hadoop/dfs/name has been successfully formatted其實就是在/tmp/hadoop-hadoop/dfs這個目錄下創建了name目錄,意思就是告訴你,數據存放目錄已經創建成功了!

㈡ 怎麼查看hdfs linux 路徑

可以fdisk -l 看到 但是它本身是自己的文件系統 就是hdfs 你從linux本地是看不到的 想看裡面的文件可以使用如下命令 hadoop fs -ls

㈢ hadoop程序怎麼訪問hdfs路徑

先用hdfsGetPathInfo 得到一個hdfsFileInfo類型的結構體, get_real_path(dsh, s, real_path); hdfsFileInfo * pt_hdfs_file_info = hdfsGetPathInfo(hdfs,real_path);// 這個結構體中有個kind屬性,就是來區分是文件還是目錄 typedef struct
~如果你認可我的回答,請及時點擊【採納為滿意回答】按鈕
~~手機提問的朋友在客戶端右上角評價點【滿意】即可。
~你的採納是我前進的動力
~~O(∩_∩)O,記得好評和採納,互相幫助,謝謝。

㈣ hdfs怎麼查看目錄路徑

用ls命令, 如果返回一行說明是文件,如果多行則表示目錄
hadoop fs -ls $path | grep $path | wc -l

㈤ 如何獲取文件在hdfs中的路徑

如何獲取文件在hdfs中的路徑
hadoop有提供相應的腳本去驗證文件目錄是否存在的:

-bash-3.2$ hadoop fs -help
...
-test -[defsz] <path>: Answer various questions about <path>, with result via exit status.
-d return 0 if <path> is a directory.
-e return 0 if <path> exists.
-f return 0 if <path> is a file.
-s return 0 if file <path> is greater than zero bytes in size.
-z return 0 if file <path> is zero bytes in size.
else, return 1.

測試的hdfs目錄中:

-bash-3.2$ hadoop fs -ls /user/hive/warehouse/yhd_gmv_month
Found 3 items
drwxr-xr-x - deploy supergroup 0 2014-08-25 11:15 /user/hive/warehouse/yhd_gmv_month/ds=2014-08-24
drwxr-xr-x - deploy supergroup 0 2014-08-26 13:02 /user/hive/warehouse/yhd_gmv_month/ds=2014-08-25
drwxr-xr-x - deploy supergroup 0 2014-08-27 08:09 /user/hive/warehouse/yhd_gmv_month/ds=2014-08-26

檢驗昨天產生的目錄是否產生的shell腳本:

yesterday=$(date -d '-1 day' '+%Y-%m-%d')
hadoop fs -test -e /user/hive/warehouse/yhd_gmv_month/ds=$yesterday
if [ $? -eq 0 ] ;then
echo 'exist'
else
echo 'Error! Directory is not exist'
fi

驗證存在的輸出結果如下:

-bash-3.2$ hadoop fs -test -e /user/hive/warehouse/yhd_gmv_month/ds=$yesterday
if [ $? -eq 0 ] ;then
echo 'exist'
else
echo 'Error! Directory is not exist Or Zero bytes in size'
fi
-bash-3.2$ if [ $? -eq 0 ] ;then
> echo 'exist'
> else
> echo 'Error! Directory is not exist Or Zero bytes in size'
> fi
exist

㈥ hadoop怎麼訪問hdfs路徑

先用hdfsGetPathInfo 得到一個hdfsFileInfo類型的結構體,
get_real_path(dsh, s, real_path);
hdfsFileInfo * pt_hdfs_file_info = hdfsGetPathInfo(hdfs,real_path);//
這個結構體中有個kind屬性,就是來區分是文件還是目錄
typedef struct {
tObjectKind mKind; /* file or directory */
char *mName; /* the name of the file */
tTime mLastMod; /* the last modification time for the file in seconds */
tOffset mSize; /* the size of the file in bytes */
short mReplication; /* the count of replicas */
tOffset mBlockSize; /* the block size for the file */
char *mOwner; /* the owner of the file */
char *mGroup; /* the group associated with the file */
short mPermissions; /* the permissions associated with the file */
tTime mLastAccess; /* the last access time for the file in seconds */
} hdfsFileInfo;

㈦ 關於hdfs的物理存儲路徑問題

我沒用過Hive,但HDFS的存儲機制都是一樣的。
你所謂的物理位置指的是在操作系統中的磁碟路徑?
這個路徑是在Hadoop配置的時候寫在hdfs-site.xml文件的dfs.datanode.data.dir欄位里的,在每個datanode的這個文件夾里存著該節點上存儲的所有數據塊block,以blk_打頭。
dfs.namenode.data.dir指定的文件夾在namenode中則存在元數據。
所以即便你知道這個所謂的物理路徑也沒什麼用,數據都是以block形式存在的,大的數據還由好多個block組成,而且每個block還有副本。

㈧ 查看Hadoop安裝路徑

查看hadoop二進制文件路徑

查看hadoop二進制文件鏈接路徑

由此可知,hadoop安裝目錄為 /usr/local/Cellar/hadoop/3.1.1
而 core-site.xml 、 hdfs-site.xml 等配置文件的存放目錄為
/usr/local/Cellar/hadoop/3.1.1/libexec/etc/hadoop

㈨ hdfs命令查找文件所在路徑

指令
hadoop fsck /user/hadoop/filename -files -blocks -locations -racks
-files 文件分塊信息,
-blocks 在帶-files參數後才顯示block信息
-locations 在帶-blocks參數後才顯示block塊所在datanode的具體IP位置,

-racks 在帶-files參數後顯示機架位置
注意:此命令只能在namenode里輸入,在datanode里輸入會報錯的

閱讀全文

與hadoop獲取hdfs文件路徑相關的資料

熱點內容
美服applestoreid 瀏覽:889
微信數據文件能清嗎 瀏覽:107
圖片編輯到文件里列印怎麼有重影 瀏覽:593
舟山四軸編程培訓哪個學校好 瀏覽:542
沒加別人QQ可以發word文件 瀏覽:51
手機桌面的文件路徑 瀏覽:892
改款新寶來怎麼使用手機app 瀏覽:281
dede工具 瀏覽:507
5g網盟app怎麼下載 瀏覽:486
微信備份老是連接中斷 瀏覽:886
出台多少份文件 瀏覽:380
鞋子怎麼搭配衣服的app 瀏覽:755
文件名使用的通配符的符號是什麼 瀏覽:916
lol分卷文件損壞怎麼辦 瀏覽:276
6分管車螺紋怎麼編程 瀏覽:732
海口農商銀行信用卡app是什麼 瀏覽:770
win10任務欄文件夾我的電腦 瀏覽:14
安卓nba2k18 瀏覽:776
文件夾密碼怎麼修改密碼 瀏覽:271
蘋果數據中心用什麼伺服器 瀏覽:769

友情鏈接