mongodb - Mongo can't connect -
i'm running ubuntu 15 on azure vps. installed mongodb , got , running fine. then, stopped mongod
service , changed db path , log path in mongod.conf
point directories i've created on attached disk:
# , how store data. storage: dbpath: /datadrive/lib/mongodb journal: enabled: true # engine: # mmapv1: # wiredtiger: # write logging data. systemlog: destination: file logappend: true path: /datadrive/log/mongodb/mongod.log
i restarted entire vps make double sure new changes take effect. when type mongo
following error:
2016-02-05t14:49:41.004+0000 w network [thread1] failed connect 127.0.0.1:27017, reason: errno:111 connection refused 2016-02-05t14:49:41.018+0000 e query [thread1] error: couldn't connect server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:224:14 @(connect):1:6
if reverse changes , use original log
, lib
locations, works. can make sure new locations used?
edit
after keeping old log location , trying above steps, following in log:
2016-02-05t15:19:47.049+0000 control [main] ***** server restarted ***** 2016-02-05t15:19:47.146+0000 control [initandlisten] mongodb starting : pid=1158 port=27017 dbpath=/datadrive/lib/mongodb 64-bit host=clientprojects 2016-02-05t15:19:47.146+0000 control [initandlisten] db version v3.2.1 2016-02-05t15:19:47.146+0000 control [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2 2016-02-05t15:19:47.146+0000 control [initandlisten] openssl version: openssl 1.0.2d 9 jul 2015 2016-02-05t15:19:47.146+0000 control [initandlisten] allocator: tcmalloc 2016-02-05t15:19:47.146+0000 control [initandlisten] modules: none 2016-02-05t15:19:47.146+0000 control [initandlisten] build environment: 2016-02-05t15:19:47.146+0000 control [initandlisten] distmod: ubuntu1404 2016-02-05t15:19:47.146+0000 control [initandlisten] distarch: x86_64 2016-02-05t15:19:47.146+0000 control [initandlisten] target_arch: x86_64 2016-02-05t15:19:47.146+0000 control [initandlisten] options: { config: "/etc/mongod.conf", net: { bindip: "127.0.0.1", port: 27017 }, storage: { dbpath: "/datadrive/lib/mongodb", journal: { enabled: true } }, systemlog: { destination: "file", logappend: true, path: "/var/log/mongodb/mongod.log" } } 2016-02-05t15:19:47.693+0000 storage [initandlisten] exception in initandlisten: 98 unable create/open lock file: /datadrive/lib/mongodb/mongod.lock errno:13 permission denied mongod instance running?, terminating 2016-02-05t15:19:47.693+0000 control [initandlisten] dbexit: rc: 100
first of can check if mongod started: sudo lsof -i | grep 27017
, check what's in log /datadrive/log/mongodb/mongod.log
.
edit:
stop instances of mongod (ps aux | grep mongod
should show nothing's running), remove lock file rm /datadrive/lib/mongodb/mongod.lock
, , restart service.
edit2:
directories config /datadrive/lib/mongodb/
, /datadrive/log/mongodb/
should exist , belong mongodb user. default mongodb:mongodb
, , defined in /etc/init.d/mongodb
daemonuser
.
Comments
Post a Comment