您的位置:首页 > 数据库 > Mongodb

MongoDB无法正常关闭

2017-01-07 20:24 141 查看
我的MongoDBshi 2.6.6版本,安装的操作系统是Win7系统32位。

执行的操作:

C:\Program Files\MongoDB 2.6 Standard\bin>mongo 192.168.10.188:27017/test

故障码如下:

Server has startup warnings:
2017-01-07T11:34:42.203+0800 [initandlisten]
2017-01-07T11:34:42.203+0800 [initandlisten] ** NOTE: This is a 32 bit MongoDB b
inary.
2017-01-07T11:34:42.203+0800 [initandlisten] ** 32 bit builds are limited
to less than 2GB of data (or less with --journal).
2017-01-07T11:34:42.204+0800 [initandlisten] ** Note that journaling defau
lts to off for 32 bit and is currently off.
2017-01-07T11:34:42.204+0800 [initandlisten] ** See http://dochub.mongodb. org/core/32bit
2017-01-07T11:34:42.204+0800 [initandlisten]
> use admin
switched to db admin
> db.shutdownServer()
assert failed : unexpected error: "shutdownServer failed: shutdown must run from
localhost when running db without auth"
Error: assert failed : unexpected error: "shutdownServer failed: shutdown must r
un from localhost when running db without auth"
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at assert (src/mongo/shell/assert.js:20:5)
at DB.shutdownServer (src/mongo/shell/db.js:171:9)
at (shell):1:4
2017-01-07T11:42:52.209+0800 Error: assert failed : unexpected error: "shutdownS
erver failed: shutdown must run from localhost when running db without auth" at
src/mongo/shell/assert.js:13

解决办法:

C:\Program Files\MongoDB 2.6 Standard\bin>mongo --port 27017

运行结果:
MongoDB shell version: 2.6.6
connecting to: 127.0.0.1:27017/test
Server has startup warnings:
2017-01-07T11:34:42.203+0800 [initandlisten]
2017-01-07T11:34:42.203+0800 [initandlisten] ** NOTE: This is a 32 bit MongoDB b
inary.
2017-01-07T11:34:42.203+0800 [initandlisten] ** 32 bit builds are limited
to less than 2GB of data (or less with --journal).
2017-01-07T11:34:42.204+0800 [initandlisten] ** Note that journaling defau
lts to off for 32 bit and is currently off.
2017-01-07T11:34:42.204+0800 [initandlisten] ** See http://dochub.mongodb. org/core/32bit
2017-01-07T11:34:42.204+0800 [initandlisten]
> use admin
switched to db admin
> db.shutdownServer()
2017-01-07T11:54:55.198+0800 DBClientCursor::init call() failed
server should be down...
2017-01-07T11:54:55.215+0800 trying reconnect to 127.0.0.1:27017 (127.0.0.1) fai
led
2017-01-07T11:54:56.258+0800 warning: Failed to connect to 127.0.0.1:27017, reas
on: errno:10061 由于目标计算机积极拒绝,无法连接。
2017-01-07T11:54:56.259+0800 reconnect 127.0.0.1:27017 (127.0.0.1) failed failed
couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt fail
ed

可以看到,此时MongoDB服务器可以正常关闭了。

出现这种情况的原因就是IP地址为192.168.10.188的主机找不到,其实MongoDB中是不推荐采用IP地址定位主机的,否则有可能出现意想不到的问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MongoDB