title: Cannot use mongoimport on vagrant
body: <p>Following is my <code>mongo.conf</code>:</p>
  
  <pre><code># mongod.conf
  
  # Where and how to store data.
  storage:
    dbPath: /var/lib/mongodb
    journal:
      enabled: true
  
  systemLog:
    destination: file
    logAppend: true
    path: /var/log/mongodb/mongod.log
  
  net:
    port: 27017
  #  bindIp: 127.0.0.1
  
  replication:
    replSetName: rs0
    oplogSizeMB: 250
  </code></pre>
  
  <p>I tried to import the data given <a href="https://raw.githubusercontent.com/mongodb/docs-assets/primer-dataset/dataset.json" rel="nofollow">here</a> on the guest linux using </p>
  
  <pre><code>wget https://raw.githubusercontent.com/mongodb/docs-assets/primer-dataset/dataset.json
  mongoimport --host=127.0.0.1 --port=27017 --db test --collection dataset --file dataset.json
  </code></pre>
  
  <p>and also tried on the host machine (mac):</p>
  
  <pre><code>mongoimport --host=127.0.0.1 --port=27071 --db test --collection dataset --file dataset.json
  </code></pre>
  
  <p>In both the cases I get the following output:</p>
  
  <pre><code>2016-02-25T11:01:56.280-0500    connected to: 127.0.0.1:27071
  2016-02-25T11:01:59.278-0500    [........................] test.dataset 0.0 B/11.3 MB (0.0%)
  2016-02-25T11:01:59.309-0500    [........................] test.dataset 0.0 B/11.3 MB (0.0%)
  2016-02-25T11:01:59.309-0500    Failed: error checking connected node type: no reachable servers
  2016-02-25T11:01:59.309-0500    imported 0 documents
  </code></pre>
  
  <p>All the requests that I make to port 27071 on the host system are forwarded to post 27017 on the linux guest. There are no connections issues as <code>curl localhost:27071</code> gives <code>It looks like you are trying to access MongoDB over HTTP on the native driver port</code>.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Following is the log of mongo:</p>
  
  <pre><code>2016-02-25T18:33:23.938+0000 I CONTROL  ***** SERVER RESTARTED *****
  2016-02-25T18:33:23.941+0000 I CONTROL  [initandlisten] MongoDB starting : pid=4810 port=27017 dbpath=/var/lib/mongodb 64-bit host=vagrant-ubuntu-trusty-64
  2016-02-25T18:33:23.941+0000 I CONTROL  [initandlisten] db version v3.0.9
  2016-02-25T18:33:23.941+0000 I CONTROL  [initandlisten] git version: 20d60d3491908f1ae252fe452300de3978a040c7
  2016-02-25T18:33:23.941+0000 I CONTROL  [initandlisten] build info: Linux ip-10-732-9-221 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
  2016-02-25T18:33:23.941+0000 I CONTROL  [initandlisten] allocator: tcmalloc
  2016-02-25T18:33:23.941+0000 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "0.0.0.0", port: 27017 }, replication: { oplogSizeMB: 250, replSetName: "rs0" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
  2016-02-25T18:33:23.969+0000 I JOURNAL  [initandlisten] journal dir=/var/lib/mongodb/journal
  2016-02-25T18:33:23.969+0000 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
  2016-02-25T18:33:24.006+0000 I JOURNAL  [durability] Durability thread started
  2016-02-25T18:33:24.006+0000 I JOURNAL  [journal writer] Journal writer thread started
  2016-02-25T18:33:24.007+0000 I CONTROL  [initandlisten] 
  2016-02-25T18:33:24.007+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
  2016-02-25T18:33:24.007+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
  2016-02-25T18:33:24.007+0000 I CONTROL  [initandlisten] 
  2016-02-25T18:33:24.007+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
  2016-02-25T18:33:24.007+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
  2016-02-25T18:33:24.007+0000 I CONTROL  [initandlisten] 
  2016-02-25T18:33:24.010+0000 I REPL     [initandlisten] Did not find local replica set configuration document at startup;  NoMatchingDocument Did not find replica set configuration document in local.system.replset
  2016-02-25T18:33:24.011+0000 I NETWORK  [initandlisten] waiting for connections on port 27017
  </code></pre>
  
  <p>If I try to do <code>mongoimport --host=0.0.0.0 --port=27071 --db test --collection dataset --file dataset.json</code> from the host system, following is added to the log:</p>
  
  <pre><code>2016-02-25T18:36:03.443+0000 I NETWORK  [initandlisten] connection accepted from 10.0.2.2:51277 #1 (1 connection now open)
  2016-02-25T18:36:06.479+0000 I NETWORK  [conn1] end connection 10.0.2.2:51277 (0 connections now open)
  </code></pre>
  
  <p>and when I try this same command from the guest linux, I get:</p>
  
  <pre><code>2016-02-25T18:38:29.982+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:59910 #2 (1 connection now open)
  2016-02-25T18:38:32.994+0000 I NETWORK  [conn2] end connection 127.0.0.1:59910 (0 connections now open)
  </code></pre>