0% found this document useful (0 votes)
23 views6 pages

MongoDB & Hadoop Commands

The document provides a list of MongoDB and HDFS commands for database and file system management. Key MongoDB commands include displaying the current database, creating collections, and deleting databases. HDFS commands cover starting services, managing files and directories, and checking file sizes and modification times.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views6 pages

MongoDB & Hadoop Commands

The document provides a list of MongoDB and HDFS commands for database and file system management. Key MongoDB commands include displaying the current database, creating collections, and deleting databases. HDFS commands cover starting services, managing files and directories, and checking file sizes and modification times.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MongoDB commands

• db; - display the name of the current database


• Show dbs; - list of databases
• [Link](); - to delete current database
• Use mydb; - to switch mydb database
• [Link](“Student”); - to create collection
• Show collections; - lists the collection
• [Link](); - to delete the collection
• [Link](); - display current version of MongoDB server
• [Link](); - displays the statistics that reflects the use state of DB
• [Link](); - displays list of commands
HDFS basic commands
[Link] start the Hadoop services
/[Link]

[Link] check the Hadoop services


Jps

[Link] list all the file.


/hdfs dfs -ls /

[Link] create a directory


hdfs dfs -mkdir /directoryname

[Link] creates an empty file


/hdfs dfs -touchz /directoryname/[Link]

[Link] copy files/folders from local file system to hdfs store.


bin/hdfs dfs -copyFromLocal ../Desktop/[Link]
/directoryname
(OR)
bin/hdfs dfs -put ../Desktop/[Link] /
directoryname

[Link] print file contents


/hdfs dfs -cat / directoryname /[Link] ->
[Link] copy files/folders from hdfs store to local file system
/hdfs dfs -copyToLocal / directoryname
../Desktop/hero
(OR)
/hdfs dfs -get / directoryname /[Link]
../Desktop/hero

[Link] file from local to hdfs


/hdfs dfs -moveFromLocal
../Desktop/[Link] / directoryname

10. copy files within hdfs


/hdfs dfs -cp / directoryname / directoryname
_copied

11. move files within hdfs.


/hdfs dfs -mv / directoryname /[Link] /
directoryname _copied

12. deletes a file from HDFS


/hdfs dfs -rmr / directoryname _copied ->
13. To give the size of each file in directory.
bin/hdfs dfs -du / directoryname

14. To give the last modified time of directory or path


/hdfs dfs -stat / directoryname

15. check out the list of dfs commands


/hdfs dfs

You might also like