㈠ 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里输入会报错的