问题描述
我无法从Mac下的MongoDB Shell连接到Azure CosmosDB(mongodb api):
I can't connect to Azure CosmosDB (mongodb api) from MongoDB Shell under Mac:
mongo --host XXX.documents.azure.com --port 10255 --username XXX --password YYY --ssl
返回以下错误
MongoDB shell version v3.4.10
connecting to: mongodb://XXX.documents.azure.com:10255/
2017-11-23T20:56:57.762+1300 E QUERY [thread1] Error: socket exception [CLOSED] for 104.210.89.99:10255 :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
sw_vers:
ProductName: Mac OS X
ProductVersion: 10.12.4
BuildVersion: 16E195
mongo --version
mongo --version
MongoDB shell version v3.4.10
git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
哪个蒙哥
/usr/local/var/mongodb/bin/mongo
otool -L/usr/local/var/mongodb/bin/mongo
otool -L /usr/local/var/mongodb/bin/mongo
/usr/local/var/mongodb/bin/mongo:
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.8.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57740.60.18)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0)
我的理论是Azure CosmosDB强制实施SSL/TLS 1.2,而OpenSSL 0.9.8不支持但是,最新版本的MongoDB仍带有OpenSSL 0.9.8,因此存在一个问题:考虑到我不希望在本地构建MongoDB,如何使MondoDB Shell与Azure CosmosDB一起使用?有没有办法使用更新的OpenSSL库强制MongoDB Shell?
My theory is Azure CosmosDB enforces SSL/TLS 1.2 which is not supported by OpenSSL 0.9.8However, the latest version of MongoDB still comes with OpenSSL 0.9.8 so there is the question: How to make MondoDB Shell working with Azure CosmosDB considering I'm not eager to build MongoDB locally? Is there a way to force MongoDB Shell using newer OpenSSL libraries?
推荐答案
卸载/安装brew并通过brew重新安装mongodb之后,我得到了以下MongoDB版本:
After uninstall/install brew and reinstalling mongodb via brew I got following MongoDB version:
mongo --version
mongo --version
MongoDB shell version v3.4.10
git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
OpenSSL version: OpenSSL 1.0.2m 2 Nov 2017
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
可以很好地连接到CosmosDB.
which connects to CosmosDB just fine.
这篇关于Mongo Shell无法连接到Azure CosmosDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!