Assume that the installation directory for Hadoop is Hadoop_home/home/admin/hadoop.
Start and close
Start Hadoop
1. Enter the Hadoop_home directory.
2. Execute SH bin/start-all.sh
Turn off Hadoop
1. Enter the Hadoop_home directory.
2. Execute SH bin/stop-all.sh
File operations
Hadoop uses HDFs, which is similar in functionality to the disk systems we use. and wildcard characters such as * are supported.
View a list of files
View the files in the/user/admin/aaron directory in HDFs.
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs-ls/user/admin/aaron
In this way, we find the files in the/user/admin/aaron directory in HDFs.
We can also list all the files in the/user/admin/aaron directory in HDFs (including the files under subdirectories).
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs-lsr/user/admin/aaron
Create a file directory
View the/user/admin/aaron directory in HDFs and create a new directory called Newdir.
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs-mkdir/user/admin/aaron/newdir
deleting files
Delete a file named Needdelete in the/user/admin/aaron directory in HDFs
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs-rm/user/admin/aaron/needdelete
Delete the/user/admin/aaron directory in HDFs and all files in that directory
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs-rmr/user/admin/aaron
Uploading files
Upload a native/home/admin/newfile file into the/user/admin/aaron directory in HDFs
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs–put/home/admin/newfile/user/admin/aaron/
Download file
Download the NewFile file in the/user/admin/aaron directory in HDFs to the native/home/admin/newfile
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs–get/user/admin/aaron/newfile/home/admin/newfile
View Files
We can view the files directly in HDFs, and the functions are similar to those of cat
View NewFile files in the/user/admin/aaron directory in HDFs
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop fs–cat/home/admin/newfile
MapReduce Job operation
Submit a MapReduce Job
In principle, all of the mapreduce jobs in Hadoop are a jar package.
Run a/home/admin/hadoop/job.jar mapreduce job
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop jar/home/admin/hadoop/job.jar [jobmainclass] [Jobargs]
Kill a running job
Suppose job_id is: job_201005310937_0053
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop job-kill job_201005310937_0053
more commands for Hadoop
The operations commands described above for Hadoop are our most common. If you want to learn more, you can get instructions for the command in the following ways.
1. Enter the Hadoop_home directory.
2. Execute SH bin/hadoop
We can see instructions for more commands:
Copy CodeThe code is as follows:
Usage:hadoop [--config Confdir] COMMAND
Where COMMAND is one of:
Namenode-format Format the DFS filesystem
Secondarynamenode Run the DFS secondary Namenode
Namenode Run the DFS namenode
Datanode Run a DFS datanode
Dfsadmin Run a DFS admin client
Fsck Run a DFS filesystem checking utility
FS Run a generic filesystem user Client
Balancer run a cluster balancing utility
Jobtracker run the MapReduce job Tracker node
Pipes run a pipes job
Tasktracker Run a MapReduce task Tracker node
Job Manipulate MapReduce Jobs
Queue get information regarding Jobqueues
Version Print the version
Jar Run a jar file
Distcp Copy file or directories recursively
Archive-archivename NAME * Create a Hadoop archive
Daemonlog Get/set The log level for each daemon
Or
CLASSNAME run the class named CLASSNAME
Most commands print help when invoked w/o parameters.
http://www.bkjia.com/PHPjc/327682.html www.bkjia.com true http://www.bkjia.com/PHPjc/327682.html techarticle assume that the installation directory for Hadoop is Hadoop_home/home/admin/hadoop. Start and Shutdown Hadoop 1. Enter the Hadoop_home directory. 2. Execute SH bin/start-all.sh close Hadoop 1. Enter Hadoop_hom ...