已经知道了,想要限制特定的IP去访问连接mongo的话,是去修改配置文件:
vi /etc/mongod.conf
修改其中的bindIP
但是此处,需要搞清楚:
如何确定mongo的客户端的IP
mongo how check client ip
然后去本地去连接了远程的mongo了:
但是结果mongo shell中都还是无法打印出正在连接的ip[root@naturling-general-01 ~]# mongo
MongoDB shell version: 3.2.19
connecting to: test
> db.currentOp().inprog
> db.currentOp().inprog
> db.currentOp(true).inprog
> db.currentOp(true).inprog
进去对应数据库,也不行:> use gridfs
switched to db gridfs
> db.currentOp(true).inprog
去看服务端mongod的log:2018-04-08T17:32:04.543+0800 I NETWORK [initandlisten] waiting for connections on port 27017
2018-04-08T17:32:12.235+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:35930 #1 (1 connection now open)
2018-04-08T17:32:12.237+0800 I ACCESS [conn1] Unauthorized: not authorized on admin to execute command { getLog: "startupWarnings" }
2018-04-08T17:32:12.239+0800 I ACCESS [conn1] Unauthorized: not authorized on admin to execute command { replSetGetStatus: 1.0, forShell: 1.0 }
2018-04-08T17:32:38.469+