操作系统:windows 10 家庭中文版
Mongodb :Mongodb 3.4
Mongodb安装路径:E:>MongoDB\Server\3.4\bin\
Mongodb存储路径:E:>MongoDB\data
Download Handouts:
m312/m312-vagrant-env.zip
m312/lab2.1.zip
In this lab, we are going to get you to start identifying issues with a single mongod instance.
First, we start by launching a single mongod using the configuration file single.cfg
mongod --config /shared/single.cfg
Second, you should launch a small script, that is also available with this lab handouts, called singleapp.py
python /shared/singleapp.py
Both of these steps need to be launched from within our vagrant environment m312-vagrant-env.
To be able to launch both the mongod and the python script, you need to make sure that the vagrant image has access to the handout material. To do that, you need to:
cp single.cfg m312-vagrant-env/shared
cp singleapp.py m312-vagrant-env/shared
Given this single.cfg configuration and the singleapp.py application, a few issues will be logged in the mongod log file.
Which MongoDB component is reporting these issues ?
Ignore any filesystem or access control warnings!
按照要求下载vagrant环境并进入:
C:\Users\Shinelon>e:
E:\>cd MongoDB\m312\chapter_2_tooling_overview\m312-vagrant-env
启动vagrant:
E:\MongoDB\m312\chapter_1_introduction\m312-vagrant-env>vagrant up
Bringing machine 'm312' up with 'virtualbox' provider...
==> m312: Importing base box 'ubuntu/trusty64'...
==> m312: Matching MAC address for NAT networking...
==> m312: Setting the name of the VM: m312
···xxx···
···xxx···
···xxx···
代码参见M312: Diagnostics and Debugging chapter 1 Introduction学习记录
进入box:
E:\MongoDB\m312\chapter_2_tooling_overview\m312-vagrant-env>vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-144-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Tue Apr 17 07:18:59 UTC 2018
System load: 0.08 Processes: 85
Usage of /: 3.7% of 39.34GB Users logged in: 0
Memory usage: 4% IP address for eth0: 10.0.2.15
Swap usage: 0% IP address for eth1: 192.168.14.100
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
New release '16.04.4 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Tue Apr 17 07:18:59 2018 from 10.0.2.2
将下载的lab2.1压缩包解压并拷贝到路径E:\MongoDB\m312\chapter_2_tooling_overview\m312-vagrant-env\shard,在box中验证:
root@m312:/home/vagrant# ls /shared/
lab2.1
确认文件已考入,执行给出的脚本:
root@m312:/home/vagrant# mongod --config /shared/lab2.1/single.cfg
about to fork child process, waiting until server is ready for connections.
forked process: 6902
child process started successfully, parent exiting
root@m312:/home/vagrant# python /shared/lab2.1/singleapp.py
查看生成的日志文件:
vim /home/vagrant/single.log
2018-04-17T07:46:09.482+0000 I CONTROL [initandlisten] MongoDB starting : pid=6902 port=27000 dbpath=/home/vagrant/data 64-bit host=m312
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] db version v3.4.2
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] allocator: tcmalloc
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] modules: enterprise
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] build environment:
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] distarch: x86_64
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] target_arch: x86_64
2018-04-17T07:46:09.483+0000 I CONTROL [initandlisten] options: { config: "/shared/lab2.1/single.cfg", net: { maxIncomingConnections: 10, port: 27000 }, processManagement: { fork: true }, storage: { dbPath: "/home/vagrant/data" }, systemLog: { destination: "file", path: "/home/vagrant/single.log" } }
2018-04-17T07:46:09.483+0000 I STORAGE [initandlisten]
2018-04-17T07:46:09.483+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2018-04-17T07:46:09.483+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2018-04-17T07:46:09.483+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1464M,session_max=20000,eviction=(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-17T07:46:09.580+0000 I CONTROL [initandlisten]
2018-04-17T07:46:09.580+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-04-17T07:46:09.580+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-04-17T07:46:09.580+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-04-17T07:46:09.580+0000 I CONTROL [initandlisten]
2018-04-17T07:46:09.600+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/home/vagrant/data/diagnostic.data'
2018-04-17T07:46:09.640+0000 I INDEX [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: "incompatible_with_version_32", ns: "admin.system.version" }
2018-04-17T07:46:09.640+0000 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2018-04-17T07:46:09.642+0000 I INDEX [initandlisten] build index done. scanned 0 total records. 0 secs
2018-04-17T07:46:09.642+0000 I COMMAND [initandlisten] setting featureCompatibilityVersion to 3.4
2018-04-17T07:46:09.642+0000 I NETWORK [thread1] waiting for connections on port 27000
2018-04-17T07:48:26.004+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42902 #1 (1 connection now open)
2018-04-17T07:48:26.008+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42903 #2 (2 connections now open)
2018-04-17T07:48:26.013+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42904 #3 (3 connections now open)
2018-04-17T07:48:26.013+0000 I NETWORK [conn1] received client metadata from 127.0.0.1:42902 conn1: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.014+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42905 #4 (4 connections now open)
2018-04-17T07:48:26.014+0000 I NETWORK [conn3] received client metadata from 127.0.0.1:42904 conn3: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.014+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42906 #5 (5 connections now open)
2018-04-17T07:48:26.014+0000 I NETWORK [conn4] received client metadata from 127.0.0.1:42905 conn4: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.018+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42907 #6 (6 connections now open)
2018-04-17T07:48:26.019+0000 I NETWORK [conn6] received client metadata from 127.0.0.1:42907 conn6: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.019+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42908 #7 (7 connections now open)
2018-04-17T07:48:26.020+0000 I NETWORK [conn2] received client metadata from 127.0.0.1:42903 conn2: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.019+0000 I NETWORK [conn5] received client metadata from 127.0.0.1:42906 conn5: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.022+0000 I NETWORK [conn7] received client metadata from 127.0.0.1:42908 conn7: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.023+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42909 #8 (8 connections now open)
2018-04-17T07:48:26.024+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42910 #9 (9 connections now open)
2018-04-17T07:48:26.024+0000 I NETWORK [conn8] received client metadata from 127.0.0.1:42909 conn8: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.024+0000 I NETWORK [conn9] received client metadata from 127.0.0.1:42910 conn9: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.025+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42911 #10 (10 connections now open)
2018-04-17T07:48:26.025+0000 I NETWORK [conn10] received client metadata from 127.0.0.1:42911 conn10: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.030+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42912 #11 (11 connections now open)
2018-04-17T07:48:26.030+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.030+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42913 #12 (11 connections now open)
2018-04-17T07:48:26.030+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.030+0000 I - [conn2] end connection 127.0.0.1:42903 (10 connections now open)
2018-04-17T07:48:26.031+0000 I - [conn6] end connection 127.0.0.1:42907 (9 connections now open)
2018-04-17T07:48:26.033+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42914 #13 (9 connections now open)
2018-04-17T07:48:26.033+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42915 #14 (10 connections now open)
2018-04-17T07:48:26.033+0000 I NETWORK [conn12] received client metadata from 127.0.0.1:42915 conn12: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.033+0000 I NETWORK [conn11] received client metadata from 127.0.0.1:42914 conn11: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.034+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42916 #15 (11 connections now open)
2018-04-17T07:48:26.034+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.035+0000 I - [conn12] end connection 127.0.0.1:42915 (10 connections now open)
2018-04-17T07:48:26.035+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42917 #16 (10 connections now open)
2018-04-17T07:48:26.035+0000 I NETWORK [conn13] received client metadata from 127.0.0.1:42917 conn13: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.036+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42918 #17 (11 connections now open)
2018-04-17T07:48:26.036+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.036+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42919 #18 (11 connections now open)
2018-04-17T07:48:26.036+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.042+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42920 #19 (11 connections now open)
2018-04-17T07:48:26.042+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.055+0000 I - [conn4] end connection 127.0.0.1:42905 (10 connections now open)
2018-04-17T07:48:26.055+0000 I - [conn8] end connection 127.0.0.1:42909 (9 connections now open)
2018-04-17T07:48:26.538+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42921 #20 (9 connections now open)
2018-04-17T07:48:26.538+0000 I NETWORK [conn14] received client metadata from 127.0.0.1:42921 conn14: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.538+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42922 #21 (10 connections now open)
2018-04-17T07:48:26.538+0000 I NETWORK [conn15] received client metadata from 127.0.0.1:42922 conn15: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.539+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42923 #22 (11 connections now open)
2018-04-17T07:48:26.539+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.539+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42924 #23 (11 connections now open)
2018-04-17T07:48:26.539+0000 I NETWORK [thread1] connection refused because too many open connections: 10
2018-04-17T07:48:26.539+0000 I - [conn15] end connection 127.0.0.1:42922 (10 connections now open)
2018-04-17T07:48:26.540+0000 I - [conn14] end connection 127.0.0.1:42921 (9 connections now open)
2018-04-17T07:48:26.543+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42925 #24 (9 connections now open)
2018-04-17T07:48:26.543+0000 I NETWORK [conn16] received client metadata from 127.0.0.1:42925 conn16: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:26.545+0000 I NETWORK [thread1] connection accepted from 127.0.0.1:42926 #25 (10 connections now open)
2018-04-17T07:48:26.545+0000 I NETWORK [conn17] received client metadata from 127.0.0.1:42926 conn17: { driver: { name: "PyMongo", version: "3.6.1" }, os: { type: "Linux", name: "Ubuntu 14.04 trusty", architecture: "x86_64", version: "3.13.0-144-generic" }, platform: "CPython 2.7.6.final.0" }
2018-04-17T07:48:46.058+0000 I - [conn7] end connection 127.0.0.1:42908 (10 connections now open)
2018-04-17T07:48:46.058+0000 I - [conn11] end connection 127.0.0.1:42914 (9 connections now open)
2018-04-17T07:48:46.058+0000 I - [conn3] end connection 127.0.0.1:42904 (8 connections now open)
2018-04-17T07:48:46.058+0000 I - [conn5] end connection 127.0.0.1:42906 (7 connections now open)
2018-04-17T07:48:46.058+0000 I - [conn9] end connection 127.0.0.1:42910 (6 connections now open)
2018-04-17T07:48:46.058+0000 I - [conn13] end connection 127.0.0.1:42917 (6 connections now open)
2018-04-17T07:48:46.076+0000 I - [conn10] end connection 127.0.0.1:42911 (4 connections now open)
2018-04-17T07:48:46.076+0000 I - [conn1] end connection 127.0.0.1:42902 (3 connections now open)
2018-04-17T07:48:46.567+0000 I - [conn17] end connection 127.0.0.1:42926 (2 connections now open)
2018-04-17T07:48:46.567+0000 I - [conn16] end connection 127.0.0.1:42925 (1 connection now open)
观察到除了filesystem 或control 类型的错误为
2018-04-17T07:48:26.030+0000 I NETWORK [thread1] connection refused because too many open connections: 10
网络连接数过多,所以答案是NETWORK