4

I have a problem. I'm using Virtual Box with RHEL (Red Hat Enterprise Linux) and I've installed a MongoDB and an Oracle-XE database.

I'm trying to connect to my DBs from my Windows OS. I can connect to my oracle DB using SQL Developer, however when trying to use Robomongo to connect to my MongoDB I can't connect. And I have no idea why.

I've specified port forwarding in both cases, why does one work and the other doesn't?

I've tryed the following:

address: localhost port: 27017
address: 127.0.0.1 port: 27017
address: mongo.localhost port: 27017

And others... Why can't I connect with Robomongo?

SaintLike
  • 9,119
  • 11
  • 39
  • 69

2 Answers2

9

In ubuntu I opended \etc\mongod.conf

I commented bind_ip = 0.0.0.0 to #bind_ip = 0.0.0.0

And as you know, you should use address: 192.168.0.105. port: 27017 (your linux ip; you can get Ip with command >$ hostname -I

Maybe same thing works for u in RedHat

Disposer
  • 6,201
  • 4
  • 31
  • 38
2

After comment the bind_ip in \etc\mongod.conf
You need to do port forwarding in the VirtualBox setting.
Typically your VirtualBbox IP would be something like 10.0.2.15
(confirm that with the command hostname -I in VM)

and suppose your host PC's IP is 192.168.1.234
(confirm that with the command ipconfig in host PC)

now open the settings for your VM
click Network -> Port forwarding

add something like:

Name      Protocol    HostIP               HostPort     GuestIP     GuestPort
Rule1      TCP          192.168.1.234    27017         10.0.2.15    27017
Rule2      TCP          192.168.1.234    80               10.0.2.15    80   (if you're hosting a web server)

now, intead of setting Robomongo's connecting IP=GuestIP
you should use address: 192.168.1.234 port: 27017
then the virtualbox should now direct your request to the right place.

Hank
  • 43
  • 3