使用SSL连接到mongoDb服务器时遇到问题。我试着用Symfony连接到serwers而没有运气,所以我开始寻求更基本的连接。我试着用PHP:
$mongo = new MongoDB\Driver\Manager("mongodb://USER:PASS@HOST:27017/admin", array(
'ssl' => true,
'sslAllowInvalidCertificates' => true
));
$command = new MongoDB\Driver\Command(['ping' => 1]);
$cursor = $mongo->executeCommand('admin', $command);
我得到了:
No suitable servers found (`serverSelectionTryOnce` set): [TLS handshake failed: error:00000000:lib(0):func(0):reason(0) calling ismaster on 'HOST:27017']
所以我试过"纯粹"蒙戈:
mongo admin --host HOST --ssl -u USER -p PASS --verbose
但我明白了:
MongoDB shell version: 2.4.10
Mon Jul 3 13:42:33.885 versionArrayTest passed
connecting to: HOST:27017/admin
Mon Jul 3 13:42:44.392 creating new connection to:HOST:27017
Mon Jul 3 13:42:44.421 BackgroundJob starting: ConnectBG
Mon Jul 3 13:42:44.472 ERROR: could not negotiate SSL connection: EOF detected
Mon Jul 3 13:42:44.473 Error: socket exception [CONNECT_ERROR] for at src/mongo/shell/mongo.js:147
Mon Jul 3 13:42:44.473 User Assertion: 12513:connect failed
exception: connect failed
经过几个小时的搜索,我很困惑 - 我改变了什么?我和DB管理员谈过,他说其他用户可以使用SSL连接,所以问题可能在我身边。
答案 0 :(得分:0)
好的,管理员骗了我 - 这是网络问题。