È stato facile per me collegarmi al mio server mysql remoto su AWS usando un sequelpro , tuttavia sto lottando per fare la stessa cosa con mongodb.
Ho provato a configurare un tunnel ssh dalla riga di comando in questo modo:
ssh -fN -l root -i path/to/id_rsa -L 9999:host.com:27017 host.com
Ho anche provato a sostituire l'host con un indirizzo IP
l'idea è di inoltrare tutte le connessioni mongodb sulla porta 9999 a quella sull'host sulla porta 27101 .. tuttavia quando eseguo il comando:
mongo --host localhost --port 9999
la connessione non riesce, ottengo questo invece:
MongoDB shell version: 2.6.0
connecting to: localhost:9999/test
channel 2: open failed: connect failed: Connection timed out
channel 3: open failed: connect failed: Connection timed out
2014-05-22T14:42:01.372+0300 DBClientCursor::init call() failed
2014-05-22T14:42:01.374+0300 Error: DBClientBase::findN: transport error: localhost:9999 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:148
exception: connect failed
se corro sudo netstat -plntottengo il seguente (che sembra in ordine):
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 4242/node
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1342/httpd2-prefork
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2552/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 2505/master
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 11719/mongod
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 16561/redis-server
qualche idea di cosa sto facendo di sbagliato?
aggiornamento: ecco come appare il comando funzionale finale (il credito va a kenster ):
ssh -fN -i ~/path/to/id_rsa -L 6666:localhost:27017 root@remote.server.com
dove il -fNcomando fa eseguire questo comando in background



-Lsembra contraddire la pagina man di ssh:-L [bind_address:]port:host:hostport Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side.dice esplicitamente chehostè l'host del server remoto .. lo stai usando per local?