Friday 14 April 2017

MongoDB - shutting down with code:100

I've been trying to set up MongoDB on my Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-22-generic x86_64) VPS and I've been running into a few problems. I am running as a user on my server that has root access but not using the root account itself.

I started to notice the problem when I was executing db.createUser() on the admin database so I could add other users and I was getting this error: not authorized to execute command

So I then proceeded to uninstall and install again using the tutorial as provided on the website: https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-ubuntu/

Now when I'm on stage 2 Verify that MongoDB has started successfully on the Run MongoDB Community Edition section, that is I look at my output from the file /var/log/mongodb/mongod.log, I get the following:

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've looked around and it is not the same error as found here, because that is to do with the fact there isn't an /data/db folder which I have. From that log I can see it is 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 results 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 should manually create that file as not seen this problem elsewhere. I made sure that mongodb user has permissions on these files too as stated in the answer to this question, but still no luck.

I'm really at a loss as to what to do, any help would be very appreciated as this is my like fifth attempt at getting it working!

Thanks!



via Alistair Hughes

No comments:

Post a Comment