我使用Homebrew安装了Mongo,并且在其他计算机上没有问题。
在较新的OSX 10.13.4上,mongo-ruby-driver无法使用localhost
进行连接。它只会与0.0.0.0
连接。
mongo
控制台工作正常。
我检查了Mongo配置,看起来很好(默认):
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
Mongo似乎在127.0.0.1上正常运行。
~> lsof -i :27017
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mongo 13535 baller 4u IPv4 0x1e53bde6462442cd 0t0 TCP localhost:57180->localhost:27017 (CLOSE_WAIT)
mongod 57808 baller 11u IPv4 0x1e53bde64622684d 0t0 TCP localhost:27017 (LISTEN)
ruby 2.5.1p57
可能导致此问题的原因是什么? DNS?蒙戈? mongo ruby司机?
编辑: 更多信息:
似乎没有使用conf文件。
连接127.0.0.1但不连接localhost。
应该在localhost上连接:
2018-06-14T13:43:41.305-0700 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-06-14T13:43:41.305-0700 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-06-14T13:43:41.305-0700 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-06-14T13:43:41.305-0700 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-06-14T13:43:41.305-0700 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-06-14T13:43:41.305-0700 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-06-14T13:43:41.305-0700 I CONTROL [initandlisten]
2018-06-14T13:43:41.335-0700 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-06-14T13:43:41.335-0700 I NETWORK [initandlisten] waiting for connections on port 27017
localhost
似乎确实在为操作系统工作。浏览http://localhost:27017/
时,我在日志中看到SSLHandshake失败。