这是 mongoid.yml ,它可以正常工作:
development:
clients:
default:
database: dbname
hosts:
- hostname:27017
- hostname:27018
options:
user: 'a.b@user.com'
password: 'asdfg1234'
ssl: true
ssl_verify: false
但是,如果我将此信息放在uri中并注释掉,那么ruby应用程序将无法连接到mongodb:
development:
clients:
default:
uri: mongodb://a.b%40user.com:asdfg1234@hostname:27017,hostname:27018/dbname?authSource=admin&ssl=true&ssl_verify=false
# database: dbname
# hosts:
# - hostname:27017
# - hostname:27018
# options:
# user: 'a.b@user.com'
# password: 'asdfg1234'
# ssl: true
# ssl_verify: false
它显示以下错误:
MONGODB | SSL handshake failed. MongoDB may not be configured with SSL support.
解决这个问题的任何帮助都很好。
答案 0 :(得分:0)
此解决方案对我有用:添加了自签名的ssl证书,配置了mongoid.yml,将所有信息放入uri,将uri添加到mongoid.yml中,作为ENV变量。