Mongo shell can not connect to Azure CosmosDB

你离开我真会死。 提交于 2019-12-20 07:27:02

问题


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

returns following error

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

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

which mongo

/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)

My theory is Azure CosmosDB enforces SSL/TLS 1.2 which is not supported by OpenSSL 0.9.8 However, 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?


回答1:


After uninstall/install brew and reinstalling mongodb via brew I got following MongoDB 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

which connects to CosmosDB just fine.



来源:https://stackoverflow.com/questions/47450559/mongo-shell-can-not-connect-to-azure-cosmosdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!