MongoDB - shutdown with code: 100
I am trying to setup MongoDB on a VPS Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-22-generic x86_64)
and I am having problems. I am working as a user on my server with access root
but not using an account root
.
I started to notice the problem when I was executing db.createUser()
in the database admin
to add other users and I was getting this error:
not authorized to execute command
So, I proceeded to uninstall and install again using the tutorial provided on the website: https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-ubuntu/
Now that I'm in stage 2 Make sure MongoDB started successfully under Start MongoDB Community Edition , that is, I look at my output from a file /var/log/mongodb/mongod.log
, I get this:
2017-04-14T14:23:09.309+0200 I CONTROL [main] ***** SERVER RESTARTED *****
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] MongoDB starting : pid=9691 port=27017 dbpath=/var/lib/mongodb 64-bit host=vps338741
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] db version v3.4.3
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] git version: f07437fb5a6cca07c10bafa78365456eb1d6d5e1
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] allocator: tcmalloc
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] modules: none
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] build environment:
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] distarch: x86_64
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] target_arch: x86_64
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten]
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=464M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-04-14T14:23:09.366+0200 E STORAGE [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory
2017-04-14T14:23:09.367+0200 I - [initandlisten] Assertion: 28595:2: No such file or directory src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
2017-04-14T14:23:09.367+0200 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-04-14T14:23:09.367+0200 I CONTROL [initandlisten] now exiting
2017-04-14T14:23:09.367+0200 I CONTROL [initandlisten] shutting down with code:100
I looked around and this is not the same error as here , because it has to do with the fact that there is no folder /data/db
that I have. From this log I can see that it has something to do with this line:
2017-04-14T14:23:09.366+0200 E STORAGE [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory
Which is true when I go to /var/lib/mongodb
and do ls -l
it is obtained with:
drwxr-xr-x 2 mongodb mongodb 4096 Apr 14 14:10 journal
-rw-r--r-- 1 mongodb mongodb 0 Apr 14 14:02 mongod.lock
-rw-r--r-- 1 mongodb mongodb 0 Apr 14 14:10 WiredTiger
-rw-r--r-- 1 mongodb mongodb 21 Apr 14 14:10 WiredTiger.lock
-rw-r--r-- 1 mongodb mongodb 1004 Apr 14 14:10 WiredTiger.turtle
But I don't know if I have to manually create this file as I haven't seen this issue elsewhere. I made sure the user mongodb
has permissions on these files as well as stated in the answer to this question , but still no luck.
I really don't understand what to do, any help would be much appreciated as this is my fifth attempt to make it work!
Thank!
source to share
This is a known bug in MongoDB, check the report
Your problem is not that the files are missing at all, but that they go missing when you restart after a clean shutdown. Your problem is not with the directory /data/db
, but with the file WiredTiger.wt
missing after reboot.
October 1 20:00:44 alpha mongod.27017 [1074]: [initandlisten] WiredTiger (2) [1443729644: 306783] [1074: 0x7fdba8fd4bc0], file: WiredTiger.wt, connection: /data/db/WiredTiger.wt: no such file or directory
The bug report says the same thing.
Attempt:
I would suggest trying and disabling WiredTiger in the config file.
source to share
If you build mkdir -p/data/db
it, there is a chance that you should start your server with the following command:sudo mongod
macOS / OSX: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
source to share