0

I have two computers: Ubuntu1 and Ubuntu2. Ubuntu1 runs MongoDB with database Sacred3. I want to run connect from U2 to U1 via ssh and store there my experiment results.

What I tried and failed: 1. I installed mongo DB, created sacred3, I have ssh key to it. I edited /etc/mongod.conf adding:

# network interfaces net: port: 27017 bindIp: 0.0.0.0

Then I enabled port forwarding with

ssh -fN -i ~/.ssh/sacred_key-pair.pem -L 6666:localhost:27017 ubuntu@106.969.696.969 // (with proper ip)

so, as I undertstand, if I connect to my localhost:6666 it will be forwarded to 106.969.696.969:27017

So after that, I'm runnig an experiment with Sacred framework:

python exp1.py -m localhost:6666:sacred3

and this should write experiment to remote DB, HOWEVER i I get:

pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 111] Connection refused

which is driving me mad. please help!

  • your ssh tunnel (X:host:Y) command suggests that your localhot:6666 is forwarded to localhost:27017, and not 106.969.whatever:27017. If you want do set that up, you should have something like -L localhost:6666:106.969.696.969:27017. mongo is not listening on the loopback. – SYN Oct 15 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.