Database Reference
In-Depth Information
root 5 2 0 13:48 ? 00:00:00 [migration/0]
root 6 2 0 13:48 ? 00:00:00 [watchdog/0]
root 7 2 0 13:48 ? 00:00:00 [migration/1]
root 8 2 0 13:48 ? 00:00:00 [migration/1]
root 9 2 0 13:48 ? 00:00:02 [ksoftirqd/1]
This example takes input from STDIN, which is sourced from a full-process listing. The Hadoop file system put
command places the contents in list.txt on HDFS. The Hadoop file system cat command then dumps the contents of
the list.txt file and the Linux head command is used to limit the output to the first 10 lines.
The Mv Command
The mv command allows files to be moved from a source to a destination, but not across a file system:
[hadoop@hc1nn tmp]$ hdfs dfs -ls /tmp/flume/agent*
Found 1 items
-rw-r--r-- 2 hadoop hadoop 1343 2014-07-26 20:09 /tmp/flume/agent1.cfg
Found 1 items
-rw-r--r-- 2 hadoop hadoop 1483 2014-07-26 20:09 /tmp/flume/agent1.cfg.nl
Found 1 items
-rw-r--r-- 2 hadoop hadoop 1343 2014-07-26 20:19 /tmp/flume/agent2.cfg
[hadoop@hc1nn tmp]$ hdfs dfs -mv /tmp/flume/agent2.cfg /tmp/flume/agent3.cfg
[hadoop@hc1nn tmp]$ hdfs dfs -ls /tmp/flume/agent*
Found 1 items
-rw-r--r-- 2 hadoop hadoop 1343 2014-07-26 20:09 /tmp/flume/agent1.cfg
Found 1 items
-rw-r--r-- 2 hadoop hadoop 1483 2014-07-26 20:09 /tmp/flume/agent1.cfg.nl
Found 1 items
-rw-r--r-- 2 hadoop hadoop 1343 2014-07-26 20:19 /tmp/flume/agent3.cfg
This example shows that the HDFS file agent2.cfg has been moved to the file agent3.cfg.
The Tail Command
You can use the Hadoop file system tail command to dump the end of the file to STDOUT. Adding the -f switch
( tail -f ) enables you to continuously dump the contents of a file as it changes. The example that follows dumps the
end of the HDFS-based file list.txt.
[hadoop@hc1nn tmp]$ hdfs dfs -tail /tmp/ps/list.txt
0 ? 00:00:00 pam: gdm-password
root 4494 1348 0 14:00 ? 00:00:00 sshd: hadoop [priv]
hadoop 4514 4494 0 14:01 ? 00:00:01 sshd: hadoop@pts/0
hadoop 4515 4514 0 14:01 pts/0 00:00:00 -bash
 
Search WWH ::




Custom Search