I have a database in www.myweb.io
, which has SSL
. The version of mongo is 2.6.12
in the server: the version of mongo in local is 3.4.1
. I want to dump it into my local machine, modify it, and then restore back.
I tried
mongodump --host www.myweb.io --port 22 --username myname --password "mypassword"
and it gave me an error:
2017-11-20T20:57:07.775+0100 Failed: error connecting to db server: no reachable servers
Does anyone know what host and post I should set?
PS: in my localhost, I can use the following setting in Robo 3T to connect to the database:
1) under Connection
, specify localhost:27017
2) under SSH
, check Use SSH tunnel
, specify xxx.xx.xx.xx:22
as SSH Address
In /etc/nginx/sites-enabled/myweb.io
, there is listen 443 ssl
.
you are not connecting via SSL or TLS to the database.
Use an ssh tunnel to establish a connection to your mongodb
ssh -N -L 27018:localhost:27017 [email protected]
you can specify -f
to let ssh go in the background
Using mongodb
mongo --port 27018
Or telnet
telnet localhost 27018
dumping the database
mongodump --host 127.0.0.1 --port 27018 --db <dbName>
restore it somewhere, do your modifications
dump your local modifications
reapply the local modifications remote for example with mongorestore
or mongoimport
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With