Open liusheng opened 4 years ago
主要记录一些常用的命令和操作,Hadoop新手向。
bin/
hadoop
yarn
hdfs
sbin/
start-all.sh
start-dfs.sh
start-yarn.sh
启动停止集群yarn和hdfs相关服务
sbin/start-all.sh sbin/stop-all.sh sbin/start-yarn.sh sbin/stop-yarn.sh sbin/start-dfs.sh sbin/stop-dfs.sh
如果配置了集群各节点直接的互信,并且在etc/hadoop/workers中配置了配置了workers(通常需要配置DNS,或者在各个节点/etc/hosts中配上集群中所有节点的主机名解析映射),则这些脚本会同步操作集群总所有节点,比如start-all.sh会启动本机的namenode, resourcemanager服务,以及集群中其他节点的datanode, nodemanager服务。
etc/hadoop/workers
/etc/hosts
namenode
resourcemanager
datanode
nodemanager
查看Hadoop相关环境变量
hadoop envvars
检查Hadoop native库的位置和是否可用
hadoop checknative -a
打印hadoop运行时环境的classpath
hadoop classpath
集群使用情况报告
hdfs dfsadmin -report
查看集群Node列表
yarn node -list
进入和退出安全模式
hdfs dfsadmin -safemode enter hdfs dfsadmin -safemode leave
打印当前HDFS集群的网络拓扑
hdfs dfsadmin -printTopology
获取namenode
hdfs getconf -namenodes
hadoop fs -ls / hadoop fs -lsr / #递归打印
hadoop fs -mkdir <patch> #类似于shell下的mkdir -p命令
hadoop fs -put <localfile> <dfs dir>
hadoop fs -get <src> <localdist>
hadoop fs -rm -r <URI>
注:这里只是举例列出几个常见的hadoop文件系统相关的命令,更多命令可以参见官方的文档。
mapred job -list mapred job -status
用于管理Map Reduce作业相关命令,可以通过mapred job --help 查看该命令的更多参数。
mapred job --help
mapred pipes
目前还没接触过这一块,可以通过mapred pipes --help查看更多参数
mapred pipes --help
其中JobHistory Server需要单独启动jobhistory服务才可用。
jobhistory
export HADOOP_ROOT_LOGGER=DEBUG,console
或者在etc/hadoop/log4j.properties中单独配置某个模块的日志level
etc/hadoop/log4j.properties
主要记录一些常用的命令和操作,Hadoop新手向。
1. 脚本命令工具位置
bin/
目录下面,包括hadoop
,yarn
,hdfs
等模块的命令sbin/
目录下面,包括start-all.sh
,start-dfs.sh
,start-yarn.sh
等启动停止服务的脚本2. 集群管理相关命令:
启动停止集群
yarn
和hdfs
相关服务如果配置了集群各节点直接的互信,并且在
etc/hadoop/workers
中配置了配置了workers(通常需要配置DNS,或者在各个节点/etc/hosts
中配上集群中所有节点的主机名解析映射),则这些脚本会同步操作集群总所有节点,比如start-all.sh
会启动本机的namenode
,resourcemanager
服务,以及集群中其他节点的datanode
,nodemanager
服务。查看Hadoop相关环境变量
检查Hadoop native库的位置和是否可用
打印hadoop运行时环境的classpath
集群使用情况报告
查看集群Node列表
进入和退出安全模式
打印当前HDFS集群的网络拓扑
获取namenode
3. 应用相关命令
注:这里只是举例列出几个常见的hadoop文件系统相关的命令,更多命令可以参见官方的文档。
用于管理Map Reduce作业相关命令,可以通过
mapred job --help
查看该命令的更多参数。目前还没接触过这一块,可以通过
mapred pipes --help
查看更多参数4. Hadoop集群几个web面板:
其中JobHistory Server需要单独启动
jobhistory
服务才可用。5. 技巧
或者在
etc/hadoop/log4j.properties
中单独配置某个模块的日志level