MongoDB: windows and linux installation

You can download MongoDB package from below URL : https://www.mongodb.org/downloads

Windows Package : https://www.mongodb.org/dr/fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.0.3-signed.msi/download
Linux Vesion : https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.0.3.tgz

curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz

Server End :

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\sahithi>
C:\Users\sahithi>
C:\Users\sahithi>cd C:/

C:\>
C:\>
C:\>cd “Program Files”

C:\Program Files>cd MongoDB

C:\Program Files\MongoDB>cd Server

C:\Program Files\MongoDB\Server>
C:\Program Files\MongoDB\Server>
C:\Program Files\MongoDB\Server>cd 3.0

C:\Program Files\MongoDB\Server\3.0>
C:\Program Files\MongoDB\Server\3.0>cd bin

C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>dir
Volume in drive C has no label.
Volume Serial Number is 5C8F-85B4

Directory of C:\Program Files\MongoDB\Server\3.0\bin

28-05-2015 22:52

.
28-05-2015 22:52..
11-05-2015 21:34 9,742,336 bsondump.exe
23-03-2015 22:24 1,982,464 libeay32.dll
11-05-2015 21:38 6,443,520 mongo.exe
11-05-2015 21:41 14,363,648 mongod.exe
11-05-2015 21:42 110,161,920 mongod.pdb
11-05-2015 21:36 10,257,920 mongodump.exe
11-05-2015 21:35 10,067,968 mongoexport.exe
11-05-2015 21:35 10,008,064 mongofiles.exe
11-05-2015 21:35 10,248,192 mongoimport.exe
11-05-2015 21:36 9,750,016 mongooplog.exe
11-05-2015 21:42 12,544,000 mongoperf.exe
11-05-2015 21:36 10,371,072 mongorestore.exe
11-05-2015 21:41 6,302,720 mongos.exe
11-05-2015 21:41 56,414,208 mongos.pdb
11-05-2015 21:35 9,966,080 mongostat.exe
11-05-2015 21:36 9,836,032 mongotop.exe
23-03-2015 22:24 348,672 ssleay32.dll
17 File(s) 298,808,832 bytes
2 Dir(s) 4,894,244,864 bytes free
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>mongod.exe –dbpath C:\my_data_files –install –logpath C:\my_data_files\logfile.txt

Client :
———–

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\sahithi>cd C:/

C:\>
C:\>
C:\>
C:\>cd “Program Files”

C:\Program Files>cd MongoDB

C:\Program Files\MongoDB>
C:\Program Files\MongoDB>cd Server

C:\Program Files\MongoDB\Server>
C:\Program Files\MongoDB\Server>
C:\Program Files\MongoDB\Server>cd 3.0

C:\Program Files\MongoDB\Server\3.0>cd bin

C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>dir
Volume in drive C has no label.
Volume Serial Number is 5C8F-85B4

Directory of C:\Program Files\MongoDB\Server\3.0\bin

28-05-2015 22:52

.
28-05-2015 22:52..
11-05-2015 21:34 9,742,336 bsondump.exe
23-03-2015 22:24 1,982,464 libeay32.dll
11-05-2015 21:38 6,443,520 mongo.exe
11-05-2015 21:41 14,363,648 mongod.exe
11-05-2015 21:42 110,161,920 mongod.pdb
11-05-2015 21:36 10,257,920 mongodump.exe
11-05-2015 21:35 10,067,968 mongoexport.exe
11-05-2015 21:35 10,008,064 mongofiles.exe
11-05-2015 21:35 10,248,192 mongoimport.exe
11-05-2015 21:36 9,750,016 mongooplog.exe
11-05-2015 21:42 12,544,000 mongoperf.exe
11-05-2015 21:36 10,371,072 mongorestore.exe
11-05-2015 21:41 6,302,720 mongos.exe
11-05-2015 21:41 56,414,208 mongos.pdb
11-05-2015 21:35 9,966,080 mongostat.exe
11-05-2015 21:36 9,836,032 mongotop.exe
23-03-2015 22:24 348,672 ssleay32.dll
17 File(s) 298,808,832 bytes
2 Dir(s) 4,810,293,248 bytes free
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>
C:\Program Files\MongoDB\Server\3.0\bin>mongo.exe
2015-05-28T23:20:51.072+0530 I CONTROL Hotfix KB2731284 or later update is not
installed, will zero-out data files
MongoDB shell version: 3.0.3
connecting to: test
>
>
> show dbs
local 0.078GB
>
> use my_first_db
switched to db my_first_db
>
>
> db.my_first_collection.insert({ _id:1, name: “MongoDB” })
WriteResult({ “nInserted” : 1 })
>
> db.my_first_collection.find()
{ “_id” : 1, “name” : “MongoDB” }
>
>
>
> use newdb
switched to db newdb
>
>
> db.my_first_collection.insert({ _id:1, name: “MongoDB” })
WriteResult({ “nInserted” : 1 })
>

==============================

–smallfiles ( will help you to create small db files for testing, but not recomended for productions)
–nojournal ( which will disable journaling for test environements, but not recomended for productions)
Detailed logging and will helpful in crash recovery,

–quiet ( suppress unnecessary logging)

start/stop service
open/close connection

& (linux) – to run the service in the background

man
man ps ( man – manual ) (ps – command)

To come out of manual – type “q” ( quit)

ps -ef | grep mongo

| – extend the command

cd – : will take previously visited folder

for(var i = 1; i <= 1000 ; i++){db.test_collection.insert({“_id” : i , “title” : “My First Insert”, ” Iteration no:” : i });} _id,title,Iteration no: Linux Installation :- Using username “ec2-user”. Authenticating with public key “imported-openssh-key” Last login: Thu May 28 03:48:41 2015 from 123.236.167.184 __| __|_ ) _| ( / Amazon Linux AMI ___|\___|___| https://aws.amazon.com/amazon-linux-ami/2015.03-release-notes/ 7 package(s) needed for security, out of 12 available Run “sudo yum update” to apply all updates. [ec2-user@ip-10-0-0-169 ~]$ [ec2-user@ip-10-0-0-169 ~]$ [ec2-user@ip-10-0-0-169 ~]$ [ec2-user@ip-10-0-0-169 ~]$ [ec2-user@ip-10-0-0-169 ~]$ sudo su [root@ip-10-0-0-169 ec2-user]# [root@ip-10-0-0-169 ec2-user]# [root@ip-10-0-0-169 ec2-user]# [root@ip-10-0-0-169 ec2-user]# [root@ip-10-0-0-169 ec2-user]# cd [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 37.7M 100 37.7M 0 0 68.5M 0 –:–:– –:–:– –:–:– 68.5M [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr total 38M drwxr-xr-x 4 root root 4.0K Apr 25 21:11 mongodb drwxr-xr-x 3 root root 4.0K May 17 16:54 mongodb-linux-x86_64-3.0.1 -rw-r–r– 1 root root 38M May 28 17:00 mongodb-linux-x86_64-3.0.1.tgz [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# rm -rf mongodb-linux-x86_64-3.0.1* [root@ip-10-0-0-169 ~]# rm -rf mongodb-linux-x86_64-3.0.1* [root@ip-10-0-0-169 ~]# rm -rf mongodb-linux-x86_64-3.0.1 [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# rm -rf mongodb/ [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr total 0 [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr // to list all the files ls: cannot access to: No such file or directory ls: cannot access list: No such file or directory ls: cannot access all: No such file or directory ls: cannot access the: No such file or directory ls: cannot access files: No such file or directory //: total 100K drwxr-xr-x 2 root root 4.0K Jan 6 2012 srv drwxr-xr-x 2 root root 4.0K Jan 6 2012 selinux drwxr-xr-x 2 root root 4.0K Jan 6 2012 mnt drwxr-xr-x 2 root root 4.0K Jan 6 2012 media drwx—— 2 root root 16K Mar 18 15:29 lost+found drwxr-xr-x 2 root root 4.0K Mar 18 15:29 local drwxr-xr-x 13 root root 4.0K Mar 18 15:29 usr drwxr-xr-x 18 root root 4.0K Mar 18 15:30 var dr-xr-xr-x 4 root root 4.0K Mar 18 15:30 boot dr-xr-xr-x 80 root root 0 Apr 6 14:59 proc drwxr-xr-x 3 root root 4.0K Apr 6 15:00 run drwxr-xr-x 3 root root 4.0K Apr 6 15:00 home drwxr-xr-x 16 root root 2.8K Apr 6 15:00 dev dr-xr-xr-x 13 root root 0 Apr 13 20:54 sys drwxr-xr-x 4 root root 4.0K Apr 13 21:04 opt dr-xr-xr-x 7 root root 4.0K Apr 22 21:38 lib dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 bin dr-xr-xr-x 10 root root 12K Apr 25 19:19 lib64 dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 sbin drwxr-xr-x 71 root root 4.0K Apr 25 19:19 etc drwxr-xr-x 5 root root 4.0K May 17 16:56 data drwxrwxrwt 3 root root 4.0K May 28 16:53 tmp dr-xr-x— 3 root root 4.0K May 28 17:00 root [root@ip-10-0-0-169 ~]# ll -lhtr #to list all the files total 0 [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr //to list al files ls: cannot access //to: No such file or directory ls: cannot access list: No such file or directory ls: cannot access al: No such file or directory ls: cannot access files: No such file or directory [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr // total 100K drwxr-xr-x 2 root root 4.0K Jan 6 2012 srv drwxr-xr-x 2 root root 4.0K Jan 6 2012 selinux drwxr-xr-x 2 root root 4.0K Jan 6 2012 mnt drwxr-xr-x 2 root root 4.0K Jan 6 2012 media drwx—— 2 root root 16K Mar 18 15:29 lost+found drwxr-xr-x 2 root root 4.0K Mar 18 15:29 local drwxr-xr-x 13 root root 4.0K Mar 18 15:29 usr drwxr-xr-x 18 root root 4.0K Mar 18 15:30 var dr-xr-xr-x 4 root root 4.0K Mar 18 15:30 boot dr-xr-xr-x 80 root root 0 Apr 6 14:59 proc drwxr-xr-x 3 root root 4.0K Apr 6 15:00 run drwxr-xr-x 3 root root 4.0K Apr 6 15:00 home drwxr-xr-x 16 root root 2.8K Apr 6 15:00 dev dr-xr-xr-x 13 root root 0 Apr 13 20:54 sys drwxr-xr-x 4 root root 4.0K Apr 13 21:04 opt dr-xr-xr-x 7 root root 4.0K Apr 22 21:38 lib dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 bin dr-xr-xr-x 10 root root 12K Apr 25 19:19 lib64 dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 sbin drwxr-xr-x 71 root root 4.0K Apr 25 19:19 etc drwxr-xr-x 5 root root 4.0K May 17 16:56 data drwxrwxrwt 3 root root 4.0K May 28 16:53 tmp dr-xr-x— 3 root root 4.0K May 28 17:00 root [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr // to list all files ls: cannot access to: No such file or directory ls: cannot access list: No such file or directory ls: cannot access all: No such file or directory ls: cannot access files: No such file or directory //: total 100K drwxr-xr-x 2 root root 4.0K Jan 6 2012 srv drwxr-xr-x 2 root root 4.0K Jan 6 2012 selinux drwxr-xr-x 2 root root 4.0K Jan 6 2012 mnt drwxr-xr-x 2 root root 4.0K Jan 6 2012 media drwx—— 2 root root 16K Mar 18 15:29 lost+found drwxr-xr-x 2 root root 4.0K Mar 18 15:29 local drwxr-xr-x 13 root root 4.0K Mar 18 15:29 usr drwxr-xr-x 18 root root 4.0K Mar 18 15:30 var dr-xr-xr-x 4 root root 4.0K Mar 18 15:30 boot dr-xr-xr-x 80 root root 0 Apr 6 14:59 proc drwxr-xr-x 3 root root 4.0K Apr 6 15:00 run drwxr-xr-x 3 root root 4.0K Apr 6 15:00 home drwxr-xr-x 16 root root 2.8K Apr 6 15:00 dev dr-xr-xr-x 13 root root 0 Apr 13 20:54 sys drwxr-xr-x 4 root root 4.0K Apr 13 21:04 opt dr-xr-xr-x 7 root root 4.0K Apr 22 21:38 lib dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 bin dr-xr-xr-x 10 root root 12K Apr 25 19:19 lib64 dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 sbin drwxr-xr-x 71 root root 4.0K Apr 25 19:19 etc drwxr-xr-x 5 root root 4.0K May 17 16:56 data drwxrwxrwt 3 root root 4.0K May 28 16:53 tmp dr-xr-x— 3 root root 4.0K May 28 17:00 root [root@ip-10-0-0-169 ~]# ll -lhtr // to list all files ? ls: cannot access to: No such file or directory ls: cannot access list: No such file or directory ls: cannot access all: No such file or directory ls: cannot access files: No such file or directory ls: cannot access ?: No such file or directory //: total 100K drwxr-xr-x 2 root root 4.0K Jan 6 2012 srv drwxr-xr-x 2 root root 4.0K Jan 6 2012 selinux drwxr-xr-x 2 root root 4.0K Jan 6 2012 mnt drwxr-xr-x 2 root root 4.0K Jan 6 2012 media drwx—— 2 root root 16K Mar 18 15:29 lost+found drwxr-xr-x 2 root root 4.0K Mar 18 15:29 local drwxr-xr-x 13 root root 4.0K Mar 18 15:29 usr drwxr-xr-x 18 root root 4.0K Mar 18 15:30 var dr-xr-xr-x 4 root root 4.0K Mar 18 15:30 boot dr-xr-xr-x 82 root root 0 Apr 6 14:59 proc drwxr-xr-x 3 root root 4.0K Apr 6 15:00 run drwxr-xr-x 3 root root 4.0K Apr 6 15:00 home drwxr-xr-x 16 root root 2.8K Apr 6 15:00 dev dr-xr-xr-x 13 root root 0 Apr 13 20:54 sys drwxr-xr-x 4 root root 4.0K Apr 13 21:04 opt dr-xr-xr-x 7 root root 4.0K Apr 22 21:38 lib dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 bin dr-xr-xr-x 10 root root 12K Apr 25 19:19 lib64 dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 sbin drwxr-xr-x 71 root root 4.0K Apr 25 19:19 etc drwxr-xr-x 5 root root 4.0K May 17 16:56 data drwxrwxrwt 3 root root 4.0K May 28 16:53 tmp dr-xr-x— 3 root root 4.0K May 28 17:00 root [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr // to list all files // ls: cannot access to: No such file or directory ls: cannot access list: No such file or directory ls: cannot access all: No such file or directory ls: cannot access files: No such file or directory //: total 100K drwxr-xr-x 2 root root 4.0K Jan 6 2012 srv drwxr-xr-x 2 root root 4.0K Jan 6 2012 selinux drwxr-xr-x 2 root root 4.0K Jan 6 2012 mnt drwxr-xr-x 2 root root 4.0K Jan 6 2012 media drwx—— 2 root root 16K Mar 18 15:29 lost+found drwxr-xr-x 2 root root 4.0K Mar 18 15:29 local drwxr-xr-x 13 root root 4.0K Mar 18 15:29 usr drwxr-xr-x 18 root root 4.0K Mar 18 15:30 var dr-xr-xr-x 4 root root 4.0K Mar 18 15:30 boot dr-xr-xr-x 80 root root 0 Apr 6 14:59 proc drwxr-xr-x 3 root root 4.0K Apr 6 15:00 run drwxr-xr-x 3 root root 4.0K Apr 6 15:00 home drwxr-xr-x 16 root root 2.8K Apr 6 15:00 dev dr-xr-xr-x 13 root root 0 Apr 13 20:54 sys drwxr-xr-x 4 root root 4.0K Apr 13 21:04 opt dr-xr-xr-x 7 root root 4.0K Apr 22 21:38 lib dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 bin dr-xr-xr-x 10 root root 12K Apr 25 19:19 lib64 dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 sbin drwxr-xr-x 71 root root 4.0K Apr 25 19:19 etc drwxr-xr-x 5 root root 4.0K May 17 16:56 data drwxrwxrwt 3 root root 4.0K May 28 16:53 tmp dr-xr-x— 3 root root 4.0K May 28 17:00 root //: total 100K drwxr-xr-x 2 root root 4.0K Jan 6 2012 srv drwxr-xr-x 2 root root 4.0K Jan 6 2012 selinux drwxr-xr-x 2 root root 4.0K Jan 6 2012 mnt drwxr-xr-x 2 root root 4.0K Jan 6 2012 media drwx—— 2 root root 16K Mar 18 15:29 lost+found drwxr-xr-x 2 root root 4.0K Mar 18 15:29 local drwxr-xr-x 13 root root 4.0K Mar 18 15:29 usr drwxr-xr-x 18 root root 4.0K Mar 18 15:30 var dr-xr-xr-x 4 root root 4.0K Mar 18 15:30 boot dr-xr-xr-x 80 root root 0 Apr 6 14:59 proc drwxr-xr-x 3 root root 4.0K Apr 6 15:00 run drwxr-xr-x 3 root root 4.0K Apr 6 15:00 home drwxr-xr-x 16 root root 2.8K Apr 6 15:00 dev dr-xr-xr-x 13 root root 0 Apr 13 20:54 sys drwxr-xr-x 4 root root 4.0K Apr 13 21:04 opt dr-xr-xr-x 7 root root 4.0K Apr 22 21:38 lib dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 bin dr-xr-xr-x 10 root root 12K Apr 25 19:19 lib64 dr-xr-xr-x 2 root root 4.0K Apr 25 19:19 sbin drwxr-xr-x 71 root root 4.0K Apr 25 19:19 etc drwxr-xr-x 5 root root 4.0K May 17 16:56 data drwxrwxrwt 3 root root 4.0K May 28 16:53 tmp dr-xr-x— 3 root root 4.0K May 28 17:00 root [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr total 0 [root@ip-10-0-0-169 ~]# pwd /root [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# cat /proc/version Linux version 3.14.35-28.38.amzn1.x86_64 (mockbuild@gobi-build-64012) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Wed Mar 11 22:50:37 UTC 2015 [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 37.7M 100 37.7M 0 0 69.9M 0 –:–:– –:–:– –:–:– 69.8M [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr total 38M -rw-r–r– 1 root root 38M May 28 18:00 mongodb-linux-x86_64-3.0.1.tgz [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# tar -zxvf mongodb-linux-x86_64-3.0.1.tgz mongodb-linux-x86_64-3.0.1/README mongodb-linux-x86_64-3.0.1/THIRD-PARTY-NOTICES mongodb-linux-x86_64-3.0.1/GNU-AGPL-3.0 mongodb-linux-x86_64-3.0.1/bin/mongodump mongodb-linux-x86_64-3.0.1/bin/mongorestore mongodb-linux-x86_64-3.0.1/bin/mongoexport mongodb-linux-x86_64-3.0.1/bin/mongoimport mongodb-linux-x86_64-3.0.1/bin/mongostat mongodb-linux-x86_64-3.0.1/bin/mongotop mongodb-linux-x86_64-3.0.1/bin/bsondump mongodb-linux-x86_64-3.0.1/bin/mongofiles mongodb-linux-x86_64-3.0.1/bin/mongooplog mongodb-linux-x86_64-3.0.1/bin/mongoperf mongodb-linux-x86_64-3.0.1/bin/mongod mongodb-linux-x86_64-3.0.1/bin/mongos mongodb-linux-x86_64-3.0.1/bin/mongo [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# ll -lhtr total 38M -rw-r–r– 1 root root 38M May 28 18:00 mongodb-linux-x86_64-3.0.1.tgz drwxr-xr-x 3 root root 4.0K May 28 18:00 mongodb-linux-x86_64-3.0.1 [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# [root@ip-10-0-0-169 ~]# cd mongodb-linux-x86_64-3.0.1 [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# pwd /root/mongodb-linux-x86_64-3.0.1 [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# ll -lhtr total 68K -rw-r–r– 1 1046 1046 23K Mar 16 15:21 THIRD-PARTY-NOTICES -rw-r–r– 1 1046 1046 1.4K Mar 16 15:21 README -rw-r–r– 1 1046 1046 34K Mar 16 15:21 GNU-AGPL-3.0 drwxr-xr-x 2 root root 4.0K May 28 18:01 bin [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# [root@ip-10-0-0-169 mongodb-linux-x86_64-3.0.1]# cd bin/ [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# pwd /root/mongodb-linux-x86_64-3.0.1/bin [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ll -lhtr total 113M -rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump -rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat -rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles -rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport -rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport -rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore -rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump -rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop -rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog -rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf -rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod -rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos -rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# mkdir data [root@ip-10-0-0-169 bin]# ll -lhtr total 113M -rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump -rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat -rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles -rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport -rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport -rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore -rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump -rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop -rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog -rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf -rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod -rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos -rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo drwxr-xr-x 2 root root 4.0K May 28 18:04 data [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# mkdir logs [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ll -lhtr total 113M -rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump -rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat -rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles -rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport -rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport -rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore -rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump -rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop -rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog -rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf -rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod -rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos -rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo drwxr-xr-x 2 root root 4.0K May 28 18:04 data drwxr-xr-x 2 root root 4.0K May 28 18:04 logs [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# pwd /root/mongodb-linux-x86_64-3.0.1/bin [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# /root/mongodb-linux-x86_64-3.0.1/bin/mongod ^C [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ./mongod –dbpath /root/mongodb-linux-x86_64-3.0.1/bin/data/ –logpath /root/mongodb-linux-x86_64-3.0.1/bin/logs/mongod.log –port 37010 –smallfiles –nojournal –quiet & [1] 28734 [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# man ps [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# man ps [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ps -ef | grep mongo root 28734 26400 0 18:18 pts/0 00:00:00 ./mongod –dbpath /root/mongodb-linux-x86_64-3.0.1/bin/data/ –logpath /root/mongodb-linux-x86_64-3.0.1/bin/logs/mongod.log –port 37010 –smallfiles –nojournal –quiet root 28876 26400 0 18:21 pts/0 00:00:00 grep mongo root 29212 1 0 May17 ? 00:22:13 ./mongod –replSet dbversity –dbpath /data/1 –logpath /data/1/mongod.log –port 27011 –smallfiles –nojournal root 29238 1 0 May17 ? 00:22:22 ./mongod –replSet dbversity –dbpath /data/2 –logpath /data/2/mongod.log –port 27012 –smallfiles –nojournal root 29250 1 0 May17 ? 00:20:41 ./mongod –replSet dbversity –dbpath /data/3 –logpath /data/3/mongod.log –port 27013 –smallfiles –nojournal [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# kill -9 29212 29238 29250 [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ps -ef | grep mongo root 28734 26400 0 18:18 pts/0 00:00:00 ./mongod –dbpath /root/mongodb-linux-x86_64-3.0.1/bin/data/ –logpath /root/mongodb-linux-x86_64-3.0.1/bin/logs/mongod.log –port 37010 –smallfiles –nojournal –quiet root 28890 26400 0 18:21 pts/0 00:00:00 grep mongo [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 Apr06 ? 00:00:05 /sbin/init root 2 0 0 Apr06 ? 00:00:00 [kthreadd] root 3 2 0 Apr06 ? 00:00:03 [ksoftirqd/0] root 5 2 0 Apr06 ? 00:00:00 [kworker/0:0H] root 7 2 0 Apr06 ? 00:00:20 [rcu_sched] root 8 2 0 Apr06 ? 00:00:00 [rcu_bh] root 9 2 0 Apr06 ? 00:00:00 [migration/0] root 10 2 0 Apr06 ? 00:00:00 [khelper] root 11 2 0 Apr06 ? 00:00:00 [kdevtmpfs] root 12 2 0 Apr06 ? 00:00:00 [netns] root 19 2 0 Apr06 ? 00:00:00 [xenwatch] root 20 2 0 Apr06 ? 00:00:00 [xenbus] root 21 2 0 Apr06 ? 00:01:10 [kworker/0:1] root 115 2 0 Apr06 ? 00:00:00 [writeback] root 118 2 0 Apr06 ? 00:00:00 [ksmd] root 119 2 0 Apr06 ? 00:00:00 [khugepaged] root 120 2 0 Apr06 ? 00:00:00 [kintegrityd] root 121 2 0 Apr06 ? 00:00:00 [bioset] root 122 2 0 Apr06 ? 00:00:00 [crypto] root 124 2 0 Apr06 ? 00:00:00 [kblockd] root 473 2 0 Apr06 ? 00:00:00 [md] root 598 2 0 Apr06 ? 00:00:00 [khungtaskd] root 603 2 0 Apr06 ? 00:00:00 [kswapd0] root 671 2 0 Apr06 ? 00:00:00 [fsnotify_mark] root 685 2 0 Apr06 ? 00:00:00 [kthrotld] root 692 2 0 Apr06 ? 00:00:00 [khvcd] root 740 2 0 Apr06 ? 00:00:00 [deferwq] root 1360 2 0 Apr06 ? 00:00:08 [jbd2/xvda1-8] root 1361 2 0 Apr06 ? 00:00:00 [ext4-rsv-conver] root 1398 1 0 Apr06 ? 00:00:00 /sbin/udevd -d root 1515 1398 0 Apr06 ? 00:00:00 /sbin/udevd -d root 1516 1398 0 Apr06 ? 00:00:00 /sbin/udevd -d root 1529 2 0 Apr06 ? 00:00:00 [kpsmoused] root 1549 2 0 Apr06 ? 00:00:00 [kworker/0:2] root 1703 2 0 Apr06 ? 00:00:05 [kauditd] root 1746 2 0 Apr06 ? 00:00:00 [ipv6_addrconf] root 1874 1 0 Apr06 ? 00:00:01 /sbin/dhclient -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/ root 1915 1 0 Apr06 ? 00:00:35 auditd root 1933 1 0 Apr06 ? 00:00:11 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5 root 1949 1 0 Apr06 ? 00:02:04 rngd –no-tpm=1 –quiet dbus 1961 1 0 Apr06 ? 00:00:00 dbus-daemon –system ntp 2139 1 0 Apr06 ? 00:00:04 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g root 2154 1 0 Apr06 ? 00:01:18 sendmail: accepting connections smmsp 2161 1 0 Apr06 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue root 2169 1 0 Apr06 ? 00:00:09 crond root 2179 1 0 Apr06 ? 00:00:00 /usr/sbin/atd root 2212 1 0 Apr06 ttyS0 00:00:00 /sbin/agetty ttyS0 9600 vt100-nav root 2215 1 0 Apr06 tty1 00:00:00 /sbin/mingetty /dev/tty1 root 2219 1 0 Apr06 tty2 00:00:00 /sbin/mingetty /dev/tty2 root 2221 1 0 Apr06 tty3 00:00:00 /sbin/mingetty /dev/tty3 root 2223 1 0 Apr06 tty4 00:00:00 /sbin/mingetty /dev/tty4 root 2227 1 0 Apr06 tty5 00:00:00 /sbin/mingetty /dev/tty5 root 2231 1 0 Apr06 tty6 00:00:00 /sbin/mingetty /dev/tty6 root 13101 2 0 Apr14 ? 00:00:07 [kworker/u30:2] root 22544 1 0 Apr06 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe –datadir=/var/lib/mysql –socket=/var/lib/my mysql 22739 22544 0 Apr06 ? 00:20:21 /usr/libexec/mysqld –basedir=/usr –datadir=/var/lib/mysql –plugin-dir=/ root 22806 2 0 Apr06 ? 00:00:00 [kworker/0:1H] root 26356 28321 0 16:52 ? 00:00:00 sshd: ec2-user [priv] ec2-user 26358 26356 0 16:52 ? 00:00:00 sshd: ec2-user@pts/0 ec2-user 26359 26358 0 16:52 pts/0 00:00:00 -bash root 26398 26359 0 16:53 pts/0 00:00:00 sudo su root 26399 26398 0 16:53 pts/0 00:00:00 su root 26400 26399 0 16:53 pts/0 00:00:00 bash root 28289 2 0 Apr25 ? 00:00:00 [kworker/u30:0] root 28321 1 0 Apr25 ? 00:00:17 /usr/sbin/sshd root 28734 26400 0 18:18 pts/0 00:00:00 ./mongod –dbpath /root/mongodb-linux-x86_64-3.0.1/bin/data/ –logpath /ro root 28891 26400 0 18:22 pts/0 00:00:00 ps -ef [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ps -ef | grep mongo root 28734 26400 0 18:18 pts/0 00:00:00 ./mongod –dbpath /root/mongodb-linux-x86_64-3.0.1/bin/data/ –logpath /root/mongodb-linux-x86_64-3.0.1/bin/logs/mongod.log –port 37010 –smallfiles –nojournal –quiet root 28893 26400 0 18:23 pts/0 00:00:00 grep mongo [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# [root@ip-10-0-0-169 bin]# ./mongo –port 37010 MongoDB shell version: 3.0.1 connecting to: 127.0.0.1:37010/test Server has startup warnings: 2015-05-28T18:18:30.201+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. 2015-05-28T18:18:30.201+0000 I CONTROL [initandlisten] 2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] 2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’. 2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’ 2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] >
>
> show dbs
local 0.031GB
>
>
>
bye
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# cd /root/mongodb-linux-x86_64-3.0.1/bin/data/
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]# ll -lhtr
total 33M
-rwxr-xr-x 1 root root 6 May 28 18:18 mongod.lock
-rw-r–r– 1 root root 69 May 28 18:18 storage.bson
drwxr-xr-x 2 root root 4.0K May 28 18:18 _tmp
-rw——- 1 root root 16M May 28 18:18 local.ns
-rw——- 1 root root 16M May 28 18:18 local.0
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]# cat mongod.lock
28734
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]# cat mongod.lock
28734
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]# ./mongo –port 37010
bash: ./mongo: No such file or directory
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]# cd –
/root/mongodb-linux-x86_64-3.0.1/bin
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# cd –
/root/mongodb-linux-x86_64-3.0.1/bin/data
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]#
[root@ip-10-0-0-169 data]# cd –
/root/mongodb-linux-x86_64-3.0.1/bin
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump
-rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport
-rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod
-rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos
-rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo
drwxr-xr-x 2 root root 4.0K May 28 18:18 logs
drwxr-xr-x 3 root root 4.0K May 28 18:18 data
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongo –port 37010
MongoDB shell version: 3.0.1
connecting to: 127.0.0.1:37010/test
Server has startup warnings:
2015-05-28T18:18:30.201+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-05-28T18:18:30.201+0000 I CONTROL [initandlisten]
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten]
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten]
>
>
>
>
> use day2
switched to db day2
>
>
>
>
>
> for(var i = 1; i <= 1000 ; i++){db.test_collection.insert({“_id” : i , “title” : “My First Insert”, ” Iteration no:” : i });} WriteResult({ “nInserted” : 1 }) >
>
> show collections
system.indexes
test_collection
>
>
>
> db.test_collection.find()
{ “_id” : 1, “title” : “My First Insert”, ” Iteration no:” : 1 }
{ “_id” : 2, “title” : “My First Insert”, ” Iteration no:” : 2 }
{ “_id” : 3, “title” : “My First Insert”, ” Iteration no:” : 3 }
{ “_id” : 4, “title” : “My First Insert”, ” Iteration no:” : 4 }
{ “_id” : 5, “title” : “My First Insert”, ” Iteration no:” : 5 }
{ “_id” : 6, “title” : “My First Insert”, ” Iteration no:” : 6 }
{ “_id” : 7, “title” : “My First Insert”, ” Iteration no:” : 7 }
{ “_id” : 8, “title” : “My First Insert”, ” Iteration no:” : 8 }
{ “_id” : 9, “title” : “My First Insert”, ” Iteration no:” : 9 }
{ “_id” : 10, “title” : “My First Insert”, ” Iteration no:” : 10 }
{ “_id” : 11, “title” : “My First Insert”, ” Iteration no:” : 11 }
{ “_id” : 12, “title” : “My First Insert”, ” Iteration no:” : 12 }
{ “_id” : 13, “title” : “My First Insert”, ” Iteration no:” : 13 }
{ “_id” : 14, “title” : “My First Insert”, ” Iteration no:” : 14 }
{ “_id” : 15, “title” : “My First Insert”, ” Iteration no:” : 15 }
{ “_id” : 16, “title” : “My First Insert”, ” Iteration no:” : 16 }
{ “_id” : 17, “title” : “My First Insert”, ” Iteration no:” : 17 }
{ “_id” : 18, “title” : “My First Insert”, ” Iteration no:” : 18 }
{ “_id” : 19, “title” : “My First Insert”, ” Iteration no:” : 19 }
{ “_id” : 20, “title” : “My First Insert”, ” Iteration no:” : 20 }
Type “it” for more
> it
{ “_id” : 21, “title” : “My First Insert”, ” Iteration no:” : 21 }
{ “_id” : 22, “title” : “My First Insert”, ” Iteration no:” : 22 }
{ “_id” : 23, “title” : “My First Insert”, ” Iteration no:” : 23 }
{ “_id” : 24, “title” : “My First Insert”, ” Iteration no:” : 24 }
{ “_id” : 25, “title” : “My First Insert”, ” Iteration no:” : 25 }
{ “_id” : 26, “title” : “My First Insert”, ” Iteration no:” : 26 }
{ “_id” : 27, “title” : “My First Insert”, ” Iteration no:” : 27 }
{ “_id” : 28, “title” : “My First Insert”, ” Iteration no:” : 28 }
{ “_id” : 29, “title” : “My First Insert”, ” Iteration no:” : 29 }
{ “_id” : 30, “title” : “My First Insert”, ” Iteration no:” : 30 }
{ “_id” : 31, “title” : “My First Insert”, ” Iteration no:” : 31 }
{ “_id” : 32, “title” : “My First Insert”, ” Iteration no:” : 32 }
{ “_id” : 33, “title” : “My First Insert”, ” Iteration no:” : 33 }
{ “_id” : 34, “title” : “My First Insert”, ” Iteration no:” : 34 }
{ “_id” : 35, “title” : “My First Insert”, ” Iteration no:” : 35 }
{ “_id” : 36, “title” : “My First Insert”, ” Iteration no:” : 36 }
{ “_id” : 37, “title” : “My First Insert”, ” Iteration no:” : 37 }
{ “_id” : 38, “title” : “My First Insert”, ” Iteration no:” : 38 }
{ “_id” : 39, “title” : “My First Insert”, ” Iteration no:” : 39 }
{ “_id” : 40, “title” : “My First Insert”, ” Iteration no:” : 40 }
Type “it” for more
> it
{ “_id” : 41, “title” : “My First Insert”, ” Iteration no:” : 41 }
{ “_id” : 42, “title” : “My First Insert”, ” Iteration no:” : 42 }
{ “_id” : 43, “title” : “My First Insert”, ” Iteration no:” : 43 }
{ “_id” : 44, “title” : “My First Insert”, ” Iteration no:” : 44 }
{ “_id” : 45, “title” : “My First Insert”, ” Iteration no:” : 45 }
{ “_id” : 46, “title” : “My First Insert”, ” Iteration no:” : 46 }
{ “_id” : 47, “title” : “My First Insert”, ” Iteration no:” : 47 }
{ “_id” : 48, “title” : “My First Insert”, ” Iteration no:” : 48 }
{ “_id” : 49, “title” : “My First Insert”, ” Iteration no:” : 49 }
{ “_id” : 50, “title” : “My First Insert”, ” Iteration no:” : 50 }
{ “_id” : 51, “title” : “My First Insert”, ” Iteration no:” : 51 }
{ “_id” : 52, “title” : “My First Insert”, ” Iteration no:” : 52 }
{ “_id” : 53, “title” : “My First Insert”, ” Iteration no:” : 53 }
{ “_id” : 54, “title” : “My First Insert”, ” Iteration no:” : 54 }
{ “_id” : 55, “title” : “My First Insert”, ” Iteration no:” : 55 }
{ “_id” : 56, “title” : “My First Insert”, ” Iteration no:” : 56 }
{ “_id” : 57, “title” : “My First Insert”, ” Iteration no:” : 57 }
{ “_id” : 58, “title” : “My First Insert”, ” Iteration no:” : 58 }
{ “_id” : 59, “title” : “My First Insert”, ” Iteration no:” : 59 }
{ “_id” : 60, “title” : “My First Insert”, ” Iteration no:” : 60 }
Type “it” for more
>
>
>
>
>
>
> db.test_collection.count()
1000
>
> db.test_collection.find()
{ “_id” : 1, “title” : “My First Insert”, ” Iteration no:” : 1 }
{ “_id” : 2, “title” : “My First Insert”, ” Iteration no:” : 2 }
{ “_id” : 3, “title” : “My First Insert”, ” Iteration no:” : 3 }
{ “_id” : 4, “title” : “My First Insert”, ” Iteration no:” : 4 }
{ “_id” : 5, “title” : “My First Insert”, ” Iteration no:” : 5 }
{ “_id” : 6, “title” : “My First Insert”, ” Iteration no:” : 6 }
{ “_id” : 7, “title” : “My First Insert”, ” Iteration no:” : 7 }
{ “_id” : 8, “title” : “My First Insert”, ” Iteration no:” : 8 }
{ “_id” : 9, “title” : “My First Insert”, ” Iteration no:” : 9 }
{ “_id” : 10, “title” : “My First Insert”, ” Iteration no:” : 10 }
{ “_id” : 11, “title” : “My First Insert”, ” Iteration no:” : 11 }
{ “_id” : 12, “title” : “My First Insert”, ” Iteration no:” : 12 }
{ “_id” : 13, “title” : “My First Insert”, ” Iteration no:” : 13 }
{ “_id” : 14, “title” : “My First Insert”, ” Iteration no:” : 14 }
{ “_id” : 15, “title” : “My First Insert”, ” Iteration no:” : 15 }
{ “_id” : 16, “title” : “My First Insert”, ” Iteration no:” : 16 }
{ “_id” : 17, “title” : “My First Insert”, ” Iteration no:” : 17 }
{ “_id” : 18, “title” : “My First Insert”, ” Iteration no:” : 18 }
{ “_id” : 19, “title” : “My First Insert”, ” Iteration no:” : 19 }
{ “_id” : 20, “title” : “My First Insert”, ” Iteration no:” : 20 }
Type “it” for more
>
>
> db.test_collection.findOne()
{ “_id” : 1, “title” : “My First Insert”, ” Iteration no:” : 1 }
>
> db.test_collection.findOne().pretty()
2015-05-28T18:32:47.611+0000 E QUERY TypeError: Object [object Object] has no method ‘pretty’
at (shell):1:30
>
>
> db.test_collection.find().pretty().limit(1)
{ “_id” : 1, “title” : “My First Insert”, ” Iteration no:” : 1 }
>
>
> db.test_collection.find()
{ “_id” : 1, “title” : “My First Insert”, ” Iteration no:” : 1 }
{ “_id” : 2, “title” : “My First Insert”, ” Iteration no:” : 2 }
{ “_id” : 3, “title” : “My First Insert”, ” Iteration no:” : 3 }
{ “_id” : 4, “title” : “My First Insert”, ” Iteration no:” : 4 }
{ “_id” : 5, “title” : “My First Insert”, ” Iteration no:” : 5 }
{ “_id” : 6, “title” : “My First Insert”, ” Iteration no:” : 6 }
{ “_id” : 7, “title” : “My First Insert”, ” Iteration no:” : 7 }
{ “_id” : 8, “title” : “My First Insert”, ” Iteration no:” : 8 }
{ “_id” : 9, “title” : “My First Insert”, ” Iteration no:” : 9 }
{ “_id” : 10, “title” : “My First Insert”, ” Iteration no:” : 10 }
{ “_id” : 11, “title” : “My First Insert”, ” Iteration no:” : 11 }
{ “_id” : 12, “title” : “My First Insert”, ” Iteration no:” : 12 }
{ “_id” : 13, “title” : “My First Insert”, ” Iteration no:” : 13 }
{ “_id” : 14, “title” : “My First Insert”, ” Iteration no:” : 14 }
{ “_id” : 15, “title” : “My First Insert”, ” Iteration no:” : 15 }
{ “_id” : 16, “title” : “My First Insert”, ” Iteration no:” : 16 }
{ “_id” : 17, “title” : “My First Insert”, ” Iteration no:” : 17 }
{ “_id” : 18, “title” : “My First Insert”, ” Iteration no:” : 18 }
{ “_id” : 19, “title” : “My First Insert”, ” Iteration no:” : 19 }
{ “_id” : 20, “title” : “My First Insert”, ” Iteration no:” : 20 }
Type “it” for more
>
>
>
>
bye
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump
-rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport
-rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod
-rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos
-rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo
drwxr-xr-x 2 root root 4.0K May 28 18:18 logs
drwxr-xr-x 3 root root 4.0K May 28 18:30 data
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongostat –port 37010
insert query update delete getmore command flushes mapped vsize res faults idx miss % qr|qw ar|aw netIn netOut conn time
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:07
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:08
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:09
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:10
*0 *0 *0 *0 0 2|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 133b 10k 1 18:34:11
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:12
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:13
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:14
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:15
*0 *0 *0 *0 0 2|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 133b 10k 1 18:34:16
insert query update delete getmore command flushes mapped vsize res faults idx miss % qr|qw ar|aw netIn netOut conn time
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:17
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:18
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:19
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:20
*0 *0 *0 *0 0 2|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 133b 10k 1 18:34:21
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:22
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:23
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:24
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:25
*0 *0 *0 *0 0 2|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 133b 10k 1 18:34:26
insert query update delete getmore command flushes mapped vsize res faults idx miss % qr|qw ar|aw netIn netOut conn time
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:27
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:28
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:29
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:30
*0 *0 *0 *0 0 2|0 1 64.0M 305.0M 70.0M 0 0 0|0 0|0 133b 10k 1 18:34:31
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:32
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:33
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:34
*0 *0 *0 *0 0 1|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 79b 10k 1 18:34:35
*0 *0 *0 *0 0 2|0 0 64.0M 305.0M 70.0M 0 0 0|0 0|0 133b 10k 1 18:34:36
^C[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump
-rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport
-rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod
-rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos
-rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo
drwxr-xr-x 2 root root 4.0K May 28 18:18 logs
drwxr-xr-x 3 root root 4.0K May 28 18:30 data
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongoexport –help
Usage:
mongoexport

Export data from MongoDB in CSV or JSON format.

See http://docs.mongodb.org/manual/reference/program/mongoexport/ for more information.

general options:
–help print usage
–version print the tool version and exit

verbosity options:
-v, –verbose more detailed log output (include multiple times for more verbosity, e.g. -vvvvv)
–quiet hide all log output

connection options:
-h, –host= mongodb host to connect to (setname/host1,host2 for replica sets)
–port= server port (can also use –host hostname:port)

authentication options:
-u, –username= username for authentication
-p, –password= password for authentication
–authenticationDatabase= database that holds the user’s credentials
–authenticationMechanism= authentication mechanism to use

namespace options:
-d, –db= database to use
-c, –collection= collection to use

output options:
-f, –fields= comma separated list of field names (required for exporting CSV) e.g. -f “name,age”
–fieldFile= file with field names – 1 per line
–type= the output format, either json or csv (defaults to ‘json’)
-o, –out= output file; if not specified, stdout is used
–jsonArray output to a JSON array rather than one object per line
–pretty output JSON formatted to be human-readable

querying options:
-q, –query= query filter, as a JSON string, e.g., ‘{x:{$gt:1}}’
-k, –slaveOk allow secondary reads if available (default true)
–forceTableScan force a table scan (do not use $snapshot)
–skip= number of documents to skip
–limit= limit the number of documents to export
–sort= sort order, as a JSON string, e.g. ‘{x:1}’
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongoexport –port 37010 -d day2 -c test_collection -o /tmp/test_collection.csv –type=csv
2015-05-28T18:37:54.784+0000 Failed: CSV mode requires a field list
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongoexport –port 37010 -d day2 -c test_collection -f “_id,title,Iteration no:” -o /tmp/test_collection.csv –type=csv
2015-05-28T18:39:08.964+0000 connected to: localhost:37010
2015-05-28T18:39:08.980+0000 exported 1000 records
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# head /tmp/test_collection.csv
_id,title,Iteration no:
1,My First Insert,””
2,My First Insert,””
3,My First Insert,””
4,My First Insert,””
5,My First Insert,””
6,My First Insert,””
7,My First Insert,””
8,My First Insert,””
9,My First Insert,””
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# wc -l /tmp/test_collection.csv
1001 /tmp/test_collection.csv
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump
-rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport
-rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod
-rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos
-rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo
drwxr-xr-x 2 root root 4.0K May 28 18:18 logs
drwxr-xr-x 3 root root 4.0K May 28 18:30 data
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongoimport –help
Usage:
mongoimport

Import CSV, TSV or JSON data into MongoDB. If no file is provided, mongoimport reads from stdin.

See http://docs.mongodb.org/manual/reference/program/mongoimport/ for more information.

general options:
–help print usage
–version print the tool version and exit

verbosity options:
-v, –verbose more detailed log output (include multiple times for more verbosity, e.g. -vvvvv)
–quiet hide all log output

connection options:
-h, –host= mongodb host to connect to (setname/host1,host2 for replica sets)
–port= server port (can also use –host hostname:port)

authentication options:
-u, –username= username for authentication
-p, –password= password for authentication
–authenticationDatabase= database that holds the user’s credentials
–authenticationMechanism= authentication mechanism to use

namespace options:
-d, –db= database to use
-c, –collection= collection to use

input options:
-f, –fields= comma separated list of field names, e.g. -f name,age
–fieldFile= file with field names – 1 per line
–file= file to import from; if not specified, stdin is used
–headerline use first line in input source as the field list (CSV and TSV only)
–jsonArray treat input source as a JSON array
–type= input format to import: json, csv, or tsv (defaults to ‘json’)

ingest options:
–drop drop collection before inserting documents
–ignoreBlanks ignore fields with empty values in CSV and TSV
–maintainInsertionOrder insert documents in the order of their appearance in the input source
-j, –numInsertionWorkers= number of insert operations to run concurrently (defaults to 1)
–stopOnError stop importing at first insert/upsert error
–upsert insert or update objects that already exist
–upsertFields= comma-separated fields for the query part of the upsert
–writeConcern= write concern options e.g. –writeConcern majority, –writeConcern ‘{w: 3, wtimeout:
500, fsync: true, j: true}’ (defaults to ‘majority’)
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongoimport –port 37010 -d day2 -c mynewcol -f “_id,title,Iteration no:” –type=csv /tmp/test_collection.csv
2015-05-28T18:42:27.516+0000 connected to: localhost:37010
2015-05-28T18:42:27.530+0000 imported 1001 documents
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongo –port 37010
MongoDB shell version: 3.0.1
connecting to: 127.0.0.1:37010/test
Server has startup warnings:
2015-05-28T18:18:30.201+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-05-28T18:18:30.201+0000 I CONTROL [initandlisten]
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten]
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2015-05-28T18:18:30.202+0000 I CONTROL [initandlisten]
>
>
>
> show dbs
day2 0.031GB
local 0.031GB
>
>
> use day2
switched to db day2
>
>
> show collections
mynewcol
system.indexes
test_collection
>
>
> db.mynewcol.count()
1001
>
>
> db.mynewcol.find()
{ “_id” : “_id”, “title” : “title”, “Iteration no:” : “Iteration no:” }
{ “_id” : 1, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 2, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 3, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 4, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 5, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 6, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 7, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 8, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 9, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 10, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 11, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 12, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 13, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 14, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 15, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 16, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 17, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 18, “title” : “My First Insert”, “Iteration no:” : “” }
{ “_id” : 19, “title” : “My First Insert”, “Iteration no:” : “” }
Type “it” for more
>
bye
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump
-rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport
-rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod
-rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos
-rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo
drwxr-xr-x 2 root root 4.0K May 28 18:18 logs
drwxr-xr-x 3 root root 4.0K May 28 18:30 data
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ./mongotop –port 37010
2015-05-28T18:43:54.674+0000 connected to: 127.0.0.1:37010

ns total read write 2015-05-28T18:43:55Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:43:56Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:43:57Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:43:58Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:43:59Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:00Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:01Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:02Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:03Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:04Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:05Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:06Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:07Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:08Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:09Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:10Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:11Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:12Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:13Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:14Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:15Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:16Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:17Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:18Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

ns total read write 2015-05-28T18:44:19Z
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
day2.mynewcol 0ms 0ms 0ms
day2.system.indexes 0ms 0ms 0ms
day2.system.namespaces 0ms 0ms 0ms
day2.test_collection 0ms 0ms 0ms
local.startup_log 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
local.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms

^C[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# ll -lhtr
total 113M
-rwxr-xr-x 1 1046 1046 4.1M Mar 16 15:21 bsondump
-rwxr-xr-x 1 1046 1046 5.5M Mar 16 15:21 mongostat
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:21 mongofiles
-rwxr-xr-x 1 1046 1046 5.6M Mar 16 15:22 mongoexport
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongoimport
-rwxr-xr-x 1 1046 1046 5.9M Mar 16 15:22 mongorestore
-rwxr-xr-x 1 1046 1046 5.8M Mar 16 15:22 mongodump
-rwxr-xr-x 1 1046 1046 5.4M Mar 16 15:22 mongotop
-rwxr-xr-x 1 1046 1046 5.3M Mar 16 15:22 mongooplog
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongoperf
-rwxr-xr-x 1 1046 1046 22M Mar 16 15:29 mongod
-rwxr-xr-x 1 1046 1046 11M Mar 16 15:29 mongos
-rwxr-xr-x 1 1046 1046 12M Mar 16 15:29 mongo
drwxr-xr-x 2 root root 4.0K May 28 18:18 logs
drwxr-xr-x 3 root root 4.0K May 28 18:30 data
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:37010 0.0.0.0:* LISTEN 28734/./mongod
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 28321/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2154/sendmail
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 22739/mysqld
tcp 0 0 :::22 :::* LISTEN 28321/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 1874/dhclient
udp 0 0 10.0.0.169:123 0.0.0.0:* 2139/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 2139/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 2139/ntpd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 31160 22739/mysqld /var/lib/mysql/mysql.sock
unix 2 [ ACC ] STREAM LISTENING 8857 1961/dbus-daemon /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 7675 1/init @/com/ubuntu/upstart
unix 2 [ ACC ] SEQPACKET LISTENING 7879 1398/udevd @/org/kernel/udev/udevd
unix 2 [ ACC ] STREAM LISTENING 5396997 28734/./mongod /tmp/mongodb-37010.sock
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#
[root@ip-10-0-0-169 bin]#

  • Ask Question