Help us understand the problem. What is going on with this article?

MongoDB 2.4.3 を 3.2.1 にバージョンアップしてはまったこと~データベース入門者の場合~

More than 3 years have passed since last update.

背景

MongoDB 2.4.3 と 3.2.1 の両バージョンで動作比較を実施。
そのために、2.4.3 と 3.2.1 を一台のサーバーにのせた。

はまったことその1

データが破損

2.4.3 と 3.2.1 でバイナリを分け、dbpath を 共有したまま 2.4.3 を停止後に 3.2.1 を起動を試みた。しかしデータフォーマット差異により物理データが破損。その結果、両バージョンとも起動しなくなってしまった。
dbpath は必ず分けよう!

[ec2-user@ip-hoge ~]$ tail -200 /hoge/logs/mongodb.log

***** SERVER RESTARTED *****

Fri Jan 15 01:26:51.083 [initandlisten] MongoDB starting : pid=3228 port=27017 dbpath=/data/db 64-bit host=ip-hoge
Fri Jan 15 01:26:51.083 [initandlisten] db version v2.4.3
Fri Jan 15 01:26:51.083 [initandlisten] git version: xxxxxxxxxxxxxxxxxxxxxxxx
Fri Jan 15 01:26:51.083 [initandlisten] build info: Linux ip-fuga
Fri Jan 15 01:26:51.083 [initandlisten] allocator: tcmalloc
Fri Jan 15 01:26:51.083 [initandlisten] options: { dbpath: "/data/db", fork: true, logappend: true, logpath: "/hoge/logs/mongodb.log", port: 27017 }
Fri Jan 15 01:26:51.091 [initandlisten] journal dir=/data/db/journal
Fri Jan 15 01:26:51.091 [initandlisten] recover : no journal files present, no recovery needed
Fri Jan 15 01:26:51.100 [initandlisten] ****
Fri Jan 15 01:26:51.100 [initandlisten] ****
Fri Jan 15 01:26:51.101 [initandlisten] need to upgrade database hogeCollection with pdfile version 4.21, new version: 4.5
Fri Jan 15 01:26:51.101 [initandlisten]          Not upgrading, exiting
Fri Jan 15 01:26:51.101 [initandlisten]          run --upgrade to upgrade dbs, then start again
Fri Jan 15 01:26:51.101 [initandlisten] ****
Fri Jan 15 01:26:51.101 dbexit:
Fri Jan 15 01:26:51.101 [initandlisten] shutdown: going to close listening sockets...
Fri Jan 15 01:26:51.101 [initandlisten] shutdown: going to flush diaglog...
Fri Jan 15 01:26:51.101 [initandlisten] shutdown: going to close sockets...
Fri Jan 15 01:26:51.101 [initandlisten] shutdown: waiting for fs preallocator...
Fri Jan 15 01:26:51.101 [initandlisten] shutdown: lock for final commit...
Fri Jan 15 01:26:51.101 [initandlisten] shutdown: final commit...
Fri Jan 15 01:26:51.101 [initandlisten] shutdown: closing all files...
Fri Jan 15 01:26:51.101 [initandlisten] closeAllFiles() finished
Fri Jan 15 01:26:51.101 [initandlisten] journalCleanup...
Fri Jan 15 01:26:51.101 [initandlisten] removeJournalFiles
Fri Jan 15 01:26:51.107 [initandlisten] shutdown: removing fs lock...
Fri Jan 15 01:26:51.107 dbexit: really exiting now

https://docs.mongodb.org/manual/release-notes/2.4-upgrade/

はまったことその2

クラスタ構成を組んでいたため、バージョンアップする場合は mongod だけでなく mongos もする必要があった。
hogeサーバーには mongod が、fuga サーバーには mongos が起動している。
MongoDB クライアント(mongos)も一緒にバージョンアップしよう!

[ec2-user@ip-hoge ~]$ less /hoge/logs/mongodb.log
2016-01-14T10:15:55.701+0000 E COMMAND  [conn1] Writeback functionality is no longer present in v3.0 mongod, a v2.6 mongos may be running in the v3.0 cluster at ip-fuga

https://fossies.org/linux/misc/mongo-r3.0.9.tar.gz/mongo-r3.0.9/src/mongo/db/commands/writeback_compatibility_shim.cpp

opst
情報技術と社員力でお客様を成功に導く Make IT Your Success
https://www.opst.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした