Few Important hadoop commands
- To check the block size and replication factor of a file:
- hadoop fs -stat %o
- hadoop fs -stat %r
- How to create a file with different block size and replication factor of a file:
- hadoop fs -Ddfs.block.size <64mb>
64mb> - hadoop fs -Ddfs.replication.factor 2
- How to change the block size and replication factor of a existing file:
- hadoop dfs -setrep -w 4 -R
- there are two ways:
- either change in hdfs-site.xml & restart the cluster
- or, copy the files using distcp to another path with new block size & delete the old ones as: hadoop distcp -Ddfs.block.size=XX /path/to/old/files /path/to/new/files/with/larger/block/sizes.
- get multiple files under a directory: hadoop fs -getmerge
- Start hadoop ecosystems:
- start-dfs.sh, stop-dfs.sh and start-yarn.sh, stop-yarn.sh can be done through the master.
- or, hadoop-daemon.sh namenode/datanode and yarn-deamon.sh resourcemanager Need to do on individual nodes.
- To View the FSImage to Text: hdfs oiv -p XML -i fsimage_0000000000732482646 -o /data/fsimage.xml
- To View the FSImage to Via Web : hdfs oiv -i fsimage_0000000000732482646 ; then connect to following hdfs dfs -lsr webhdfs://127.0.0.1:5978/ or curl -i http://127.0.0.1:5978/webhdfs/v1/?op=liststatus
- To View the Edit logs: hdfs oev -i
-p xml -o
9. hadoop balancer
10. To get the Dead Node: hdfs dfsadmin -report -dead
11. To check the HDFS usage: hdfs dfs -df -h
12. To cleanUp the trash: hdfs dfs -expunge
Comments