简体   繁体   中英

MongoDB running locally but when trying to access remotely it failed

Able to run MongoDB locally but when trying to access remotely it failed. Havent done any firewall setup. What could be the issue? How to do troubleshoot?

Also the MongoDB status show running

service mongod status
mongod (pid 25342) is running...

But when trying to restart the service it says

service mongod restart
Stopping mongod:                                           [  OK  ]
Starting mongod:                                           [FAILED]

But still the process is running

Update

Tried mongod --repair here is the update

2015-01-10T10:46:33.109-0500 [initandlisten] MongoDB starting : pid=29018 port=2                                                                                        7017 dbpath=/data/db 64-bit host=ns4008927.ip-192-99-3.net
2015-01-10T10:46:33.109-0500 [initandlisten] db version v2.6.6
2015-01-10T10:46:33.109-0500 [initandlisten] git version: 608e8bc319627693b04cc7                                                                                        da29ecc300a5f45a1f
2015-01-10T10:46:33.109-0500 [initandlisten] build info: Linux build10.nj1.10gen                                                                                        .cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LI                                                                                        B_VERSION=1_49
2015-01-10T10:46:33.109-0500 [initandlisten] allocator: tcmalloc
2015-01-10T10:46:33.109-0500 [initandlisten] options: { repair: true }
2015-01-10T10:46:33.112-0500 [initandlisten] finished checking dbs
2015-01-10T10:46:33.112-0500 [initandlisten] dbexit:
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: going to close listening                                                                                         sockets...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: going to flush diaglog...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: going to close sockets...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: waiting for fs preallocat                                                                                        or...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: closing all files...
2015-01-10T10:46:33.112-0500 [initandlisten] closeAllFiles() finished
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: removing fs lock...
2015-01-10T10:46:33.112-0500 [initandlisten] dbexit: really exiting now

You need to remove this line from mongo's config file (on Ubuntu, mine is at /etc/mongod.conf):

bind_ip = 127.0.0.1

Or, if it's YAML,

bindIp: 127.0.0.1

Source: http://docs.mongodb.org/manual/reference/configuration-options/

"Changed in version 2.6.0: The deb and rpm packages include a default configuration file that sets net.bindIp to 127.0.0.1."

The default value for bindIp/bind_ip is "all interfaces" - so that's where the deletion comes in handy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM