Tuesday, 21 January 2014

How does a Single file get stored in HDFS

Here is a neat diagram showing how file is split and stored in HDFS


MapReduce Architecture !

Hello,

I feel better than reading books, Images speaks louder !!
Just have a complete look and then study from Hadoop Definitive Guide.


Hadoop Basic Commands

Hadoop Commands
No
Command
Command Usage
Description
1
cat
hadoop dfs -cat <path>
prints the file contents
2
chgrp
hadoop dfs -chgrp [-R] GROUP URI [URI …]
Change group association of files. With -R, make the change recursively through the directory structure. The user must be the owner of files, or else a super-user.
3
chmod
hadoop dfs -chmod [-R] <MODE[,MODE]... | OCTALMODE> URI
4
chown
hadoop dfs -chown [-R] [OWNER][:[GROUP]] URI [URI ]
5
copyFromLocal
hadoop dfs -copyFromLocal <localsrc> URI
6
copyToLocal
hadoop dfs -copyToLocal [-ignorecrc] [-crc] URI
7
count
hadoop dfs -count [-q] <paths>
8
cp
hadoop dfs -cp URI [URI …] <dest>
9
du
hadoop dfs -du URI [URI …]
Get size of each file in dir
10
dus
hadoop dfs -dus URI [URI …]
Gets total file size
11
expunge
hadoop dfs -expunge
Empty the Trash
12
get
hadoop dfs -get [-ignorecrc] [-crc] <src> <localdst>
13
getmerge
hadoop dfs -getmerge <src> <localdst> [addnl]
Takes a source directory and a destination file as input and concatenates files in src into the destination local file. Optionally addnl can be set to enable adding a newline character at the end of each file
14
ls
hadoop dfs -ls path
15
lsr
hadoop dfs -lsr <args>
Recursive version of ls. Similar to Unix ls -R
16
mkdir
17
moveFromLocal
18
moveToLocal
19
mv
20
put
21
rm
22
rmr
hadoop dfs -rmr [-skipTrash] URI [URI …]
23
setrep
hadoop dfs -setrep [-R] <path>
Changes the replication factor of a file. -R option is for recursively increasing the replication factor of files within a directory.
24
stat
hadoop dfs -stat URI [URI …]
25
tail
hadoop dfs -tail [-f] URI
Displays last kilobyte of the file to stdout. -f option can be used as in Unix
26
test
hadoop dfs -test -[ezd] URI
e check to see if the file exists. Return 0 if true.
z check to see if the file is zero length. Return 0 if true.
-d check to see if the path is directory. Return 0 if true
27
text
hadoop dfs -text <src>
Takes a source file and outputs the file in text format
28
touchz
hadoop dfs -touchz URI [URI …]
Create a file of zero length.
29
jar
hadoop jar
The hadoop jar command runs a JAR file.
30
fsck
hadoop fsck
HDFS supports the fsck command to check for various inconsistencies. It it is designed for reporting problems with various files, for example, missing blocks for a file or under-replicated blocks.
31
job
hadoop job -list


Basic Linux Commands

Commands in linux
Command
Meaning
ls
Will list the items in files
ll
Will list the items vertically
cat
Will help to read the file mentioned in command.
cd ..
Will one directory back
diff
print line difference in files. Not the entire string
grep
grep 'abc ' /chitrank/txt . Search abc text in txt files
grep -v
grep -v 'abc' /chitrank/txt . Not condition of above grep
grep -i
ingnore case
grep -w
to search on given word
cat /chitrank/input/*  | grep -i 'a'
Grep commands with pipe
cat /chitrank/input/*  | grep -l 'a'
to list the file with given word
grep --color 'a'
Will show matches in color
mkdir
will make directory
cd /folder/file
will move to that file directory
awk
find or replace text
chmod
change the access of files or directory // fullacess chmod ug+rwx file.txt  // revoke chmod g-rwx file.txt // give access chmod -R ug+rwx file.txt
chown
change user and group ownership
adduser
add a new user
echo
display message on console
cnp
comapre two files
mv
move file
passwd
modify user password
pwd
print working dir
tar
to
useradd
add new user account
nano
to open editor and make files
sort
to sort file
unzip
unzip a flie
top
find the programs running
kill
kill a task
man
diplays main page
tail
print last lines in file
less
prints less number of outputs
su
switch to other user. Root can switch widout password
yum
to install apche using yum
rpm
to install apche using rpm
date
prints date
get
get file from other loc
put
put file to other loc
find
find files using file name
ssh
remote accesss
cut
cut some part from files
tr
replaces some pattern and changes file output format // tr -s '|' ',' < Ret_MediaTP | cut -f1-28 -d, > MediaTp__Ret.txt
To find File name
find . -type f -printf "%f\n" > /home/hduser1/chitrank/freshseq