I want to connect MongoDB server with python.
I have connected it on the terminal of MacOS and I run some MongoDB queries. (as described this link http://ghtorrent.org/raw.html)
sshtunnel: ssh -L 27017:dutihr.st.ewi.tudelft.nl:27017 ghtorrent@dutihr.st.ewi.tudelft.nl
connect to mongo: mongo -u ghtorrentro -p ghtorrentro github
what are the parameters of the above "ssh" and "mongo" commands?
How to connect remote mongodb with pymongo and Can I connect to GHTorrent MySQL/Mongodb database through ssh?
I see these question, I tried to write my code according to these answers but it's not working.
import pymongo
import sshtunnel
from sshtunnel import SSHTunnelForwarder
import paramiko
mypkey = paramiko.RSAKey.from_private_key_file("/Users/aaa/.ssh/id_rsa","xxx") #username(aaa) and password(xxx)
server = SSHTunnelForwarder(
('dutihr.st.ewi.tudelft.nl', 22),
ssh_username="",
ssh_pkey=mypkey,
ssh_private_key_password="xxx", #my password for key
remote_bind_address=('0.0.0.0',27017))
server.start()
how can I find the right parameters of these codes? how can I connect this MongoDB server? It give this error;
2019-10-31 00:11:51,304| ERROR | Secsh channel 49 open FAILED: open failed: Administratively prohibited
2019-10-31 00:11:51,305| ERROR | Could not establish connection from ('127.0.0.1', 51634) to remote side of the tunnel