`
小网客
  • 浏览: 1241307 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

[综合]Apache Hadoop 2.2.0命令行参考手册[翻译]

 
阅读更多

概述

所有的hadoop命令都是有 bin/hadoop调用执行的,执行hadoop脚本没有任何参数的时候他会输出所有命令的描述信息。

用法:hadoop [--config confdir] [COMMAND] [GENERIC_OPTIONS] [COMMAND_OPTIONS]

hadoop有个输入选项解析框架可以利用在运行class的时候来解析参数

COMMAND_OPTION Description
--config confdir Overwrites the default Configuration directory. Default is $HADOOP_HOME/conf.
GENERIC_OPTIONS COMMAND_OPTIONS The common set of options supported by multiple commands. Various commands with their options are described in the following sections. The commands have been grouped into User Commands and Administration Commands.

 

通用选项

dfsadmin, fs, fsck, job and fetchdt都支持下属选项所有的。应用程序需要实现Tool接口然后才能支持通用选项解析。

GENERIC_OPTION Description
-conf <configuration file> Specify an application configuration file.
-D <property>=<value> Use value for given property.
-jt <local> or <jobtracker:port> Specify a job tracker. Applies only to job.
-files <comma separated list of files> Specify comma separated files to be copied to the map reduce cluster. Applies only to job.
-libjars <comma seperated list of jars> Specify comma separated jar files to include in the classpath. Applies only to job.
-archives <comma separated list of archives> Specify comma separated archives to be unarchived on the compute machines. Applies only to job.

 

用户命令

hadoop集群用户基于命令是非常方便的。

 

archive:

创建一个hadoop归档,更多信息可以在hadoop归档中查找。

用法:hadoop archive -archiveName NAME <src>* <dest>

COMMAND_OPTION Description
-archiveName NAME Name of the archive to be created.
src Filesystem pathnames which work as usual with regular expressions.
dest Destination directory which would contain the archive.

 

distcp:

循环拷贝文件和目录,详情可以在hadoop的DistCp 指南中查看。

用法:hadoop distcp <srcurl> <desturl>

COMMAND_OPTION Description
srcurl Source Url
desturl Destination Url

 

fs:

用法:hadoop fs [GENERIC_OPTIONS] [COMMAND_OPTIONS]

不赞成使用,已经被dfs和hdfs替代

运行一个文件系统的客户端,COMMAND_OPTIONS 变量的值可以参考文件系统shell指南

 

fsck:

运行一个hdfs系统检查工具更多信息参考fsck

用法:hadoop fsck [GENERIC_OPTIONS] <path> [-move | -delete | -openforwrite] [-files [-blocks [-locations | -racks]]]

COMMAND_OPTION Description
path Start checking from this path.
-move Move corrupted files to /lost+found
-delete Delete corrupted files.
-openforwrite Print out files opened for write.
-files Print out files being checked.
-blocks Print out block report.
-locations Print out locations for every block.
-racks Print out network topology for data-node locations.

 

fetchdt:

从namenode上获取标示字符串,更多信息参考fetchdt

用法:hadoop fetchdt [GENERIC_OPTIONS] [--webservice <namenode_http_addr>] <path>

COMMAND_OPTION Description
fileName File name to store the token into.
--webservice https_address use http protocol instead of RPC

jar

运行一个jar文件,用户可以在此jar中实现具体的Map Reduce 业务

用法:hadoop jar <jar> [mainClass] args...

streaming job也可以通过此方式执行,详情可以参考流应用例子,同时wordcount例子也是这样的方式,也可以参考

 

job

此命令可以跟Map Reduce的job交互

用法:

 

 hadoop job [GENERIC_OPTIONS] [-submit <job-file>] | [-status <job-id>] | [-counter <job-id> <group-name> <counter-name>] | [-kill <job-id>] | [-events <job-id> <from-event-#> <#-of-events>] | [-history [all] <jobOutputDir>] | [-list [all]] | [-kill-task <task-id>] | [-fail-task <task-id>] | [-set-priority <job-id> <priority>]

 

COMMAND_OPTION Description
-submit job-file Submits the job.
-status job-id Prints the map and reduce completion percentage and all job counters.
-counter job-id group-namecounter-name Prints the counter value.
-kill job-id Kills the job.
-events job-id from-event-##-of-events Prints the events' details received by jobtracker for the given range.
-history [all]jobOutputDir Prints job details, failed and killed tip details. More details about the job such as successful tasks and task attempts made for each task can be viewed by specifying the [all] option.
-list [all] Displays jobs which are yet to complete. -list all displays all jobs.
-kill-task task-id Kills the task. Killed tasks are NOT counted against failed attempts.
-fail-task task-id Fails the task. Failed tasks are counted against failed attempts.
-set-priority job-id priority Changes the priority of the job. Allowed priority values are VERY_HIGH, HIGH, NORMAL, LOW, VERY_LOW

pipes:

运行pipes任务用法如下:

 

 hadoop pipes [-conf <path>] [-jobconf <key=value>, <key=value>, ...] [-input <path>] [-output <path>] [-jar <jar file>] [-inputformat <class>] [-map <class>] [-partitioner <class>] [-reduce <class>] [-writer <class>] [-program <executable>] [-reduces <num>]

 

COMMAND_OPTION Description
-conf path Configuration for job
-jobconf key=valuekey=value, ... Add/override configuration for job
-input path Input directory
-output path Output directory
-jar jar file Jar filename
-inputformat class InputFormat class
-map class Java Map class
-partitioner class Java Partitioner
-reduce class Java Reduce class
-writer class Java RecordWriter
-program executable Executable URI
-reduces num Number of reduces

queue:

此命令可以跟hadoop job的队列交互

用法:

 

hadoop queue [-list] | [-info <job-queue-name> [-showJobs]] | [-showacls]

 

COMMAND_OPTION Description
-list Gets list of Job Queues configured in the system. Along with scheduling information associated with the job queues.
-info job-queue-name [-showJobs] Displays the job queue information and associated scheduling information of particular job queue. If -showJobs options is present a list of jobs submitted to the particular job queue is displayed.
-showacls Displays the queue name and associated queue operations allowed for the current user. The list consists of only those queues to which the user has access.

 

version:

输出hadoop的版本信息,使用方式如下:

 

 hadoop version 

 

 

CLASSNAME:

hadoop脚本可以执行任意类,用法如下:

 

hadoop CLASSNAME
运行classname的那个类

 

 

classpath:

输出依赖lib,用法如下:

 

hadoop classpath
  

 

管理员命令

hadoop集群管理员可以基于管理员命令很好的管理集群

 

balancer:

运行一个集群均衡工具管理员可以执行 Ctrl-C去停止这个操作,用法如下:

 

hadoop balancer [-threshold <threshold>]

 

COMMAND_OPTION
Description
-threshold threshold Percentage of disk capacity. This overwrites the default threshold.

daemonlog

为每个守护进程设置或查看日志级别,用法如下:

 

hadoop daemonlog -getlevel <host:port> <name> Usage: hadoop daemonlog -setlevel <host:port> <name> <level>
COMMAND_OPTION Description
-getlevel host:port name Prints the log level of the daemon running at host:port. This command internally connects to http://host:port/logLevel?log=name
-setlevel host:port name level Sets the log level of the daemon running at host:port. This command internally connects to http://host:port/logLevel?log=name

 

 

datanode:

启动一个datanode,用法如下:

 

 hadoop datanode [-rollback]
COMMAND_OPTION Description
-rollback Rollsback the datanode to the previous version. This should be used after stopping the datanode and distributing the old hadoop version.

 

 

dfsadmin :

启动一个hdfs 管理客户端,用法如下:

 

 hadoop dfsadmin [GENERIC_OPTIONS] [-report] [-safemode enter | leave | get | wait] [-refreshNodes] [-finalizeUpgrade] [-upgradeProgress status | details | force] [-metasave filename] [-setQuota <quota> <dirname>...<dirname>] [-clrQuota <dirname>...<dirname>] [-restoreFailedStorage true|false|check] [-help [cmd]]

 

COMMAND_OPTION Description
-report Reports basic filesystem information and statistics.
-safemode enter / leave / get / wait Safe mode maintenance command. Safe mode is a Namenode state in which it  
1. does not accept changes to the name space (read-only)  
2. does not replicate or delete blocks.  
Safe mode is entered automatically at Namenode startup, and leaves safe mode automatically when the configured minimum percentage of blocks satisfies the minimum replication condition. Safe mode can also be entered manually, but then it can only be turned off manually as well.
-refreshNodes Re-read the hosts and exclude files to update the set of Datanodes that are allowed to connect to the Namenode and those that should be decommissioned or recommissioned.
-finalizeUpgrade Finalize upgrade of HDFS. Datanodes delete their previous version working directories, followed by Namenode doing the same. This completes the upgrade process.
-upgradeProgress status / details / force Request current distributed upgrade status, a detailed status or force the upgrade to proceed.
-metasave filename Save Namenode's primary data structures to filename in the directory specified by hadoop.log.dir property. filename is overwritten if it exists. filename will contain one line for each of the following 
1. Datanodes heart beating with Namenode 
2. Blocks waiting to be replicated 
3. Blocks currrently being replicated 
4. Blocks waiting to be deleted 
-setQuota quotadirname...dirname Set the quota quota for each directory dirname. The directory quota is a long integer that puts a hard limit on the number of names in the directory tree. Best effort for the directory, with faults reported if  
1. N is not a positive integer, or  
2. user is not an administrator, or  
3. the directory does not exist or is a file, or  
4. the directory would immediately exceed the new quota.  
-clrQuotadirname...dirname Clear the quota for each directory dirname. Best effort for the directory. with fault reported if  
1. the directory does not exist or is a file, or  
2. user is not an administrator. It does not fault if the directory has no quota.
-restoreFailedStorage true / false / check This option will turn on/off automatic attempt to restore failed storage replicas. If a failed storage becomes available again the system will attempt to restore edits and/or fsimage during checkpoint. 'check' option will return current setting.
-help [cmd] Displays help for the given command or all commands if none is specified.

 

mradmin:

运行一个mr管理客户端,用法如下:

 

hadoop mradmin [ GENERIC_OPTIONS ] [-refreshQueueAcls]

 

COMMAND_OPTION Description
-refreshQueueAcls Refresh the queue acls used by hadoop, to check access during submissions and administration of the job by the user. The properties present in mapred-queue-acls.xml is reloaded by the queue manager.

 

jobtracker:

运行一个MapReduce job tracker用法如下:

 

hadoop jobtracker [-dumpConfiguration]
COMMAND_OPTION Description
-dumpConfiguration Dumps the configuration used by the JobTracker alongwith queue configuration in JSON format into Standard output used by the jobtracker and exits.

 

 

namenode:

运行以namenode用法如下:

hadoop namenode [-format] | [-upgrade] | [-rollback] | [-finalize] | [-importCheckpoint]
COMMAND_OPTION Description
-format Formats the namenode. It starts the namenode, formats it and then shut it down.
-upgrade Namenode should be started with upgrade option after the distribution of new hadoop version.
-rollback Rollsback the namenode to the previous version. This should be used after stopping the cluster and distributing the old hadoop version.
-finalize Finalize will remove the previous state of the files system. Recent upgrade will become permanent. Rollback option will not be available anymore. After finalization it shuts the namenode down.
-importCheckpoint Loads image from a checkpoint directory and save it into the current one. Checkpoint dir is read from property fs.checkpoint.dir

 

secondarynamenode:

运行一个hdfs的secondary namenode用法如下:

 hadoop secondarynamenode [-checkpoint [force]] | [-geteditsize]
COMMAND_OPTION Description
-checkpoint [-force] Checkpoints the Secondary namenode if EditLog size >= fs.checkpoint.size. If -force is used, checkpoint irrespective of EditLog size.
-geteditsize Prints the EditLog size.

 

tasktracker:

运行一个mr的tasktracker节点,用法如下:

hadoop tasktracker

 

 
 

 

 

 

 

0
0
分享到:
评论

相关推荐

    Hadoop2.2.0安装配置手册

    Hadoop2.2.0安装配置手册,新手安装和配置

    Hadoop2.2.0安装配置手册!完全分布式Hadoop集群搭建过程

    Hadoop2.2.0安装配置手册!完全分布式Hadoop集群搭建过程 按照文档中的操作步骤,一步步操作就可以完全实现hadoop2.2.0版本的完全分布式集群搭建过程

    Hadoop 2.2.0 配置文件

    Hadoop 2.2.0 是 Apache Hadoop 的一个关键版本,它包含了众多改进和优化,使得这个分布式计算框架在处理大数据集时更加高效和稳定。在这个配置文件中,我们将会探讨Hadoop 2.2.0 在4台CentOS 6.4系统上运行所需的...

    hadoop2.2.0

    Hadoop是Apache软件基金会开发的一个开源框架,专门设计用于处理和存储大规模数据。Hadoop 2.2.0是其一个重要版本,它在Hadoop 1.x的基础上进行了大量的优化和改进,增强了系统的稳定性和性能,为大数据处理提供了更...

    hadoop2.2.0-linux-64bit安装包和源码包

    Hadoop 2.2.0 是Apache Hadoop的一个稳定版本,它包含了大量对Hadoop生态系统(包括HDFS、MapReduce、YARN等)的改进和支持。这一版本提供了更好的性能、安全性和可扩展性,适用于处理大规模数据集。 #### 1. HDFS ...

    Hadoop2.2.0安装配置手册!完全分布式Hadoop集群搭建过程.

    Hadoop2.2.0安装配置手册!完全分布式Hadoop集群搭建过程.

    hadoop2.2.0的64位安装包

    首先,你需要从Apache Hadoop官方网站下载hadoop-2.2.0的源代码压缩包,这通常以`.tar.gz`或`.zip`格式提供。解压后,进入源代码目录,准备编译环境。确保系统已安装了必要的依赖项,如GCC编译器、Java开发套件(JDK...

    Hadoop 2.2.0 64位native文件(重编译)

    Hadoop 2.2.0 是一个重要的分布式计算框架,主要设计用于处理和存储大量数据。这个64位的native文件是Hadoop针对64位Linux操作系统编译的一组库文件,它们对于Hadoop在Linux环境下高效运行至关重要。在Hadoop的源...

    Hadoop2.2.0集群搭建手册

    Hadoop2.2.0版本 - 虚拟机VMWare - Linux(ubuntu) ,多节点伪分布环境搭建详细操作手册,可以直接用于完全分布。每一步都有自己详细操作记录和相关说明,几夜风雨的辛劳搭建和测试。 此操作手册搭建的集群详细说明: ...

    hadoop2.2.0/2.6.0/2.7.0/2.7.1 64位安装包

    hadoop2.2.0/2.6.0/2.7.0/2.7.1 64位安装包。

    CentOS6.5x64下安装19实体节点Hadoop2.2.0集群配置指南

    资源名称:CentOS 6.5 x64下安装19实体节点Hadoop 2.2.0集群配置指南内容简介: CentOS 6.5 x64下安装19实体节点Hadoop 2.2.0集群配置指南主要讲述的是CentOS 6.5 x64下安装19实体节点Hadoop 2.2.0集群配置指南;...

    hadoop补丁

    windows下hadoop-2.2.0命令行传参出错补丁 The system cannot find the batch label specified - make_command_arguments

    hadoop-2.2.0依赖的jar包

    Hadoop 2.2.0版本是Hadoop发展过程中的一个重要里程碑,引入了许多改进和新特性,增强了系统的稳定性和性能。本篇文章将深入探讨Hadoop 2.2.0开发过程中依赖的jar包及其重要性。 首先,我们要理解的是,Java ...

    Hadoop2.2.0安装配置及实例教程入门宝典

    2. **下载Hadoop**:从Apache官网获取Hadoop2.2.0的tar.gz文件,并解压到指定目录,如/opt/hadoop。 3. **配置环境变量**:在系统环境变量配置文件(如~/.bashrc)中添加HADOOP_HOME,并设置PATH。 4. **配置Hadoop*...

    Hadoop2.2.0集群安装

    Hadoop2.2.0完全分布式集群平台安装设置 HDFS HA架构: 1、先设定电脑的IP为静态地址: 2、设置各个主机的hostname 3、在所有电脑的/etc/hosts添加以下配置: 4、设置SSH无密码登陆 5、下载解压hadoop-2.2.0.tar.gz...

    hadoop2.2.0 64位 native库centos64

    WARN org.apache.hadoop.util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable 在网上查了一下发现Apache官网提供的是32位编译的,在64...

    Hadoop2.2.0环境测试详细傻瓜说明

    标题中的“Hadoop2.2.0环境测试详细傻瓜说明”表明了本文将要讨论的是关于Hadoop 2.2.0版本的环境配置和简单的应用测试,特别是针对新手的指南。描述中的“配置以后的一些测试,wordcount啥的,有信心的就不用下了”...

    hadoop2.2.0 eclipse-kepler 编译插件

    hadoop2.2.0 eclipse插件-重新编译过。hadoop用的是hadoop2.2.0版本,eclipse用的是 eclipse-kepler。 插件 eclipse-kepler

Global site tag (gtag.js) - Google Analytics