Question

I am trying to SSH tunnel into my EC2 instance so that i can use Rock Mongo as my dB client.
I've tested the mongodb on AWS and it seems to be working fine, now if i could only connect using the client.

Here are my settings from Tunnelier enter image description here

an excerpt from Rock Mongo's config.php

$MONGO["servers"][$i]["mongo_name"] = "AWS";
$MONGO["servers"][$i]["mongo_host"] = "127.0.0.1:3000";
$MONGO["servers"][$i]["mongo_port"] = "27018";
$MONGO["servers"][$i]["control_users"]["admin"] = "admin";
$i ++;

and from command line for my EC2 instance i did

mongod --port 27018


However the connection does not happen and i get an error message of

Unable to connect MongoDB, please check your configurations. MongoDB said:failed to get host from :27018 of 127.0.0.1:3000:27018.

Question is this the correct way of going about it or should i use a different method?



Here's the fix incase anyone has a similar problem enter image description here

rockmongo's config.php

$MONGO["servers"][$i]["mongo_name"] = "AWS";
$MONGO["servers"][$i]["mongo_host"] = "127.0.0.1";
$MONGO["servers"][$i]["mongo_port"] = "3306";
$MONGO["servers"][$i]["control_users"]["admin"] = "admin";
Was it helpful?

Solution

I have no familiarity with Tunnelier, but it looks like you're configuring an HTTP proxy instead of actual SSH port forwarding. These are distinguished in the Tunnelier feature list. The following articles also have some screenshots of the Tunnelier interface with commentary that might point you in the right direction:

I believe the C2S or S2C tabs are what you should be looking into.

Also, you're specifying 127.0.0.1:3000 as the hostname in RockMongo's configuration, and then also providing 27018 as the port. RockMongo will concatenate those options into a connection string for Mongo, which isn't what you want. If you're setting up SSH port forwarding, your host and port will likely point to your local host. The port that Mongo is running on within AWS is irrelevant, as your client outside of AWS only cares about its own side of the SSH tunnel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top