In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Just contacted mongodb, encountered a small problem, the information found on the Internet seems to be not very complete, summary and record, I hope it will be helpful to everyone.
I. description of the problem
When reconfiguring the master and slave of mongodb, the database [kill mongod process] was shut down abnormally, and the error was thrown when restarting as follows
PS: normal should be: mongod-f / mvnobss/users/mgousr01/mongodb/conf/master.conf-- shutdown
Mgousr01@test:/mvnobss/users/mgousr01/mongodb/bin >. / start_mongodb.sh about to fork child process, waiting until server is ready for connections.forked process: 30717ERROR: child process failed, exited with error number 100
II. Problem solving
View the log:
2017-05-11T16:01:42.370+0800 I CONTROL * SERVER RESTARTED * 2017-05-11T16:01:42.404+0800 I JOURNAL [initandlisten] journal dir=/mvnobss/users/mgousr01/mongodb/dbdata/rs0/journal2017-05-11T16:01:42.404+0800 I JOURNAL [initandlisten] recover begin2017-05-11T16:01:42.404+0800 I JOURNAL [initandlisten] recover lsn: 757156372017-05-11T16:01:42.404+0800 I JOURNAL [initandlisten] recover / mvnobss/users/mgousr01 / mongodb/dbdata/rs0/journal/j._232017-05-11T16:01:42.408+0800 I JOURNAL [initandlisten] recover skipping application of section seq:59812763
< lsn:757156372017-05-11T16:01:43.187+0800 I JOURNAL [initandlisten] recover skipping application of section seq:59872073 < lsn:757156372017-05-11T16:01:43.517+0800 I JOURNAL [initandlisten] recover /mvnobss/users/mgousr01/mongodb/dbdata/rs0/journal/j._242017-05-11T16:01:44.633+0800 I JOURNAL [initandlisten] recover /mvnobss/users/mgousr01/mongodb/dbdata/rs0/journal/j._252017-05-11T16:01:45.762+0800 I JOURNAL [initandlisten] recover /mvnobss/users/mgousr01/mongodb/dbdata/rs0/journal/j._262017-05-11T16:01:45.765+0800 I JOURNAL [initandlisten] recover skipping application of section seq:60050033 < lsn:757156372017-05-11T16:01:45.766+0800 F JOURNAL [initandlisten] dbexception during recovery: 15923 couldn't get file length when opening mapping /mvnobss/users/mgousr01/mongodb/dbdata/rs0/lxvomgodb1/lxvomgodb1.19 boost::filesystem::file_size: No such file or directory: "/mvnobss/users/mgousr01/mongodb/dbdata/rs0/lxvomgodb1/lxvomgodb1.19"2017-05-11T16:01:45.766+0800 I STORAGE [initandlisten] exception in initAndListen: 15923 couldn't get file length when opening mapping /mvnobss/users/mgousr01/mongodb/dbdata/rs0/lxvomgodb1/lxvomgodb1.19 boost::filesystem::file_size: No such file or directory: "/mvnobss/users/mgousr01/mongodb/dbdata/rs0/lxvomgodb1/lxvomgodb1.19", terminating2017-05-11T16:01:45.766+0800 I CONTROL [initandlisten] now exiting2017-05-11T16:01:45.766+0800 I NETWORK [initandlisten] shutdown: going to close listening sockets...2017-05-11T16:01:45.767+0800 I NETWORK [initandlisten] shutdown: going to flush diaglog...2017-05-11T16:01:45.767+0800 I NETWORK [initandlisten] shutdown: going to close sockets...2017-05-11T16:01:45.767+0800 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...2017-05-11T16:01:45.767+0800 I STORAGE [initandlisten] shutdown: final commit...2017-05-11T16:01:45.767+0800 I STORAGE [initandlisten] shutdown: closing all files...2017-05-11T16:01:45.767+0800 I STORAGE [initandlisten] closeAllFiles() finished2017-05-11T16:01:45.767+0800 I CONTROL [initandlisten] dbexit: rc: 100 日志说找不到/mvnobss/users/mgousr01/mongodb/dbdata/rs0/lxvomgodb1/lxvomgodb1.19文件,这个是正常的,因为我停库之前备份数据库后删除了数据库,常规情况是可以启动起来的。 网上百度说是需要删除非正常关闭后产生的mongod.lock文件再去重新启动,好,删除来一遍: mgousr01@test:/mvnobss/users/mgousr01/mongodb/dbdata/rs0>Lltotal 20drwxrwxr-x 3 mgousr01 mongodb 4096 2015-10-10 17:46 admindrwxrwxr-x 2 mgousr01 mongodb 4096 2017-05-11 11:12 journaldrwxrwxr-x 3 mgousr01 mongodb 4096 2015-10 17:43 localdrwxrwxr-x 3 mgousr01 mongodb 4096 2017-05-11 15:47 lxvomgodb1-rwxrwxr-x 1 mgousr01 mongodb 0 2017-05-11 16:02 mongod.lock-rw-rw-r-- 1 mgousr01 mongodb 69 2015-10-10 17:09 storage.bsonmgousr01@test:/mvnobss/users/mgousr01/mongodb/dbdata/ Rs0 > mgousr01@test:/mvnobss/users/mgousr01/mongodb/dbdata/rs0 > mgousr01@test:/mvnobss/users/mgousr01/mongodb/dbdata/rs0 > rm-rf mongod.lock
The restart still reports an error, and the mongod.lock file is generated:
Mgousr01@test:/mvnobss/users/mgousr01/mongodb/bin >. / start_mongodb.sh about to fork child process, waiting until server is ready for connections.forked process: 30717ERROR: child process failed Exited with error number 100mgousr01@test:/mvnobss/users/mgousr01/mongodb/dbdata/rs0 > lltotal 20drwxrwxr-x 3 mgousr01 mongodb 4096 2015-10-10 17:46 admindrwxrwxr-x 2 mgousr01 mongodb 4096 2017-05-11 11:12 journaldrwxrwxr-x 3 mgousr01 mongodb 4096 2015-10 17:43 localdrwxrwxr-x 3 mgousr01 mongodb 4096 2017-05-11 15:47 lxvomgodb1-rwxrwxr-x 1 mgousr01 mongodb 0 2017-05-11 16:15 mongod.lock
After trying many times, it still doesn't work. Continue to read the log:
2017-05-11T16:15:42.379+0800 I CONTROL * SERVER RESTARTED * 2017-05-11T16:15:42.413+0800 I STORAGE [initandlisten] * 2017-05-11T16:15:42.413+0800 I STORAGE [initandlisten] Error: journal files are present in journal directory Yet starting without journaling enabled.2017-05-11T16:15:42.413+0800 I STORAGE [initandlisten] It is recommended that you start with journaling enabled so that recovery may occur.2017-05-11T16:15:42.413+0800 I STORAGE [initandlisten] * 2017-05-11T16:15:42.413+0800 I STORAGE [initandlisten] exception in initAndListen: 13597 can't start without-- journal enabled when journal/ files are present, terminating2017-05-11T16:15:42.413+0800 I CONTROL [initandlisten] dbexit: rc: 100
The journal file currently exists in the journal directory, and the startup process did not start journaling, so an error was thrown because the database was started with journaling.
So go to the journal directory and delete the journal file that is not normally closed:
Mgousr01@test:/mvnobss/users/mgousr01/mongodb/dbdata/rs0/journal > ls-lrttotal 3179664When RW-1 mgousr01 mongodb 1076690944 2017-05-11 11:11 j.Kui 23kyu RW-1 mgousr01 mongodb 1081876480 2017-05-11 11:11 j.Kui 24Min RW-1 mgousr01 mongodb 1093656576 2017-05-11 11:12 j. Fang 25UR RW-1 mgousr01 mongodb 3735552 2017-05-11 15:38 j. _ 26Murrw- 1 mgousr01 mongodb 88 2017-05-11 15:38 lsnmgousr01@test:/mvnobss/users/mgousr01/mongodb/dbdata/rs0/journal > rm-rf j.conversation 26
Started successfully:
Mgousr01@test:/mvnobss/users/mgousr01/mongodb/bin > lltotal 4-rwxrwxr-x 1 mgousr01 mongodb 60 2015-08-11 17:44 start_mongodb.shmgousr01@test:/mvnobss/users/mgousr01/mongodb/bin >. / start_mongodb.sh about to fork child process, waiting until server is ready for connections.forked process: 30927child process started successfully, parent exiting
Because I don't quite understand the function of this file directory, I only know that this journal is the binlog of oracle's redo log,MySQL, which is used for fault recovery.
The specific operating mechanism needs to be further studied.
The environment above me is a test environment, so it doesn't matter to delete because I am not afraid of losing data. The production environment should be cautious.
[personally, I think it is possible to specify disable journaling in the configuration file, then start mongodb, and then restart the database by enable after starting successfully. I haven't tried yet.]
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 218
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.