后端关闭

时间:2017-11-10 11:18:54

标签: node.js mongodb parse-server

昨天,OVH服务中断了,所以我自己的应用程序的后端完全停止了工作。今天,我尝试启动我的应用程序,看看是否一切正常,我很高兴看到后端已经正常工作,但是...... 我的应用程序没有显示任何数据

所以我通过PuTTy连接到我的VPS,看看我的Node应用程序是否正常工作。我在pm2(Node的流程管理器)看到我的应用程序的实例完全在线。但是在Parse日志中,我可以看到这个错误:

  

{“message”:“获取auth for sessionToken”,“name”:“MongoError”//更多冗余错误消息说得非常相似}

我可以完美地检查当前的问题,即我的Node应用程序无法连接Mongo服务器,尽管凭据是相同的......

一些声明:

  • 应用后端和MongoDB存储在同一个VPS中。
  • Mongo证书是一样的;他们根本没有改变。
  • 尝试重新启动节点实例,但不会更改任何内容。

那么,发生了什么?如何重新启动mongo服务并重试?如果我需要它......我怎么能改变我的mongo凭证?

谢谢!

编辑:当我写“mongod”(这是一个mongo服务,对吧?)我收到以下意外错误:

mongod --help for help and startup options
2017-11-10T12:21:56.933+0100 [initandlisten] MongoDB starting : pid=7255 port=27017 dbpath=/data/db 64-bit host=vps332549
2017-11-10T12:21:56.934+0100 [initandlisten] db version v2.6.10
2017-11-10T12:21:56.935+0100 [initandlisten] git version: nogitversion
2017-11-10T12:21:56.935+0100 [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-11-10T12:21:56.935+0100 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58
2017-11-10T12:21:56.935+0100 [initandlisten] allocator: tcmalloc
2017-11-10T12:21:56.935+0100 [initandlisten] options: {}
2017-11-10T12:21:56.936+0100 [initandlisten] exception in initAndListen: 10296
*********************************************************************
 ERROR: dbpath (/data/db) does not exist.
 Create this directory or give existing directory in --dbpath.
 See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2017-11-10T12:21:56.936+0100 [initandlisten] dbexit:
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: going to close listening sockets...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: going to flush diaglog...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: going to close sockets...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: waiting for fs preallocator...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: lock for final commit...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: final commit...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: closing all files...
2017-11-10T12:21:56.937+0100 [initandlisten] closeAllFiles() finished
2017-11-10T12:21:56.937+0100 [initandlisten] dbexit: really exiting now

编辑:   试着做第一个答案所说的,虽然你可以看到这里的结果并不是好的;服务只是不会启动,我不知道为什么。另外,我怎么知道我的db根目录在哪里?

root@vps332549:~# service mongod status
● mongod.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
root@vps332549:~# service mongod restart
Failed to restart mongod.service: Unit mongod.service not found.
root@vps332549:~# mongod --dbpath=data/db/
2017-11-11T16:46:56.568+0100 [initandlisten] MongoDB starting : pid=6980 port=27017 dbpath=data/db/ 64-bit host=vps332549
2017-11-11T16:46:56.573+0100 [initandlisten] db version v2.6.10
2017-11-11T16:46:56.573+0100 [initandlisten] git version: nogitversion
2017-11-11T16:46:56.573+0100 [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-11-11T16:46:56.573+0100 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58
2017-11-11T16:46:56.573+0100 [initandlisten] allocator: tcmalloc
2017-11-11T16:46:56.573+0100 [initandlisten] options: { storage: { dbPath: "data/db/" } }
2017-11-11T16:46:56.573+0100 [initandlisten] exception in initAndListen: 10296
*********************************************************************
 ERROR: dbpath (data/db/) does not exist.
 Create this directory or give existing directory in --dbpath.
 See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2017-11-11T16:46:56.573+0100 [initandlisten] dbexit:
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: going to close listening sockets...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: going to flush diaglog...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: going to close sockets...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: waiting for fs preallocator...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: lock for final commit...
2017-11-11T16:46:56.574+0100 [initandlisten] shutdown: final commit...
2017-11-11T16:46:56.574+0100 [initandlisten] shutdown: closing all files...
2017-11-11T16:46:56.574+0100 [initandlisten] closeAllFiles() finished
2017-11-11T16:46:56.574+0100 [initandlisten] dbexit: really exiting now
root@vps332549:~# service mongod restart
Failed to restart mongod.service: Unit mongod.service not found.
root@vps332549:~# service mongod start
Failed to start mongod.service: Unit mongod.service not found.
root@vps332549:~#

1 个答案:

答案 0 :(得分:1)

如果您已经将mongod设置为服务,那么您应该能够检查它是否正在运行:

$ service mongod status

如果它只是不活动,只需重新启动您的服务:

# service mongod restart

如果它未注册为服务,则mongod命令需要dbpath参数:

$ mongod --dbpath=data/db/

其中data/db/是数据库数据目录的路径。

相关问题