我的网络内部子网mongod
正在运行10.1.150.24
,我的mogoid.yml
有这些行:
hosts:
- 10.1.150.24:27017
MongoDB在远程服务器上运行时未经过身份验证。
在远程服务器上,- localhost:27017
的rails应用程序连接没有问题。 mongod.conf
有
net:
bindIp: 0.0.0.0
设置并接受所有接口上的连接。
当我在本地的rails c
时,我可以看到连接错误,并尝试创建一个对象,甚至检索一个。
Foo.create(...)
像这样失败:
TypeError: no implicit conversion of nil into String
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/protocol/commands/authenticate.rb:35:in `+'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/protocol/commands/authenticate.rb:35:in `digest'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/protocol/commands/authenticate.rb:47:in `build_auth_command'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/protocol/commands/authenticate.rb:25:in `initialize'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/authenticatable.rb:71:in `new'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/authenticatable.rb:71:in `login'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/authenticatable.rb:28:in `block in apply_credentials'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/authenticatable.rb:26:in `each'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/authenticatable.rb:26:in `apply_credentials'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/node.rb:180:in `block in ensure_connected'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/node.rb:115:in `block in connection'
from /var/lib/gems/2.2.0/gems/connection_pool-2.1.1/lib/connection_pool.rb:62:in `with'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/node.rb:114:in `connection'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/node.rb:178:in `ensure_connected'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/node.rb:589:in `block in flush'
from /var/lib/gems/2.2.0/gems/moped-2.0.3/lib/moped/node.rb:617:in `block in logging'
... 33 levels...
from /var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
from /var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /home/mwerner/workspace/pricing/bin/rails:8:in `<top (required)>'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
鉴于authentication
moped
错误的数量,我很困惑,因为mongo实例上没有身份验证。
答案 0 :(得分:0)
运行sudo gem pristine --all
并杀死弹出进程解决了这个问题。我现在可以连接到远程服务器。