鍍金池/ 問答/數(shù)據(jù)庫  HTML/ run mongodb問題

run mongodb問題

mongod --dbpath /usr/local/var/mongodb

2018-07-03T10:50:12.444+0800 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2018-07-03T10:50:12.457+0800 I CONTROL  [initandlisten] MongoDB starting : pid=44555 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=huhaifengdeMacBook-Pro.local
2018-07-03T10:50:12.457+0800 I CONTROL  [initandlisten] db version v4.0.0
2018-07-03T10:50:12.457+0800 I CONTROL  [initandlisten] git version: 3b07af3d4f471ae89e8186d33bbb1d5259597d51
2018-07-03T10:50:12.457+0800 I CONTROL  [initandlisten] allocator: system
2018-07-03T10:50:12.458+0800 I CONTROL  [initandlisten] modules: none
2018-07-03T10:50:12.458+0800 I CONTROL  [initandlisten] build environment:
2018-07-03T10:50:12.458+0800 I CONTROL  [initandlisten]     distarch: x86_64
2018-07-03T10:50:12.458+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2018-07-03T10:50:12.458+0800 I CONTROL  [initandlisten] options: { storage: { dbPath: "/usr/local/var/mongodb" } }
2018-07-03T10:50:12.458+0800 I STORAGE  [initandlisten] Detected data files in /usr/local/var/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-07-03T10:50:12.458+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7680M,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),statistics_log=(wait=0),verbose=(recovery_progress),
2018-07-03T10:50:13.065+0800 I STORAGE  [initandlisten] WiredTiger message [1530586213:65896][44555:0x7fffa9ffe380], txn-recover: Main recovery loop: starting at 10/5888
2018-07-03T10:50:13.160+0800 I STORAGE  [initandlisten] WiredTiger message [1530586213:160125][44555:0x7fffa9ffe380], txn-recover: Recovering log 10 through 11
2018-07-03T10:50:13.224+0800 I STORAGE  [initandlisten] WiredTiger message [1530586213:224134][44555:0x7fffa9ffe380], txn-recover: Recovering log 11 through 11
2018-07-03T10:50:13.273+0800 I STORAGE  [initandlisten] WiredTiger message [1530586213:273601][44555:0x7fffa9ffe380], txn-recover: Set global recovery timestamp: 0
2018-07-03T10:50:13.347+0800 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] 
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] 
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server. 
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP 
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] 
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] 
2018-07-03T10:50:13.386+0800 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2018-07-03T10:50:13.427+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/usr/local/var/mongodb/diagnostic.data'
2018-07-03T10:50:13.431+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
const express = require('express')
const mongoose = require('mongoose')
//鏈接mongo
const DB_URL = 'mongodb://localhost:27017/'
mongoose.connect(DB_URL)
mongoose.connection.on('connected', function(){
  console.log('mongo connect success!')
})
// 新建app
const app = express()
app.get('/', function (req, res) {
  res.send('<h1>Hello World1e23</h1>')
})
app.get('/data', function(req, res) {
  res.json({name: 'hhf12ees3', type: 'IT'})
})
app.listen(9093, function(){
  console.log('Node app start at port 9093')
})

報問題 [nodemon] app crashed - waiting for file changes before starting...
怎么解決

回答
編輯回答
風清揚

關(guān)于MongoDB
首先是警告不是錯誤,并不會造成你不能運行;
其次警告的內(nèi)容是不是自己先理解一下,看看有什么不懂的地方?

關(guān)于NodeJS
可能要說英文不好,那我們來一個詞一個詞讀讀

app crashed - waiting for file changes before starting...
應(yīng)用崩潰了 - 等待文件變更 在重啟之前...

意思是不是很明白?由于某種錯誤應(yīng)用不能成功啟動,那么現(xiàn)在能重試嗎?不管怎么重試還是會失敗對不對?所以nodemon要等待文件有變更后再重試是不是更有道理一些呢?
那到底是什么問題?看日志啊,沒有日志鬼知道什么問題。

無關(guān)的話:建議樓主看到一大堆英文就算很崩潰還是讀一下,并沒有你想象的那么難。永遠不讀就永遠不會懂,讀一讀,慢慢就越來越容易。

2017年7月12日 23:47
編輯回答
雨萌萌

??????
這不是成功了?

2017年11月21日 09:12
編輯回答
選擇

我解決了一定要有個數(shù)據(jù)庫名才能跑起來

2017年8月27日 09:23