M312: Diagnostics and Debugging chapter 1 Introduction学习记录

M312: Diagnostics and Debugging chapter 1 Introduction学习记录

运行环境

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

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

课后问题

lab

Download Handouts:

m312/m312-vagrant-env.zip

In this lab, you will set up your vagrant environment. If you’ve already done it, then you should be all set.

Once your vagrant environment is running, ssh in, and run the following command:

hostname -f

Type the output of this command below, and submit your answer.

解答

将压缩包下载并解压至路径E:\MongoDB\m312\chapter_1_introduction,并进入环境:

C:\Users\Shinelon>e:

E:\>cd MongoDB\m312\chapter_1_introduction\m312-vagrant-env

按题目要求下载插件vagrant-berkshelf:

E:\MongoDB\m312\chapter_1_introduction\m312-vagrant-env>vagrant plugin install vagrant-berkshelf
Installing the 'vagrant-berkshelf' plugin. This can take a few minutes...
Vagrant failed to load a configured plugin source. This can be caused
by a variety of issues including: transient connectivity issues, proxy
filtering rejecting access to a configured plugin source, or a configured
plugin source not responding correctly. Please review the error message
below to help resolve the issue:

  Errno::ECONNABORTED: An established connection was aborted by the software in your host machine. - SSL_connect (https://gems.hashicorp.com/specs.4.8.gz)

Source: https://gems.hashicorp.com/

被墙了,,,要么开启vpn,要么这一步跳过也无妨,直接启动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
==> m312: Clearing any previously set forwarded ports...
==> m312: Clearing any previously set network interfaces...
==> m312: Preparing network interfaces based on configuration...
    m312: Adapter 1: nat
    m312: Adapter 2: hostonly
==> m312: Forwarding ports...
    m312: 30000 (guest) => 30000 (host) (adapter 1)
    m312: 30001 (guest) => 30001 (host) (adapter 1)
    m312: 30002 (guest) => 30002 (host) (adapter 1)
    m312: 22 (guest) => 2222 (host) (adapter 1)
==> m312: Running 'pre-boot' VM customizations...
==> m312: Booting VM...
==> m312: Waiting for machine to boot. This may take a few minutes...
    m312: SSH address: 127.0.0.1:2222
    m312: SSH username: vagrant
    m312: SSH auth method: private key
    m312:
    m312: Vagrant insecure key detected. Vagrant will automatically replace
    m312: this with a newly generated keypair for better security.
    m312:
    m312: Inserting generated public key within guest...
    m312: Removing insecure key from the guest if it's present...
    m312: Key inserted! Disconnecting and reconnecting using new SSH key...
==> m312: Machine booted and ready!
==> m312: Checking for guest additions in VM...
    m312: The guest additions on this VM do not match the installed version of
    m312: VirtualBox! In most cases this is fine, but in rare cases it can
    m312: prevent things such as shared folders from working properly. If you see
    m312: shared folder errors, please make sure the guest additions within the
    m312: virtual machine match the version of VirtualBox you have installed on
    m312: your host and reload your VM.
    m312:
    m312: Guest Additions Version: 4.3.36
    m312: VirtualBox Version: 5.2
==> m312: Setting hostname...
==> m312: Configuring and enabling network interfaces...
==> m312: Mounting shared folders...
    m312: /shared => E:/MongoDB/m312/chapter_1_introduction/m312-vagrant-env/shared
    m312: /vagrant => E:/MongoDB/m312/chapter_1_introduction/m312-vagrant-env
    m312: /dataset => E:/MongoDB/m312/chapter_1_introduction/m312-vagrant-env/dataset
==> m312: Running provisioner: shell...
    m312: Running: C:/Users/Shinelon/AppData/Local/Temp/vagrant-shell20180417-3316-1afmprb
    m312: + config
    m312: + sudo su
    m312: + echo -e never
    m312: + echo -e never
    m312: + echo manual
    m312: + sudo tee /etc/init/mongod.override
    m312: manual
    m312: Install MongoDB Enterprise Repository
    m312: + update_repo
    m312: + echo 'Install MongoDB Enterprise Repository'
    m312: + sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
    m312: ++ lsb_release -sc
    m312: + echo 'deb http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.3 multiverse'
    m312: deb http://repo.mongodb.com/apt/ubuntu trusty/mongodb-enterprise/3.3 multiverse
    m312: + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    m312: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.iAfGxXDwXc --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
    m312: gpg: requesting key A15703C6 from hkp server keyserver.ubuntu.com
    m312: gpg:
    m312: key A15703C6: public key "MongoDB 3.4 Release Signing Key <packaging@mongodb.com>" imported
    m312: gpg:
    m312: Total number processed: 1
    m312: gpg:
    m312:               imported: 1
    m312:   (RSA: 1)
    m312: + echo 'Update Repositoryies'
    m312: Update Repositoryies
    m312: + sudo apt-get update -y
    m312: Get:1 http://security.ubuntu.com trusty-security InRelease [65.9 kB]
    m312: Ign http://repo.mongodb.com trusty/mongodb-enterprise/3.3 InRelease
    m312: Get:2 http://security.ubuntu.com trusty-security/main Sources [154 kB]
    m312: Get:3 http://repo.mongodb.com trusty/mongodb-enterprise/3.3 Release.gpg [801 B]
    m312: Get:4 http://security.ubuntu.com trusty-security/universe Sources [71.8 kB]
    m312: Get:5 http://repo.mongodb.com trusty/mongodb-enterprise/3.3 Release [4,439 B]
    m312: Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [727 kB]
    m312: Get:7 http://repo.mongodb.com trusty/mongodb-enterprise/3.3/multiverse amd64 Packages [11.6 kB]
    m312: Ign http://archive.ubuntu.com trusty InRelease
    m312: Get:8 http://archive.ubuntu.com trusty-updates InRelease [65.9 kB]
    m312: Hit http://archive.ubuntu.com trusty-backports InRelease
    m312: Hit http://archive.ubuntu.com trusty Release.gpg
    m312: Get:9 http://archive.ubuntu.com trusty-updates/main Sources [415 kB]
    m312: Get:10 http://security.ubuntu.com trusty-security/universe amd64 Packages [225 kB]
    m312: Get:11 http://security.ubuntu.com trusty-security/main Translation-en [394 kB]
    m312: Get:12 http://archive.ubuntu.com trusty-updates/restricted Sources [6,322 B]
    m312: Get:13 http://archive.ubuntu.com trusty-updates/universe Sources [199 kB]
    m312: Ign http://repo.mongodb.com trusty/mongodb-enterprise/3.3/multiverse Translation-en_US
    m312: Get:14 http://archive.ubuntu.com trusty-updates/multiverse Sources [7,373 B]
    m312: Get:15 http://archive.ubuntu.com trusty-updates/main amd64 Packages [1,069 kB]
    m312: Get:16 http://security.ubuntu.com trusty-security/universe Translation-en [124 kB]
    m312: Ign http://repo.mongodb.com trusty/mongodb-enterprise/3.3/multiverse Translation-en
    m312: Get:17 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [17.2 kB]
    m312: Get:18 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [450 kB]
    m312: Get:19 http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages [14.6 kB]
    m312: Get:20 http://archive.ubuntu.com trusty-updates/main Translation-en [528 kB]
    m312: Get:21 http://archive.ubuntu.com trusty-updates/multiverse Translation-en [7,616 B]
    m312: Get:22 http://archive.ubuntu.com trusty-updates/restricted Translation-en [4,024 B]
    m312: Get:23 http://archive.ubuntu.com trusty-updates/universe Translation-en [243 kB]
    m312: Get:24 http://archive.ubuntu.com trusty-backports/main Sources [9,709 B]
    m312: Get:25 http://archive.ubuntu.com trusty-backports/restricted Sources [28 B]
    m312: Get:26 http://archive.ubuntu.com trusty-backports/universe Sources [35.4 kB]
    m312: Get:27 http://archive.ubuntu.com trusty-backports/multiverse Sources [1,896 B]
    m312: Hit http://archive.ubuntu.com trusty-backports/main amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty-backports/restricted amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty-backports/universe amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty-backports/multiverse amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty-backports/main Translation-en
    m312: Hit http://archive.ubuntu.com trusty-backports/multiverse Translation-en
    m312: Hit http://archive.ubuntu.com trusty-backports/restricted Translation-en
    m312: Hit http://archive.ubuntu.com trusty-backports/universe Translation-en
    m312: Hit http://archive.ubuntu.com trusty Release
    m312: Get:28 http://archive.ubuntu.com trusty/main Sources [1,064 kB]
    m312: Get:29 http://archive.ubuntu.com trusty/restricted Sources [5,433 B]
    m312: Get:30 http://archive.ubuntu.com trusty/universe Sources [6,399 kB]
    m312: Hit http://archive.ubuntu.com trusty/main amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty/universe amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty/multiverse amd64 Packages
    m312: Hit http://archive.ubuntu.com trusty/main Translation-en
    m312: Hit http://archive.ubuntu.com trusty/multiverse Translation-en
    m312: Hit http://archive.ubuntu.com trusty/restricted Translation-en
    m312: Hit http://archive.ubuntu.com trusty/universe Translation-en
    m312: Ign http://archive.ubuntu.com trusty/main Translation-en_US
    m312: Ign http://archive.ubuntu.com trusty/multiverse Translation-en_US
    m312: Ign http://archive.ubuntu.com trusty/restricted Translation-en_US
    m312: Ign http://archive.ubuntu.com trusty/universe Translation-en_US
    m312: Get:31 http://archive.ubuntu.com trusty/multiverse Sources [174 kB]
    m312: Fetched 12.5 MB in 2min 40s (77.8 kB/s)
    m312: Reading package lists...
    m312: + echo 'Installing MongoDB Enterprise Dependencies'
    m312: Installing MongoDB Enterprise Dependencies
    m312: + sudo apt-get install -y libgssapi-krb5-2 libsasl2-2 libssl1.0.0 libstdc++6 snmp
    m312: Reading package lists...
    m312: Building dependency tree...
    m312: Reading state information...
    m312: libsasl2-2 is already the newest version.
    m312: libgssapi-krb5-2 is already the newest version.
    m312: libssl1.0.0 is already the newest version.
    m312: libstdc++6 is already the newest version.
    m312: The following extra packages will be installed:
    m312:   libperl5.18 libsensors4 libsnmp-base libsnmp30 perl perl-base perl-modules
    m312: Suggested packages:
    m312:   lm-sensors snmp-mibs-downloader perl-doc libterm-readline-gnu-perl
    m312:   libterm-readline-perl-perl libb-lint-perl libcpanplus-dist-build-perl
    m312:   libcpanplus-perl libfile-checktree-perl liblog-message-perl
    m312:   libobject-accessor-perl
    m312: The following NEW packages will be installed:
    m312:   libperl5.18 libsensors4 libsnmp-base libsnmp30 snmp
    m312: The following packages will be upgraded:
    m312:   perl perl-base perl-modules
    m312: 3 upgraded, 5 newly installed, 0 to remove and 2 not upgraded.
    m312: Need to get 7,651 kB of archives.
    m312: After this operation, 4,678 kB of additional disk space will be used.
    m312: Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main perl amd64 5.18.2-2ubuntu1.4 [2,649 kB]
    m312: Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main perl-base amd64 5.18.2-2ubuntu1.4 [1,149 kB]
    m312: Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main perl-base amd64 5.18.2-2ubuntu1.4
    m312:   Connection failed [IP: 91.189.88.162 80]
    m312: Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/main perl-modules all 5.18.2-2ubuntu1.4 [2,686 kB]
    m312: Get:4 http://security.ubuntu.com/ubuntu/ trusty-security/main perl-base amd64 5.18.2-2ubuntu1.4 [1,149 kB]
    m312: Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/main perl-modules all 5.18.2-2ubuntu1.4 [2,686 kB]
    m312: Get:6 http://archive.ubuntu.com/ubuntu/ trusty/main libsensors4 amd64 1:3.3.4-2ubuntu1 [27.2 kB]
    m312: Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libperl5.18 amd64 5.18.2-2ubuntu1.4 [1,326 B]
    m312: Get:8 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libsnmp-base all 5.7.2~dfsg-8.1ubuntu3.2 [203 kB]
    m312: Get:9 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libsnmp30 amd64 5.7.2~dfsg-8.1ubuntu3.2 [790 kB]
    m312: Get:10 http://archive.ubuntu.com/ubuntu/ trusty-updates/main snmp amd64 5.7.2~dfsg-8.1ubuntu3.2 [146 kB]
    m312: dpkg-preconfigure: unable to re-open stdin: No such file or directory
    m312: Fetched 7,061 kB in 11min 22s (10.3 kB/s)
    m312: (Reading database ... 63123 files and directories currently installed.)
    m312: Preparing to unpack .../perl_5.18.2-2ubuntu1.4_amd64.deb ...
    m312: Unpacking perl (5.18.2-2ubuntu1.4) over (5.18.2-2ubuntu1.3) ...
    m312: Preparing to unpack .../perl-base_5.18.2-2ubuntu1.4_amd64.deb ...
    m312: Unpacking perl-base (5.18.2-2ubuntu1.4) over (5.18.2-2ubuntu1.3) ...
    m312: Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
    m312: Setting up perl-base (5.18.2-2ubuntu1.4) ...
    m312: (Reading database ... 63123 files and directories currently installed.)
    m312: Preparing to unpack .../perl-modules_5.18.2-2ubuntu1.4_all.deb ...
    m312: Unpacking perl-modules (5.18.2-2ubuntu1.4) over (5.18.2-2ubuntu1.3) ...
    m312: Selecting previously unselected package libsensors4:amd64.
    m312: Preparing to unpack .../libsensors4_1%3a3.3.4-2ubuntu1_amd64.deb ...
    m312: Unpacking libsensors4:amd64 (1:3.3.4-2ubuntu1) ...
    m312: Selecting previously unselected package libperl5.18.
    m312: Preparing to unpack .../libperl5.18_5.18.2-2ubuntu1.4_amd64.deb ...
    m312: Unpacking libperl5.18 (5.18.2-2ubuntu1.4) ...
    m312: Selecting previously unselected package libsnmp-base.
    m312: Preparing to unpack .../libsnmp-base_5.7.2~dfsg-8.1ubuntu3.2_all.deb ...
    m312: Unpacking libsnmp-base (5.7.2~dfsg-8.1ubuntu3.2) ...
    m312: Selecting previously unselected package libsnmp30:amd64.
    m312: Preparing to unpack .../libsnmp30_5.7.2~dfsg-8.1ubuntu3.2_amd64.deb ...
    m312: Unpacking libsnmp30:amd64 (5.7.2~dfsg-8.1ubuntu3.2) ...
    m312: Selecting previously unselected package snmp.
    m312: Preparing to unpack .../snmp_5.7.2~dfsg-8.1ubuntu3.2_amd64.deb ...
    m312: Unpacking snmp (5.7.2~dfsg-8.1ubuntu3.2) ...
    m312: Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
    m312: Setting up libsensors4:amd64 (1:3.3.4-2ubuntu1) ...
    m312: Setting up libperl5.18 (5.18.2-2ubuntu1.4) ...
    m312: Setting up libsnmp-base (5.7.2~dfsg-8.1ubuntu3.2) ...
    m312: Setting up libsnmp30:amd64 (5.7.2~dfsg-8.1ubuntu3.2) ...
    m312: Setting up snmp (5.7.2~dfsg-8.1ubuntu3.2) ...
    m312: Setting up perl-modules (5.18.2-2ubuntu1.4) ...
    m312: Setting up perl (5.18.2-2ubuntu1.4) ...
    m312: Processing triggers for libc-bin (2.19-0ubuntu6.14) ...
    m312: + install_mongod
    m312: + echo 'Install MongoDB Enterprise'
    m312: Install MongoDB Enterprise
    m312: + wget -q -O mongodb-linux-x86_64-enterprise-ubuntu1404-3.4.2.tgz 'https://downloads.mongodb.com/linux/mongodb-linux-x86_64-enterprise-ubuntu1404-3.4.2.tgz?jmp=university'
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

我这边导入报错了,后来检查是因为网络原因导致mongodb的安装包下载失败,,后手动下载后按照file的脚本自行配置的(泪)

做测试,创建一个test文件:

E:\MongoDB\m312\chapter_1_introduction\m312-vagrant-env>echo hello >> shared/test.txt

进入vagrant:

E:\MongoDB\m312\chapter_1_introduction\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 05:00:40 UTC 2018

  System load:  0.59              Processes:           92
  Usage of /:   3.6% of 39.34GB   Users logged in:     0
  Memory usage: 3%                IP address for eth0: 10.0.2.15
  Swap usage:   0%

  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

0 packages can be updated.
0 updates are security updates.

New release '16.04.4 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

在box中查看此文件,确认已经跟宿主机共享:

vagrant@m312:~$ cat /shared/test.txt
hello

执行答案脚本:

vagrant@m312:~$ hostname -f
m312.mongodb.university
阅读更多

扫码向博主提问

aladdin_sun

战个痛
去开通我的Chat快问
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页