0% found this document useful (0 votes)
24 views13 pages

MongoDB NareshIT 17 1 2022

Uploaded by

mailforsumant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views13 pages

MongoDB NareshIT 17 1 2022

Uploaded by

mailforsumant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 13

curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.

asc | sudo apt-key add -

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-


org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

----------------------------------------------------

db.movies.insertMany([
{
title: 'Titanic',
year: 1997,
genres: [ 'Drama', 'Romance' ],
rated: 'PG-13',
languages: [ 'English', 'French', 'German', 'Swedish', 'Italian',
'Russian' ],
released: ISODate("1997-12-19T00:00:00.000Z"),
awards: {
wins: 127,
nominations: 63,
text: 'Won 11 Oscars. Another 116 wins & 63 nominations.'
},
cast: [ 'Leonardo DiCaprio', 'Kate Winslet', 'Billy Zane', 'Kathy Bates' ],
directors: [ 'James Cameron' ]
},
{
title: 'The Dark Knight',
year: 2008,
genres: [ 'Action', 'Crime', 'Drama' ],
rated: 'PG-13',
languages: [ 'English', 'Mandarin' ],
released: ISODate("2008-07-18T00:00:00.000Z"),
awards: {
wins: 144,
nominations: 106,
text: 'Won 2 Oscars. Another 142 wins & 106 nominations.'
},
cast: [ 'Christian Bale', 'Heath Ledger', 'Aaron Eckhart', 'Michael Caine' ],
directors: [ 'Christopher Nolan' ]
},
{
title: 'Spirited Away',
year: 2001,
genres: [ 'Animation', 'Adventure', 'Family' ],
rated: 'PG',
languages: [ 'Japanese' ],
released: ISODate("2003-03-28T00:00:00.000Z"),
awards: {
wins: 52,
nominations: 22,
text: 'Won 1 Oscar. Another 51 wins & 22 nominations.'
},
cast: [ 'Rumi Hiiragi', 'Miyu Irino', 'Mari Natsuki', 'Takashi Naitè' ],
directors: [ 'Hayao Miyazaki' ]
},
{
title: 'Casablanca',
genres: [ 'Drama', 'Romance', 'War' ],
rated: 'PG',
cast: [ 'Humphrey Bogart', 'Ingrid Bergman', 'Paul Henreid', 'Claude
Rains' ],
languages: [ 'English', 'French', 'German', 'Italian' ],
released: ISODate("1943-01-23T00:00:00.000Z"),
directors: [ 'Michael Curtiz' ],
awards: {
wins: 9,
nominations: 6,
text: 'Won 3 Oscars. Another 6 wins & 6 nominations.'
},
lastupdated: '2015-09-04 00:22:54.600000000',
year: 1942
}
])

___________----------------------------------------------------------

hadoop2x@ubuntu:~$ su - hduser
Password:
hduser@ubuntu:~$ ls -ltr
total 64
-rw-r--r-- 1 root root 84 Dec 27 22:13 samplefile
drwxr-xr-x 3 hduser hadoop 4096 Dec 27 23:46 mydata
-rw-r--r-- 1 root root 127 Jan 3 20:07 empdata
-rw-r--r-- 1 root root 127 Jan 3 20:16 empdata1
-rw-r--r-- 1 root root 127 Jan 3 20:19 empdata2
drwxr-xr-x 2 hduser hadoop 4096 Jan 4 20:15 filter1
-rw-r--r-- 1 root root 54 Jan 4 20:22 filterdata
-rw-r--r-- 1 root root 51 Jan 5 19:42 groupdata
-rw-r--r-- 1 root root 54 Jan 5 20:01 Co1
-rw-r--r-- 1 root root 42 Jan 5 20:01 Co2
-rw-r--r-- 1 root root 280 Jan 5 20:08 cogroup.pig
drwxr-xr-x 2 hduser hadoop 4096 Jan 5 20:15 Cogroup
-rw-r--r-- 1 root root 36 Jan 5 20:16 sort1
-rw-r--r-- 1 hduser hadoop 2608 Jan 6 19:32 pig_1641519132931.log
-rw-r--r-- 1 root root 1679 Jan 6 19:39 sort.pig
-rw-r--r-- 1 hduser hadoop 2608 Jan 6 19:39 pig_1641519582130.log
hduser@ubuntu:~$ start-dfs.sh
22/01/16 19:35:57 WARN util.NativeCodeLoader: Unable to load native-hadoop library
for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /usr/local/hadoop/logs/hadoop-hduser-
namenode-ubuntu.out
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-hduser-
datanode-ubuntu.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-
hduser-secondarynamenode-ubuntu.out
22/01/16 19:36:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library
for your platform... using builtin-java classes where applicable
hduser@ubuntu:~$ start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop/logs/yarn-hduser-
resourcemanager-ubuntu.out
localhost: starting nodemanager, logging to /usr/local/hadoop/logs/yarn-hduser-
nodemanager-ubuntu.out
hduser@ubuntu:~$ start-hbase.sh
localhost: starting zookeeper, logging to /usr/local/hbase/bin/../logs/hbase-
hduser-zookeeper-ubuntu.out
starting master, logging to /usr/local/hbase/logs/hbase-hduser-master-ubuntu.out
OpenJDK 64-Bit Server VM warning: ignoring option PermSize=128m; support was
removed in 8.0
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was
removed in 8.0
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/usr/local/hbase/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/
StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop/share/hadoop/common/lib/slf4j-
log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
starting regionserver, logging to /usr/local/hbase/logs/hbase-hduser-1-
regionserver-ubuntu.out
hduser@ubuntu:~$ jps
4912 HMaster
5042 HRegionServer
2727 DataNode
4088 ResourceManager
4842 HQuorumPeer
4266 NodeManager
2510 NameNode
2991 SecondaryNameNode
5295 Jps
hduser@ubuntu:~$ ls -ltr
total 64
-rw-r--r-- 1 root root 84 Dec 27 22:13 samplefile
drwxr-xr-x 3 hduser hadoop 4096 Dec 27 23:46 mydata
-rw-r--r-- 1 root root 127 Jan 3 20:07 empdata
-rw-r--r-- 1 root root 127 Jan 3 20:16 empdata1
-rw-r--r-- 1 root root 127 Jan 3 20:19 empdata2
drwxr-xr-x 2 hduser hadoop 4096 Jan 4 20:15 filter1
-rw-r--r-- 1 root root 54 Jan 4 20:22 filterdata
-rw-r--r-- 1 root root 51 Jan 5 19:42 groupdata
-rw-r--r-- 1 root root 54 Jan 5 20:01 Co1
-rw-r--r-- 1 root root 42 Jan 5 20:01 Co2
-rw-r--r-- 1 root root 280 Jan 5 20:08 cogroup.pig
drwxr-xr-x 2 hduser hadoop 4096 Jan 5 20:15 Cogroup
-rw-r--r-- 1 root root 36 Jan 5 20:16 sort1
-rw-r--r-- 1 hduser hadoop 2608 Jan 6 19:32 pig_1641519132931.log
-rw-r--r-- 1 root root 1679 Jan 6 19:39 sort.pig
-rw-r--r-- 1 hduser hadoop 2608 Jan 6 19:39 pig_1641519582130.log
hduser@ubuntu:~$ cd /user/local
-su: cd: /user/local: No such file or directory
hduser@ubuntu:~$ cd user
-su: cd: user: No such file or directory
hduser@ubuntu:~$ ls -ltr
total 64
-rw-r--r-- 1 root root 84 Dec 27 22:13 samplefile
drwxr-xr-x 3 hduser hadoop 4096 Dec 27 23:46 mydata
-rw-r--r-- 1 root root 127 Jan 3 20:07 empdata
-rw-r--r-- 1 root root 127 Jan 3 20:16 empdata1
-rw-r--r-- 1 root root 127 Jan 3 20:19 empdata2
drwxr-xr-x 2 hduser hadoop 4096 Jan 4 20:15 filter1
-rw-r--r-- 1 root root 54 Jan 4 20:22 filterdata
-rw-r--r-- 1 root root 51 Jan 5 19:42 groupdata
-rw-r--r-- 1 root root 54 Jan 5 20:01 Co1
-rw-r--r-- 1 root root 42 Jan 5 20:01 Co2
-rw-r--r-- 1 root root 280 Jan 5 20:08 cogroup.pig
drwxr-xr-x 2 hduser hadoop 4096 Jan 5 20:15 Cogroup
-rw-r--r-- 1 root root 36 Jan 5 20:16 sort1
-rw-r--r-- 1 hduser hadoop 2608 Jan 6 19:32 pig_1641519132931.log
-rw-r--r-- 1 root root 1679 Jan 6 19:39 sort.pig
-rw-r--r-- 1 hduser hadoop 2608 Jan 6 19:39 pig_1641519582130.log
hduser@ubuntu:~$ cd /usr/local
hduser@ubuntu:/usr/local$ ls -ltr
total 1002320
-rw-r--r-- 1 root root 102487389 Jun 23 2015 hbase-1.1.1-bin.tar.gz
-rw-r--r-- 1 root root 90859180 Jul 2 2020 apache-hive-1.2.2-bin.tar.gz
-rw-r--r-- 1 root root 366447449 Jul 2 2020 hadoop-2.9.2.tar.gz
-rw-r--r-- 1 root root 230606579 Jul 6 2020 pig-0.17.0.tar.gz
drwxr-xr-x 13 hduser hadoop 4096 May 8 2021 spark
-rw-r--r-- 1 root root 235899716 May 8 2021 spark-2.4.8-bin-hadoop2.7.tgz
drwxr-xr-x 2 root root 4096 Sep 15 15:17 src
drwxr-xr-x 2 root root 4096 Sep 15 15:17 sbin
drwxr-xr-x 2 root root 4096 Sep 15 15:17 include
drwxr-xr-x 2 root root 4096 Sep 15 15:17 games
drwxr-xr-x 2 root root 4096 Sep 15 15:17 etc
drwxr-xr-x 2 root root 4096 Sep 15 15:17 bin
drwxr-xr-x 6 root root 4096 Sep 15 15:23 share
lrwxrwxrwx 1 root root 9 Dec 15 00:50 man -> share/man
drwxr-xr-x 3 root root 4096 Dec 15 00:53 lib
drwxr-xr-x 10 hduser hadoop 4096 Dec 27 22:17 hadoop
drwxr-xr-x 16 hduser hadoop 4096 Jan 6 19:41 pig
drwxr-xr-x 8 hduser hadoop 4096 Jan 6 20:51 hive
drwxr-xr-x 8 hduser hadoop 4096 Jan 9 20:28 hbase
hduser@ubuntu:/usr/local$ jps
4912 HMaster
5042 HRegionServer
6054 Jps
2727 DataNode
4088 ResourceManager
4842 HQuorumPeer
4266 NodeManager
2510 NameNode
2991 SecondaryNameNode
hduser@ubuntu:/usr/local$ hadoop -version
Error: No command named `-version' was found. Perhaps you meant `hadoop version'
hduser@ubuntu:/usr/local$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
hduser@ubuntu:/usr/local$ hadoop version
Hadoop 2.9.2
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r
826afbeae31ca687bc2f8471dc841b66ed2c6704
Compiled by ajisaka on 2018-11-13T12:42Z
Compiled with protoc 2.5.0
From source with checksum 3a9939967262218aa556c684d107985
This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-
2.9.2.jar
hduser@ubuntu:/usr/local$ curl -fsSL https://www.mongodb.org/static/pgp/server-
4.4.asc | sudo apt-key add -
[sudo] password for hduser:
Command 'curl' not found, but can be installed with:

sudo snap install curl # version 7.80.0, or


sudo apt install curl

See 'snap info curl' for additional versions.

hduser@ubuntu:/usr/local$ sudo apt install curl


[sudo] password for hduser:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-liberation2 fonts-opensymbol gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-
1.0 gir1.2-gudev-1.0 gir1.2-udisks-2.0 grilo-plugins-0.3-base gstreamer1.0-gtk3
libboost-date-time1.65.1 libboost-filesystem1.65.1 libboost-iostreams1.65.1
libboost-locale1.65.1 libcdr-0.1-1 libclucene-contribs1v5 libclucene-core1v5
libcmis-0.5-5v5 libcolamd2
libdazzle-1.0-0 libe-book-0.1-1 libedataserverui-1.2-2 libeot0 libepubgen-0.1-1
libetonyek-0.1-1 libevent-2.1-6 libexiv2-14 libfreerdp-client2-2 libfreerdp2-2
libgc1c2
libgee-0.8-2 libgexiv2-2 libgom-1.0-0 libgpgmepp6 libgpod-common libgpod4
liblangtag-common liblangtag1 liblirc-client0 liblua5.3-0 libmediaart-2.0-0
libmspub-0.1-1
libodfgen-0.1-1 libqqwing2v5 libraw16 librevenge-0.0-0 libsgutils2-2 libssh-4
libsuitesparseconfig5 libvncclient1 libwinpr2-2 libxapian30 libxmlsec1-nss
linux-hwe-5.4-headers-5.4.0-84 linux-hwe-5.4-headers-5.4.0-91 lp-solve media-
player-info python3-mako python3-markupsafe syslinux syslinux-common syslinux-
legacy
usb-creator-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libcurl4
The following NEW packages will be installed:
curl libcurl4
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 378 kB of archives.
After this operation, 1,053 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcurl4 amd64
7.58.0-2ubuntu3.16 [220 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 curl amd64
7.58.0-2ubuntu3.16 [159 kB]
Fetched 378 kB in 1s (598 kB/s)
Selecting previously unselected package libcurl4:amd64.
(Reading database ... 189891 files and directories currently installed.)
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.16_amd64.deb ...
Unpacking libcurl4:amd64 (7.58.0-2ubuntu3.16) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.58.0-2ubuntu3.16_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.16) ...
Setting up libcurl4:amd64 (7.58.0-2ubuntu3.16) ...
Setting up curl (7.58.0-2ubuntu3.16) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
hduser@ubuntu:/usr/local$ curl -fsSL https://www.mongodb.org/static/pgp/server-
4.4.asc | sudo apt-key add -
OK
hduser@ubuntu:/usr/local$ apt-key list
/etc/apt/trusted.gpg
--------------------
pub rsa4096 2019-05-28 [SC] [expires: 2024-05-26]
2069 1EEC 3521 6C63 CAF6 6CE1 6564 08E3 90CF B1F5
uid [ unknown] MongoDB 4.4 Release Signing Key <[email protected]>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-archive.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
790B C727 7767 219C 42C8 6F93 3B4F E6AC C0B2 1F32
uid [ unknown] Ubuntu Archive Automatic Signing Key (2012)
<[email protected]>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092
uid [ unknown] Ubuntu CD Image Automatic Signing Key (2012)
<[email protected]>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub rsa4096 2018-09-17 [SC]
F6EC B376 2474 EDA9 D21B 7022 8719 20D1 991B C93C
uid [ unknown] Ubuntu Archive Automatic Signing Key (2018)
<[email protected]>

hduser@ubuntu:/usr/local$ echo "deb [ arch=amd64,arm64 ]


https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo
tee /etc/apt/sources.list.d/mongodb-org-4.4.listdeb [ arch=amd64,arm64 ]
https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse
hduser@ubuntu:/usr/local$ sudo apt update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
Ign:4 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:6 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 Release [5,380 B]
Get:7 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 Release.gpg [801
B]
Get:8 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
Packages [19.9 kB]
Get:9 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse arm64
Packages [15.3 kB]
Fetched 41.5 kB in 1s (46.0 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
hduser@ubuntu:/usr/local$ sudo apt install mongodb-org
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-liberation2 fonts-opensymbol gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-
1.0 gir1.2-gudev-1.0 gir1.2-udisks-2.0 grilo-plugins-0.3-base gstreamer1.0-gtk3
libboost-date-time1.65.1 libboost-filesystem1.65.1 libboost-iostreams1.65.1
libboost-locale1.65.1 libcdr-0.1-1 libclucene-contribs1v5 libclucene-core1v5
libcmis-0.5-5v5 libcolamd2
libdazzle-1.0-0 libe-book-0.1-1 libedataserverui-1.2-2 libeot0 libepubgen-0.1-1
libetonyek-0.1-1 libevent-2.1-6 libexiv2-14 libfreerdp-client2-2 libfreerdp2-2
libgc1c2
libgee-0.8-2 libgexiv2-2 libgom-1.0-0 libgpgmepp6 libgpod-common libgpod4
liblangtag-common liblangtag1 liblirc-client0 liblua5.3-0 libmediaart-2.0-0
libmspub-0.1-1
libodfgen-0.1-1 libqqwing2v5 libraw16 librevenge-0.0-0 libsgutils2-2 libssh-4
libsuitesparseconfig5 libvncclient1 libwinpr2-2 libxapian30 libxmlsec1-nss
linux-hwe-5.4-headers-5.4.0-84 linux-hwe-5.4-headers-5.4.0-91 lp-solve media-
player-info python3-mako python3-markupsafe syslinux syslinux-common syslinux-
legacy
usb-creator-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
mongodb-database-tools mongodb-org-database-tools-extra mongodb-org-mongos
mongodb-org-server mongodb-org-shell mongodb-org-tools
The following NEW packages will be installed:
mongodb-database-tools mongodb-org mongodb-org-database-tools-extra mongodb-org-
mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
0 upgraded, 7 newly installed, 0 to remove and 1 not upgraded.
Need to get 96.5 MB of archives.
After this operation, 202 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
mongodb-database-tools amd64 100.5.1 [46.5 MB]
Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
mongodb-org-shell amd64 4.4.11 [13.3 MB]
Get:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
mongodb-org-server amd64 4.4.11 [20.7 MB]
Get:4 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
mongodb-org-mongos amd64 4.4.11 [15.9 MB]
Get:5 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
mongodb-org-database-tools-extra amd64 4.4.11 [7,752 B]
Get:6 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
mongodb-org-tools amd64 4.4.11 [2,896 B]
Get:7 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4/multiverse amd64
mongodb-org amd64 4.4.11 [3,524 B]
Fetched 96.5 MB in 4s (23.1 MB/s)
Selecting previously unselected package mongodb-database-tools.
(Reading database ... 189904 files and directories currently installed.)
Preparing to unpack .../0-mongodb-database-tools_100.5.1_amd64.deb ...
Unpacking mongodb-database-tools (100.5.1) ...
Selecting previously unselected package mongodb-org-shell.
Preparing to unpack .../1-mongodb-org-shell_4.4.11_amd64.deb ...
Unpacking mongodb-org-shell (4.4.11) ...
Selecting previously unselected package mongodb-org-server.
Preparing to unpack .../2-mongodb-org-server_4.4.11_amd64.deb ...
Unpacking mongodb-org-server (4.4.11) ...
Selecting previously unselected package mongodb-org-mongos.
Preparing to unpack .../3-mongodb-org-mongos_4.4.11_amd64.deb ...
Unpacking mongodb-org-mongos (4.4.11) ...
Selecting previously unselected package mongodb-org-database-tools-extra.
Preparing to unpack .../4-mongodb-org-database-tools-extra_4.4.11_amd64.deb ...
Unpacking mongodb-org-database-tools-extra (4.4.11) ...
Selecting previously unselected package mongodb-org-tools.
Preparing to unpack .../5-mongodb-org-tools_4.4.11_amd64.deb ...
Unpacking mongodb-org-tools (4.4.11) ...
Selecting previously unselected package mongodb-org.
Preparing to unpack .../6-mongodb-org_4.4.11_amd64.deb ...
Unpacking mongodb-org (4.4.11) ...
Setting up mongodb-org-shell (4.4.11) ...
Setting up mongodb-org-database-tools-extra (4.4.11) ...
Setting up mongodb-database-tools (100.5.1) ...
Setting up mongodb-org-mongos (4.4.11) ...
Setting up mongodb-org-tools (4.4.11) ...
Setting up mongodb-org-server (4.4.11) ...
Adding system user `mongodb' (UID 123) ...
Adding new user `mongodb' (UID 123) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
Adding group `mongodb' (GID 127) ...
Done.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
Setting up mongodb-org (4.4.11) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
hduser@ubuntu:/usr/local$ sudo systemctl start mongod.service
hduser@ubuntu:/usr/local$ sudo systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset:
enabled)
Active: active (running) since Sun 2022-01-16 20:15:10 CST; 18s ago
Docs: https://docs.mongodb.org/manual
Main PID: 8385 (mongod)
CGroup: /system.slice/mongod.service
└─8385 /usr/bin/mongod --config /etc/mongod.conf

Jan 16 20:15:10 ubuntu systemd[1]: Started MongoDB Database Server.


hduser@ubuntu:/usr/local$ sudo systemctl enable mongod
********************************
Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service →
/lib/systemd/system/mongod.service.
hduser@ubuntu:/usr/local$ mongo --eval 'db.runCommand({ connectionStatus: 1 })'
MongoDB shell version v4.4.11
connecting to: mongodb://127.0.0.1:27017/?
compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("f8dfd248-6f57-4150-aaa5-f4a05d3d65cc") }
MongoDB server version: 4.4.11
{
"authInfo" : {
"authenticatedUsers" : [ ],
"authenticatedUserRoles" : [ ]
},
"ok" : 1
}
hduser@ubuntu:/usr/local$ mongo
*******************************
MongoDB shell version v4.4.11
connecting to: mongodb://127.0.0.1:27017/?
compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("87409c10-9ed8-42dc-863a-254b2d4b612c") }
MongoDB server version: 4.4.11
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
https://community.mongodb.com
---
The server generated these startup warnings when booting:
2022-01-16T20:15:10.084-06:00: Using the XFS filesystem is strongly
recommended with the WiredTiger storage engine. See
http://dochub.mongodb.org/core/prodnotes-filesystem
2022-01-16T20:15:10.184-06:00: Access control is not enabled for the
database. Read and write access to data and configuration is unrestricted
---
---
Enable MongoDB's free cloud-based monitoring service, which will then
receive and display
metrics about your deployment (disk utilization, CPU, operation statistics,
etc).

The monitoring data will be available on a MongoDB website with a unique


URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make
product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command:


db.enableFreeMonitoring()
To permanently disable this reminder, run the following command:
db.disableFreeMonitoring()
---
>
> db.enableFreeMonitoring()
{
"state" : "enabled",
"message" : "To see your monitoring data, navigate to the unique URL below.
Anyone you share the URL with will also be able to view this page. You can disable
monitoring at any time by running db.disableFreeMonitoring().",
"url" :
"https://cloud.mongodb.com/freemonitoring/cluster/KNV5AINBDLHADDYVCPGWKTCWD4URS7W6"
,
"userReminder" : "",
"ok" : 1
}
> show dbs;
*************************************************************
admin 0.000GB
config 0.000GB
local 0.000GB
> db
*******************************************************
test
> use Sumant;
switched to db Sumant
> db
Sumant
>
> db.movies.insertMany([
***********************************************************
... {
... title: 'Titanic',
... year: 1997,
... genres: [ 'Drama', 'Romance' ],
... rated: 'PG-13',
... languages: [ 'English', 'French', 'German', 'Swedish', 'Italian',
'Russian' ],
... released: ISODate("1997-12-19T00:00:00.000Z"),
... awards: {
... wins: 127,
... nominations: 63,
... text: 'Won 11 Oscars. Another 116 wins & 63 nominations.'
... },
... cast: [ 'Leonardo DiCaprio', 'Kate Winslet', 'Billy Zane', 'Kathy
Bates' ],
... directors: [ 'James Cameron' ]
... },
... {
... title: 'The Dark Knight',
... year: 2008,
... genres: [ 'Action', 'Crime', 'Drama' ],
... rated: 'PG-13',
... languages: [ 'English', 'Mandarin' ],
... released: ISODate("2008-07-18T00:00:00.000Z"),
... awards: {
... wins: 144,
... nominations: 106,
... text: 'Won 2 Oscars. Another 142 wins & 106 nominations.'
... },
... cast: [ 'Christian Bale', 'Heath Ledger', 'Aaron Eckhart', 'Michael
Caine' ],
... directors: [ 'Christopher Nolan' ]
... },
... {
... title: 'Spirited Away',
... year: 2001,
... genres: [ 'Animation', 'Adventure', 'Family' ],
... rated: 'PG',
... languages: [ 'Japanese' ],
... released: ISODate("2003-03-28T00:00:00.000Z"),
... awards: {
... wins: 52,
... nominations: 22,
... text: 'Won 1 Oscar. Another 51 wins & 22 nominations.'
... },
... cast: [ 'Rumi Hiiragi', 'Miyu Irino', 'Mari Natsuki', 'Takashi Naitè' ],
... directors: [ 'Hayao Miyazaki' ]
... },
... {
... title: 'Casablanca',
... genres: [ 'Drama', 'Romance', 'War' ],
... rated: 'PG',
... cast: [ 'Humphrey Bogart', 'Ingrid Bergman', 'Paul Henreid', 'Claude
Rains' ],
... languages: [ 'English', 'French', 'German', 'Italian' ],
... released: ISODate("1943-01-23T00:00:00.000Z"),
... directors: [ 'Michael Curtiz' ],
... awards: {
... wins: 9,
... nominations: 6,
... text: 'Won 3 Oscars. Another 6 wins & 6 nominations.'
... },
... lastupdated: '2015-09-04 00:22:54.600000000',
... year: 1942
... }
... ])
{
"acknowledged" : true,
"insertedIds" : [
ObjectId("61e4d38d3dff0ee1b29296a8"),
ObjectId("61e4d38d3dff0ee1b29296a9"),
ObjectId("61e4d38d3dff0ee1b29296aa"),
ObjectId("61e4d38d3dff0ee1b29296ab")
]
}
> db.movies.find()
**************************************************************************
{ "_id" : ObjectId("61e4d38d3dff0ee1b29296a8"), "title" : "Titanic", "year" : 1997,
"genres" : [ "Drama", "Romance" ], "rated" : "PG-13", "languages" : [ "English",
"French", "German", "Swedish", "Italian", "Russian" ], "released" : ISODate("1997-
12-19T00:00:00Z"), "awards" : { "wins" : 127, "nominations" : 63, "text" : "Won 11
Oscars. Another 116 wins & 63 nominations." }, "cast" : [ "Leonardo DiCaprio",
"Kate Winslet", "Billy Zane", "Kathy Bates" ], "directors" : [ "James Cameron" ] }
{ "_id" : ObjectId("61e4d38d3dff0ee1b29296a9"), "title" : "The Dark Knight", "year"
: 2008, "genres" : [ "Action", "Crime", "Drama" ], "rated" : "PG-13", "languages" :
[ "English", "Mandarin" ], "released" : ISODate("2008-07-18T00:00:00Z"), "awards" :
{ "wins" : 144, "nominations" : 106, "text" : "Won 2 Oscars. Another 142 wins & 106
nominations." }, "cast" : [ "Christian Bale", "Heath Ledger", "Aaron Eckhart",
"Michael Caine" ], "directors" : [ "Christopher Nolan" ] }
{ "_id" : ObjectId("61e4d38d3dff0ee1b29296aa"), "title" : "Spirited Away", "year" :
2001, "genres" : [ "Animation", "Adventure", "Family" ], "rated" : "PG",
"languages" : [ "Japanese" ], "released" : ISODate("2003-03-28T00:00:00Z"),
"awards" : { "wins" : 52, "nominations" : 22, "text" : "Won 1 Oscar. Another 51
wins & 22 nominations." }, "cast" : [ "Rumi Hiiragi", "Miyu Irino", "Mari Natsuki",
"Takashi Naitè" ], "directors" : [ "Hayao Miyazaki" ] }
{ "_id" : ObjectId("61e4d38d3dff0ee1b29296ab"), "title" : "Casablanca", "genres" :
[ "Drama", "Romance", "War" ], "rated" : "PG", "cast" : [ "Humphrey Bogart",
"Ingrid Bergman", "Paul Henreid", "Claude Rains" ], "languages" : [ "English",
"French", "German", "Italian" ], "released" : ISODate("1943-01-23T00:00:00Z"),
"directors" : [ "Michael Curtiz" ], "awards" : { "wins" : 9, "nominations" : 6,
"text" : "Won 3 Oscars. Another 6 wins & 6 nominations." }, "lastupdated" : "2015-
09-04 00:22:54.600000000", "year" : 1942 }
> db.movies.find().pretty()
**************************************************************************
{
"_id" : ObjectId("61e4d38d3dff0ee1b29296a8"),
"title" : "Titanic",
"year" : 1997,
"genres" : [
"Drama",
"Romance"
],
"rated" : "PG-13",
"languages" : [
"English",
"French",
"German",
"Swedish",
"Italian",
"Russian"
],
"released" : ISODate("1997-12-19T00:00:00Z"),
"awards" : {
"wins" : 127,
"nominations" : 63,
"text" : "Won 11 Oscars. Another 116 wins & 63 nominations."
},
"cast" : [
"Leonardo DiCaprio",
"Kate Winslet",
"Billy Zane",
"Kathy Bates"
],
"directors" : [
"James Cameron"
]
}
{
"_id" : ObjectId("61e4d38d3dff0ee1b29296a9"),
"title" : "The Dark Knight",
"year" : 2008,
"genres" : [
"Action",
"Crime",
"Drama"
],
"rated" : "PG-13",
"languages" : [
"English",
"Mandarin"
],
"released" : ISODate("2008-07-18T00:00:00Z"),
"awards" : {
"wins" : 144,
"nominations" : 106,
"text" : "Won 2 Oscars. Another 142 wins & 106 nominations."
},
"cast" : [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart",
"Michael Caine"
],
"directors" : [
"Christopher Nolan"
]
}
{
"_id" : ObjectId("61e4d38d3dff0ee1b29296aa"),
"title" : "Spirited Away",
"year" : 2001,
"genres" : [
"Animation",
"Adventure",
"Family"
],
"rated" : "PG",
"languages" : [
"Japanese"
],
"released" : ISODate("2003-03-28T00:00:00Z"),
"awards" : {
"wins" : 52,
"nominations" : 22,
"text" : "Won 1 Oscar. Another 51 wins & 22 nominations."
},
"cast" : [
"Rumi Hiiragi",
"Miyu Irino",
"Mari Natsuki",
"Takashi Naitè"
],
"directors" : [
"Hayao Miyazaki"
]
}
{
"_id" : ObjectId("61e4d38d3dff0ee1b29296ab"),
"title" : "Casablanca",
"genres" : [
"Drama",
"Romance",
"War"
],
"rated" : "PG",
"cast" : [
"Humphrey Bogart",
"Ingrid Bergman",
"Paul Henreid",
"Claude Rains"
],
"languages" : [
"English",
"French",
"German",
"Italian"
],
"released" : ISODate("1943-01-23T00:00:00Z"),
"directors" : [
"Michael Curtiz"
],
"awards" : {
"wins" : 9,
"nominations" : 6,
"text" : "Won 3 Oscars. Another 6 wins & 6 nominations."
},
"lastupdated" : "2015-09-04 00:22:54.600000000",
"year" : 1942
}
>

You might also like