2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MngoDBのシェルとサーバのバージョンが違う事件

Last updated at Posted at 2017-09-12

MongoDBのインストールをミスった

ちょろっと試したいことがあり、MongoDBをWindows環境にインストールしたのですが、すでにインストール済みで、かつMongoDB Serverが動作状態だった。
ちなみにいつインストールしたのか自分でも記憶にない。。

そんなアホなやらかしをしたところ、こんな状態になりました。

> mongo
MongoDB shell version v3.4.7 
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.2.8
WARNING: shell and server versions do not match

ただのアホなのですが、放っておくこともできないので解決を図ります。

解決方法

とりあえずMongoDB Serverを停止

タスクマネージャーから停止させました。

ps | ?{$_.processname -match "mongo"}

でPowershellから探し、killしてもよかったかもしれません。

再インストール

その後MongoDBのインストーラーを再実行し、無事インストール完了。

起動確認

> mongod --dbpath "C:\MongoDB\Server\3.4\data"

はい起動しません。
それもそのはず。

強制終了しているので、lockファイルが出来上がっています。

(MongoDBディレクトリ)/data/mongod.lock

こいつを削除して再度起動します。

> mongod --dbpath "C:\MongoDB\Server\3.4\data"
2017-09-07T07:33:11.989-0700 I CONTROL  [initandlisten] MongoDB starting : pid=13220 port=27017 dbpath=C:\MongoDB\Server\3.4\data 64-bit host=DESKTOP-FSGPFUL
・・・

無事サーバ起動。

> mongo
MongoDB shell version v3.4.7
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.7

これで無事シェルとサーバのバージョンが揃いました。

自戒を込めて備忘録に残します。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?