2017-11-10 6 views
0

昨日、OVHサービスがダウンしたため、自分自身のアプリケーションのバックエンドが完全に動作しなくなりました。今日、私はすべてが大丈夫だったかどうかを確認するために私のアプリを起動しようとしたが、私はバックエンドがすでに動作していることを確認して嬉しかったが、... 私のアプリはデータを表示していないバックエンドシャットダウン後の奇妙なMongoDBログインエラー

私はノードアプリケーションが正常に動作していることを確認するためにPuTTy経由で私のVPSに接続しました。私はpm2(ノードのプロセスマネージャー)で、私のアプリのインスタンスが完全にオンラインであることを見ました。しかし、解析ログに、私はこのエラーを見ることができる:

{"message":"error getting auth for sessionToken","name":"MongoError" // more redundant error messages saying pretty much the same}

私は完全に資格情報が同じであるにもかかわらず、現在の問題は、私のノードアプリはMongoのサーバーを接続することができないということであることを確認できました...

一部aclarations:

  • アプリのバックエンドとのMongoDBは同じVPSに格納されています。
  • Mongoの資格情報は同じです。彼らは全く変わらなかった。
  • ノードインスタンスを再起動しようとしましたが、何も変更されません。

何が起こっているのですか?どのようにしてmongoサービスを再開してやり直すことができますか?そして、私がそれを必要とする場合...私はどのように私のmongo資格情報を変更することができますか?

ありがとうございました!

編集:私は "のmongod" を書き込むと(?それは、右のmongoサービスだ)Iを取得、次の予期しないエラー:

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 

EDIT: することができますが、最初の答えが言ったことを実行しようとしました結果はどこにも良いことではありません。サービスはちょうど開始しません、私は理由を知らない。また、どのように私のdbのルートがわかることができますか?

[email protected]:~# service mongod status 
● mongod.service 
    Loaded: not-found (Reason: No such file or directory) 
    Active: inactive (dead) 
[email protected]:~# service mongod restart 
Failed to restart mongod.service: Unit mongod.service not found. 
[email protected]:~# 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 
[email protected]:~# service mongod restart 
Failed to restart mongod.service: Unit mongod.service not found. 
[email protected]:~# service mongod start 
Failed to start mongod.service: Unit mongod.service not found. 
[email protected]:~# 

答えて

1

すでにサービスとしてのmongodを設定している場合、あなたはそれが作動しているかどうかをチェックすることができるはずですが:それは単に非アクティブな場合

$ service mongod status 

、ちょうどあなたのサービスを再起動します。

# service mongod restart 

それがサービスとして登録されていない場合は、のmongodコマンドはDBPATHパラメータを期待:

$ mongod --dbpath=data/db/ 

data/db/は、データベースのデータディレクトリへのパスです。

+0

私のmongodサービスは完全にダウンしていますが、私が試した限り、再びオンラインにはなりません。私の編集をチェックしてください! – Zerok

+0

さて、私はあなたの編集をチェックして、私のアドバイスに従わないでください:引数としてapp dbの正しいパスを_mongod_に渡す必要があります。 – TGrif

+0

TGriffええ、ただ実現しました。しかし、dbがどこにあったのか、私はどのように知ることができますか?私はそれを見つけようとしています – Zerok