簡體   English   中英

連接到遠程MongoDB-SSH問題

[英]Connecting to remote MongoDB - SSH issues

我正在嘗試使用GUI並通過命令行連接到遠程MongoDB服務器,但是認為SSH部分存在問題。

我相信遠程服務器上配置了某些內容,這些內容不允許SSH隧道,並且我不確定從哪里開始尋找,請記住我還沒有sudo訪問權限。

我可以使用獨立的SSH工具連接到遠程服務器,沒有問題(putty,通過命令行的ssh,winscp),但是嘗試連接到MongoDB失敗

我嘗試在我的機器和遠程機器之間創建隧道

ssh -i ~/.ssh/private-key -N -L27018:localhost:27017 user@site.com -vvv

然后在我的機器上運行以下命令

$ mongo --port 27018
MongoDB shell version: 2.6.10
connecting to: 127.0.0.1:27018/test
2017-08-08T08:28:36.152+0000 DBClientCursor::init call() failed
2017-08-08T08:28:36.153+0000 Error: DBClientBase::findN: transport error: 127.0.0.1:27018 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:148
exception: connect failed

隨着隧道日志顯示此

debug1: Connection to port 27018 forwarding to localhost port 27017 requested.
debug2: fd 6 setting TCP_NODELAY
debug2: fd 6 setting O_NONBLOCK
debug3: fd 6 is O_NONBLOCK
debug1: channel 2: new [direct-tcpip]
debug3: send packet: type 90
debug3: receive packet: type 92
channel 2: open failed: administratively prohibited: open failed
debug2: channel 2: zombie
debug2: channel 2: garbage collecting
debug1: channel 2: free: direct-tcpip: listening port 27018 for localhost port 27017, connect from 127.0.0.1 port 41672 to 127.0.0.1 port 27018, nchannels 3
debug3: channel 2: status: The following connections are open:

作為測試,我設置了一個帶有mongodb的無所不在的計算機,並能夠通過命令行和GUI從主機連接。

是否有任何特定的配置變量可能會阻止我通過SSH連接?

遠程服務器具有這些設置,但是在無業游民的計算機上切換它們並沒有什么不同,我仍然能夠連接

#bind_ip = 127.0.0.1
channel 2: open failed: administratively prohibited: open failed

您要連接的ssh服務器配置為不允許TCP轉發。 如果您有權重新配置服務器,並且假定這是OpenSSH服務器,請參閱AllowTcpForwarding配置選項的文檔。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM