M201: MongoDB Performance chapter 1 Introduction学习记录

M201: MongoDB Performance chapter 1 Introduction学习记录

运行环境

操作系统:windows 10 家庭中文版
Mongodb :Mongodb 3.4

Mongodb安装路径:E:>MongoDB\Server\3.4\bin\
Mongodb存储路径:E:>MongoDB\data

课后问题

lab1.1

Welcome to your first lab in M201! In this lab you’re going to install MongoDB Enterprise 3.4 and import the people dataset.

You can download the people.json dataset here.

While MongoDB Enterprise is available as part of the MongoDB Enterprise Advanced subscription it’s permitted to be ran outside of production environments.

In order to install MongoDB you’re going to need to head over to our online documentation and follow the instructions on installing MongoDB.

After you’ve successfully installed MongoDB you should start a standalone server. Once your sever is up and running you should be able to download the people.json handout and import it with mongoimport. Make sure to import the documents into the m201 database and the people collection.

To confirm that you’ve successfully completed these steps run the following query on the m201 database from the mongo shell and paste it’s output into the submission area below:

> db.people.count({ "email" : {"$exists": 1} })

解答

启动mongod守护进程:

C:\Users\Shinelon>e:

E:\>MongoDB\Server\3.4\bin\mongod.exe --dbpath MongoDB\data
2018-04-16T08:43:34.604-0700 I CONTROL  [initandlisten] MongoDB starting : pid=7500 port=27017 dbpath=MongoDB\data 64-bit host=DESKTOP-MP9NVQ7
2018-04-16T08:43:34.605-0700 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-04-16T08:43:34.605-0700 I CONTROL  [initandlisten] db version v3.4.6
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten] git version: c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips  22 Sep 2016
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten] allocator: tcmalloc
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten] modules: none
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten] build environment:
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten]     distarch: x86_64
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2018-04-16T08:43:34.606-0700 I CONTROL  [initandlisten] options: { storage: { dbPath: "MongoDB\data" } }
2018-04-16T08:43:34.634-0700 I -        [initandlisten] Detected data files in MongoDB\data created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-04-16T08:43:34.635-0700 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7656M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2018-04-16T08:43:35.494-0700 I CONTROL  [initandlisten]
2018-04-16T08:43:35.495-0700 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-04-16T08:43:35.495-0700 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-04-16T08:43:35.495-0700 I CONTROL  [initandlisten]
2018-04-16T23:43:35.738+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'MongoDB/data/diagnostic.data'
2018-04-16T23:43:35.741+0800 I NETWORK  [thread1] waiting for connections on port 27017

按要求下载people.json文件至路径E:\MongoDB\m201\chapter_1_introduction,导入json文件:

C:\Users\Shinelon>e:

E:\>MongoDB\Server\3.4\bin\mongoimport.exe -d m201 -c people MongoDB\m201\chapter_1_introduction\people.json
2018-04-16T23:43:44.703+0800    connected to: localhost
2018-04-16T23:43:46.141+0800    imported 50474 documents

进入mongo:

E:\>MongoDB\Server\3.4\bin\mongo.exe
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.6
Server has startup warnings:
2018-04-16T08:43:35.494-0700 I CONTROL  [initandlisten]
2018-04-16T08:43:35.495-0700 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-04-16T08:43:35.495-0700 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-04-16T08:43:35.495-0700 I CONTROL  [initandlisten]

切换至m201库:

> use m201
switched to db m201

执行给出的函数:

> db.people.count({ "email" : {"$exists": 1} })
50474

猜你喜欢

转载自blog.csdn.net/sunbocong/article/details/79968651
今日推荐